diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aa2d7e22..c76a59046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,16 +2,51 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## [0.23.0] +## [0.24.0] + ### Added - Upgraded Plotly.js, the underlying library behind the -`dash_core_components.Graph` component, to [version 1.38.0](https://github.com/plotly/plotly.js/releases/tag/v1.38.0). -See https://github.com/plotly/plotly.js/releases/tag/v1.38.0 for the official notes. +`dash_core_components.Graph` component, to [version 1.39.1](https://github.com/plotly/plotly.js/releases/tag/v1.39.1). +See https://github.com/plotly/plotly.js/releases/tag/v1.39.1 for the official notes. Many of these features were funded directly by companies that rely on this library. If your organization or company would like to sponsor particular features or bug fixes in these open source libraries, please reach out: http://plot.ly/products/consulting-and-oem +As part of plotly.js release: +- Add support for on-graph text in scattergl traces [#2737](https://github.com/plotly/plotly.js/pull/2737), [#2783](https://github.com/plotly/plotly.js/pull/2783) +- Add gridshape attribute to polar subplots with values 'circular' (the default) and 'linear' (to draw polygon grids) [#2739](https://github.com/plotly/plotly.js/pull/2739) +- Add support for colorbar linked to marker.color values for splom, +scatterpolar and scatterpolargl traces [#2681](https://github.com/plotly/plotly.js/pull/2681) +- Revamp icon settings in custom mode bar buttons, allowing users to specify their own dimensions and SVG transforms [#2762](https://github.com/plotly/plotly.js/pull/2762) +- Add plotlyServerURL config option [#2760](https://github.com/plotly/plotly.js/pull/2760) +- Added no-WebGL warnings for graphs with scattergl, scatterpolargl, splom and parcoords traces [#2697](https://github.com/plotly/plotly.js/pull/2697) + +### Fixed +As part of plotly.js release: +- Fix Plotly.react's handling of changing auto-margins [#2681](https://github.com/plotly/plotly.js/pull/2681) +- Make plotting/updating WebGL-based traces fail gracefully when WebGL isn't +supported [#2697](https://github.com/plotly/plotly.js/pull/2697) +- Fix mapbox layout layer updates [#2734](https://github.com/plotly/plotly.js/pull/2734) +- Fix mapbox event inconsistencies [#2766](https://github.com/plotly/plotly.js/pull/2766) +- Correctly emit plotly_relayout at end of scroll on mapbox subplots [#2709](https://github.com/plotly/plotly.js/pull/2709) +- Fix scatter3d scalar hovertext handling [#2698](https://github.com/plotly/plotly.js/pull/2698) +- Fix line decimation for segments crossing the viewport [#2705](https://github.com/plotly/plotly.js/pull/2705) +- Fix surface trace contours when first level has length zero [#2712](https://github.com/plotly/plotly.js/pull/2712) +- Fix contour(x|y|z).highlight partial settings [#2712](https://github.com/plotly/plotly.js/pull/2712) +- Fix old date timezone precision in Chrome 67+ [#2747](https://github.com/plotly/plotly.js/pull/2747) +- Fix x-only zoom moves when xaxis.fixedrange: true[#2776](https://github.com/plotly/plotly.js/pull/2776) +- Fix colorbar edits for parcoords and histogram traces [#2681](https://github.com/plotly/plotly.js/pull/2681) +- Fix bandwidth for single-value violins [#2775](https://github.com/plotly/plotly.js/pull/2775) +- Make Plots.resize work when layout attribute is gone from graph div [#2710](https://github.com/plotly/plotly.js/pull/2710) +- Fix colorscale attribute descriptions [#2658](https://github.com/plotly/plotly.js/pull/2658) + +## [0.23.0] +### Added +- Upgraded Plotly.js, the underlying library behind the +`dash_core_components.Graph` component, to [version 1.38.0](https://github.com/plotly/plotly.js/releases/tag/v1.38.0). +See https://github.com/plotly/plotly.js/releases/tag/v1.38.0 for the official notes. + - Add 3D `cone` traces to visualize vector fields [#2641](https://github.com/plotly/plotly.js/pull/2641), [#2647](https://github.com/plotly/plotly.js/pull/2647) - Add ability to interactively change length and rotate line shapes [#2594](https://github.com/plotly/plotly.js/pull/2594) - Add `toImageButtonOptions` config object to override to-image mode bar button options [#2607](https://github.com/plotly/plotly.js/pull/2607) diff --git a/MANIFEST.in b/MANIFEST.in index b43773e44..e3621c4b8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,7 +3,7 @@ include dash_core_components/bundle.js.map include dash_core_components/metadata.json include dash_core_components/rc-slider@6.1.2.css include dash_core_components/react-select@1.0.0-rc.3.min.css -include dash_core_components/plotly-1.38.0.min.js +include dash_core_components/plotly-1.39.1.min.js include dash_core_components/react-virtualized-select@3.1.0.css include dash_core_components/react-virtualized@9.9.0.css include dash_core_components/react-dates@12.3.0.css diff --git a/dash_core_components/__init__.py b/dash_core_components/__init__.py index 8dd1d0c1e..11bdd326b 100644 --- a/dash_core_components/__init__.py +++ b/dash_core_components/__init__.py @@ -23,8 +23,8 @@ _js_dist = [ { - 'external_url': 'https://cdn.plot.ly/plotly-1.38.0.min.js', - 'relative_package_path': 'plotly-1.38.0.min.js', + 'external_url': 'https://cdn.plot.ly/plotly-1.39.1.min.js', + 'relative_package_path': 'plotly-1.39.1.min.js', 'namespace': 'dash_core_components' }, { diff --git a/dash_core_components/plotly-1.38.0.min.js b/dash_core_components/plotly-1.38.0.min.js deleted file mode 100644 index a1070e458..000000000 --- a/dash_core_components/plotly-1.38.0.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/** -* plotly.js v1.38.0 -* Copyright 2012-2018, 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{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=t()}}(function(){return function(){return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[o]={exports:{}};e[o][0].call(u.exports,function(t){var r=e[o][1][t];return i(r||t)},u,u.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;oMath.abs(e))c.rotate(o,0,0,-t*i*Math.PI*d.rotateSpeed/window.innerWidth);else{var s=d.zoomSpeed*a*e/window.innerHeight*(o-c.lastT())/100;c.pan(o,0,0,f*(Math.exp(s)-1))}},!0),d};var n=t("right-now"),i=t("3d-view"),a=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset"),l=t("has-passive-events")},{"3d-view":42,"has-passive-events":355,"mouse-change":378,"mouse-event-offset":379,"mouse-wheel":381,"right-now":440}],42:[function(t,e,r){"use strict";e.exports=function(t){var e=(t=t||{}).eye||[0,0,1],r=t.center||[0,0,0],s=t.up||[0,1,0],l=t.distanceLimits||[0,1/0],c=t.mode||"turntable",u=n(),f=i(),h=a();return u.setDistanceLimits(l[0],l[1]),u.lookAt(0,e,r,s),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,s),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,s),new o({turntable:u,orbit:f,matrix:h},c)};var n=t("turntable-camera-controller"),i=t("orbit-camera-controller"),a=t("matrix-camera-controller");function o(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}var s=o.prototype;[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]].forEach(function(t){for(var e=t[0],r=[],n=0;n0;--t)p(c*=.99),d(),h(c),d();function h(t){function r(t){return u(t.source)*t.value}i.forEach(function(n){n.forEach(function(n){if(n.targetLinks.length){var i=e.sum(n.targetLinks,r)/e.sum(n.targetLinks,f);n.y+=(i-u(n))*t}})})}function p(t){function r(t){return u(t.target)*t.value}i.slice().reverse().forEach(function(n){n.forEach(function(n){if(n.sourceLinks.length){var i=e.sum(n.sourceLinks,r)/e.sum(n.sourceLinks,f);n.y+=(i-u(n))*t}})})}function d(){i.forEach(function(t){var e,r,n,i=0,s=t.length;for(t.sort(g),n=0;n0&&(e.y+=r),i=e.y+e.dy+a;if((r=i-a-o[1])>0)for(i=e.y-=r,n=s-2;n>=0;--n)e=t[n],(r=e.y+e.dy+a-i)>0&&(e.y-=r),i=e.y})}function g(t,e){return t.y-e.y}}(n),c(),t},t.relayout=function(){return c(),t},t.link=function(){var t=.5;function e(e){var r=e.source.x+e.source.dx,i=e.target.x,a=n.interpolateNumber(r,i),o=a(t),s=a(1-t),l=e.source.y+e.sy,c=l+e.dy,u=e.target.y+e.ty,f=u+e.dy;return"M"+r+","+l+"C"+o+","+l+" "+s+","+u+" "+i+","+u+"L"+i+","+f+"C"+s+","+f+" "+o+","+c+" "+r+","+c+"Z"}return e.curvature=function(r){return arguments.length?(t=+r,e):t},e},t},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof r&&void 0!==e?i(r,t("d3-array"),t("d3-collection"),t("d3-interpolate")):i(n.d3=n.d3||{},n.d3,n.d3,n.d3)},{"d3-array":123,"d3-collection":124,"d3-interpolate":128}],44:[function(t,e,r){"use strict";var n="undefined"==typeof WeakMap?t("weak-map"):WeakMap,i=t("gl-buffer"),a=t("gl-vao"),o=new n;e.exports=function(t){var e=o.get(t),r=e&&(e._triangleBuffer.handle||e._triangleBuffer.buffer);if(!r||!t.isBuffer(r)){var n=i(t,new Float32Array([-1,-1,-1,4,4,-1]));(e=a(t,[{buffer:n,type:t.FLOAT,size:2}]))._triangleBuffer=n,o.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}},{"gl-buffer":211,"gl-vao":284,"weak-map":490}],45:[function(t,e,r){e.exports=function(t){var e=0,r=0,n=0,i=0;return t.map(function(t){var a=(t=t.slice())[0],o=a.toUpperCase();if(a!=o)switch(t[0]=o,a){case"a":t[6]+=n,t[7]+=i;break;case"v":t[1]+=i;break;case"h":t[1]+=n;break;default:for(var s=1;si&&(i=t[o]),t[o]=0;c--)if(u[c]!==f[c])return!1;for(c=u.length-1;c>=0;c--)if(l=u[c],!y(t[l],e[l],r,n))return!1;return!0}(t,e,r,o))}return r?t===e:t==e}function x(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function b(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function _(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&m(i,r,"Missing expected exception"+n);var o="string"==typeof n,s=!t&&a.isError(i),l=!t&&i&&!r;if((s&&o&&b(i,r)||l)&&m(i,r,"Got unwanted exception"+n),t&&i&&r&&!b(i,r)||!t&&i)throw i}f.AssertionError=function(t){var e;this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=d(g((e=this).actual),128)+" "+e.operator+" "+d(g(e.expected),128),this.generatedMessage=!0);var r=t.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var i=n.stack,a=p(r),o=i.indexOf("\n"+a);if(o>=0){var s=i.indexOf("\n",o+1);i=i.substring(s+1)}this.stack=i}}},a.inherits(f.AssertionError,Error),f.fail=m,f.ok=v,f.equal=function(t,e,r){t!=e&&m(t,e,r,"==",f.equal)},f.notEqual=function(t,e,r){t==e&&m(t,e,r,"!=",f.notEqual)},f.deepEqual=function(t,e,r){y(t,e,!1)||m(t,e,r,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(t,e,r){y(t,e,!0)||m(t,e,r,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(t,e,r){y(t,e,!1)&&m(t,e,r,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function t(e,r,n){y(e,r,!0)&&m(e,r,n,"notDeepStrictEqual",t)},f.strictEqual=function(t,e,r){t!==e&&m(t,e,r,"===",f.strictEqual)},f.notStrictEqual=function(t,e,r){t===e&&m(t,e,r,"!==",f.notStrictEqual)},f.throws=function(t,e,r){_(!0,t,e,r)},f.doesNotThrow=function(t,e,r){_(!1,t,e,r)},f.ifError=function(t){if(t)throw t};var w=Object.keys||function(t){var e=[];for(var r in t)o.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":487}],54:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],55:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=e.length,a=new Array(r+1),o=0;o0?l-4:l;var u=0;for(e=0;e>16&255,s[u++]=n>>8&255,s[u++]=255&n;2===o?(n=i[t.charCodeAt(e)]<<2|i[t.charCodeAt(e+1)]>>4,s[u++]=255&n):1===o&&(n=i[t.charCodeAt(e)]<<10|i[t.charCodeAt(e+1)]<<4|i[t.charCodeAt(e+2)]>>2,s[u++]=n>>8&255,s[u++]=255&n);return s},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,a="",o=[],s=0,l=r-i;sl?l:s+16383));1===i?(e=t[r-1],a+=n[e>>2],a+=n[e<<4&63],a+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],a+=n[e>>10],a+=n[e>>4&63],a+=n[e<<2&63],a+="=");return o.push(a),o.join("")};for(var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function u(t,e,r){for(var i,a,o=[],s=e;s>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],57:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))}},{"./lib/rationalize":67}],58:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],59:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]),t[1].mul(e[0]))}},{"./lib/rationalize":67}],60:[function(t,e,r){"use strict";var n=t("./is-rat"),i=t("./lib/is-bn"),a=t("./lib/num-to-bn"),o=t("./lib/str-to-bn"),s=t("./lib/rationalize"),l=t("./div");e.exports=function t(e,r){if(n(e))return r?l(e,t(r)):[e[0].clone(),e[1].clone()];var c=0;var u,f;if(i(e))u=e.clone();else if("string"==typeof e)u=o(e);else{if(0===e)return[a(0),a(1)];if(e===Math.floor(e))u=a(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),c-=256;u=a(e)}}if(n(r))u.mul(r[1]),f=r[0].clone();else if(i(r))f=r.clone();else if("string"==typeof r)f=o(r);else if(r)if(r===Math.floor(r))f=a(r);else{for(;r!==Math.floor(r);)r*=Math.pow(2,256),c+=256;f=a(r)}else f=a(1);c>0?u=u.ushln(c):c<0&&(f=f.ushln(-c));return s(u,f)}},{"./div":59,"./is-rat":61,"./lib/is-bn":65,"./lib/num-to-bn":66,"./lib/rationalize":67,"./lib/str-to-bn":68}],61:[function(t,e,r){"use strict";var n=t("./lib/is-bn");e.exports=function(t){return Array.isArray(t)&&2===t.length&&n(t[0])&&n(t[1])}},{"./lib/is-bn":65}],62:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":76}],63:[function(t,e,r){"use strict";var n=t("./bn-sign");e.exports=function(t){var e=t.length,r=t.words,i=0;if(1===e)i=r[0];else if(2===e)i=r[0]+67108864*r[1];else for(var a=0;a20)return 52;return r+32}},{"bit-twiddle":74,"double-bits":134}],65:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":76}],66:[function(t,e,r){"use strict";var n=t("bn.js"),i=t("double-bits");e.exports=function(t){var e=i.exponent(t);return e<52?new n(t):new n(t*Math.pow(2,52-e)).ushln(e-52)}},{"bn.js":76,"double-bits":134}],67:[function(t,e,r){"use strict";var n=t("./num-to-bn"),i=t("./bn-sign");e.exports=function(t,e){var r=i(t),a=i(e);if(0===r)return[n(0),n(1)];if(0===a)return[n(0),n(0)];a<0&&(t=t.neg(),e=e.neg());var o=t.gcd(e);if(o.cmpn(1))return[t.div(o),e.div(o)];return[t,e]}},{"./bn-sign":62,"./num-to-bn":66}],68:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":76}],69:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[0]),t[1].mul(e[1]))}},{"./lib/rationalize":67}],70:[function(t,e,r){"use strict";var n=t("./lib/bn-sign");e.exports=function(t){return n(t[0])*n(t[1])}},{"./lib/bn-sign":62}],71:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=function(t,e){return n(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}},{"./lib/rationalize":67}],72:[function(t,e,r){"use strict";var n=t("./lib/bn-to-num"),i=t("./lib/ctz");e.exports=function(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var a=e.abs().divmod(r.abs()),o=a.div,s=n(o),l=a.mod,c=e.negative!==r.negative?-1:1;if(0===l.cmpn(0))return c*s;if(s){var u=i(s)+4,f=n(l.ushln(u).divRound(r));return c*(s+f*Math.pow(2,-u))}var h=r.bitLength()-l.bitLength()+53,f=n(l.ushln(h).divRound(r));return h<1023?c*f*Math.pow(2,-h):(f*=Math.pow(2,-1023),c*f*Math.pow(2,1023-h))}},{"./lib/bn-to-num":63,"./lib/ctz":64}],73:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){var o=["function ",t,"(a,l,h,",n.join(","),"){",a?"":"var i=",r?"l-1":"h+1",";while(l<=h){var m=(l+h)>>>1,x=a",i?".get(m)":"[m]"];return a?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("}"),a?o.push("return -1};"):o.push("return i};"),o.join("")}function i(t,e,r,i){return 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(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],74:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<4,e|=r=((t>>>=e)>255)<<3,e|=r=((t>>>=r)>15)<<2,(e|=r=((t>>>=r)>3)<<1)|(t>>>=r)>>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 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(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)+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var i=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},r.interleave2=function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},r.deinterleave2=function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},r.interleave3=function(t,e,r){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(r=1227133513&((r=3272356035&((r=251719695&((r=4278190335&((r&=1023)|r<<16))|r<<8))|r<<4))|r<<2))<<2},r.deinterleave3=function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],75:[function(t,e,r){"use strict";var n=t("clamp");e.exports=function(t,e){e||(e={});var r,o,s,l,c,u,f,h,p,d,g,m=null==e.cutoff?.25:e.cutoff,v=null==e.radius?8:e.radius,y=e.channel||0;if(ArrayBuffer.isView(t)||Array.isArray(t)){if(!e.width||!e.height)throw Error("For raw data width and height should be provided by options");r=e.width,o=e.height,l=t,u=e.stride?e.stride:Math.floor(t.length/r/o)}else window.HTMLCanvasElement&&t instanceof window.HTMLCanvasElement?(f=(h=t).getContext("2d"),r=h.width,o=h.height,p=f.getImageData(0,0,r,o),l=p.data,u=4):window.CanvasRenderingContext2D&&t instanceof window.CanvasRenderingContext2D?(h=t.canvas,f=t,r=h.width,o=h.height,p=f.getImageData(0,0,r,o),l=p.data,u=4):window.ImageData&&t instanceof window.ImageData&&(p=t,r=t.width,o=t.height,l=p.data,u=4);if(s=Math.max(r,o),window.Uint8ClampedArray&&l instanceof window.Uint8ClampedArray||window.Uint8Array&&l instanceof window.Uint8Array)for(c=l,l=Array(r*o),d=0,g=c.length;d=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function l(t,e,r,n){for(var i=0,a=Math.min(t.length,r),o=e;o=49?s-49+10:s>=17?s-17+10:s}return i}a.isBN=function(t){return t instanceof a||null!==t&&"object"==typeof t&&t.constructor.wordSize===a.wordSize&&Array.isArray(t.words)},a.max=function(t,e){return t.cmp(e)>0?t:e},a.min=function(t,e){return t.cmp(e)<0?t:e},a.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},a.prototype._initArray=function(t,e,r){if(n("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=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=s(t,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=s(t,e,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,s=Math.min(a,a-o)+r,c=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var c=["","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"],u=[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],f=[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];function h(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var c=1;c>>26,f=67108863&l,h=Math.min(c,e.length-1),p=Math.max(0,c-t.length+1);p<=h;p++){var d=c-p|0;u+=(o=(i=0|t.words[d])*(a=0|e.words[p])+f)/67108864|0,f=67108863&o}r.words[c]=0|f,l=0|u}return 0!==l?r.words[c]=0|l:r.length--,r.strip()}a.prototype.toString=function(t,e){var r;if(t=t||10,e=0|e||1,16===t||"hex"===t){r="";for(var i=0,a=0,o=0;o>>24-i&16777215)||o!==this.length-1?c[6-l.length]+l+r:l+r,(i+=2)>=26&&(i-=26,o--)}for(0!==a&&(r=a.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var h=u[t],p=f[t];r="";var d=this.clone();for(d.negative=0;!d.isZero();){var g=d.modn(p).toString(t);r=(d=d.idivn(p)).isZero()?g+r:c[h-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n(void 0!==o),this.toArrayLike(o,t,e)},a.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},a.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,c=new t(a),u=this.clone();if(l){for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),c[s]=o;for(;s=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},a.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},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,p=0|o[1],d=8191&p,g=p>>>13,m=0|o[2],v=8191&m,y=m>>>13,x=0|o[3],b=8191&x,_=x>>>13,w=0|o[4],k=8191&w,M=w>>>13,A=0|o[5],T=8191&A,S=A>>>13,C=0|o[6],E=8191&C,L=C>>>13,z=0|o[7],P=8191&z,D=z>>>13,O=0|o[8],I=8191&O,R=O>>>13,B=0|o[9],F=8191&B,N=B>>>13,j=0|s[0],V=8191&j,U=j>>>13,q=0|s[1],H=8191&q,G=q>>>13,W=0|s[2],Y=8191&W,X=W>>>13,Z=0|s[3],J=8191&Z,K=Z>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ct=st>>>13,ut=0|s[8],ft=8191&ut,ht=ut>>>13,pt=0|s[9],dt=8191&pt,gt=pt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(c+(n=Math.imul(f,V))|0)+((8191&(i=(i=Math.imul(f,U))+Math.imul(h,V)|0))<<13)|0;c=((a=Math.imul(h,U))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(d,V),i=(i=Math.imul(d,U))+Math.imul(g,V)|0,a=Math.imul(g,U);var vt=(c+(n=n+Math.imul(f,H)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(h,H)|0))<<13)|0;c=((a=a+Math.imul(h,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,V),i=(i=Math.imul(v,U))+Math.imul(y,V)|0,a=Math.imul(y,U),n=n+Math.imul(d,H)|0,i=(i=i+Math.imul(d,G)|0)+Math.imul(g,H)|0,a=a+Math.imul(g,G)|0;var yt=(c+(n=n+Math.imul(f,Y)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(h,Y)|0))<<13)|0;c=((a=a+Math.imul(h,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(b,V),i=(i=Math.imul(b,U))+Math.imul(_,V)|0,a=Math.imul(_,U),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(y,H)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(d,Y)|0,i=(i=i+Math.imul(d,X)|0)+Math.imul(g,Y)|0,a=a+Math.imul(g,X)|0;var xt=(c+(n=n+Math.imul(f,J)|0)|0)+((8191&(i=(i=i+Math.imul(f,K)|0)+Math.imul(h,J)|0))<<13)|0;c=((a=a+Math.imul(h,K)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(k,V),i=(i=Math.imul(k,U))+Math.imul(M,V)|0,a=Math.imul(M,U),n=n+Math.imul(b,H)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(_,H)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(v,Y)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,Y)|0,a=a+Math.imul(y,X)|0,n=n+Math.imul(d,J)|0,i=(i=i+Math.imul(d,K)|0)+Math.imul(g,J)|0,a=a+Math.imul(g,K)|0;var bt=(c+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(h,$)|0))<<13)|0;c=((a=a+Math.imul(h,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(T,V),i=(i=Math.imul(T,U))+Math.imul(S,V)|0,a=Math.imul(S,U),n=n+Math.imul(k,H)|0,i=(i=i+Math.imul(k,G)|0)+Math.imul(M,H)|0,a=a+Math.imul(M,G)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(_,Y)|0,a=a+Math.imul(_,X)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(y,J)|0,a=a+Math.imul(y,K)|0,n=n+Math.imul(d,$)|0,i=(i=i+Math.imul(d,tt)|0)+Math.imul(g,$)|0,a=a+Math.imul(g,tt)|0;var _t=(c+(n=n+Math.imul(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(h,rt)|0))<<13)|0;c=((a=a+Math.imul(h,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(E,V),i=(i=Math.imul(E,U))+Math.imul(L,V)|0,a=Math.imul(L,U),n=n+Math.imul(T,H)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(S,H)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(k,Y)|0,i=(i=i+Math.imul(k,X)|0)+Math.imul(M,Y)|0,a=a+Math.imul(M,X)|0,n=n+Math.imul(b,J)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(_,J)|0,a=a+Math.imul(_,K)|0,n=n+Math.imul(v,$)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,$)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(d,rt)|0,i=(i=i+Math.imul(d,nt)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,nt)|0;var wt=(c+(n=n+Math.imul(f,at)|0)|0)+((8191&(i=(i=i+Math.imul(f,ot)|0)+Math.imul(h,at)|0))<<13)|0;c=((a=a+Math.imul(h,ot)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(P,V),i=(i=Math.imul(P,U))+Math.imul(D,V)|0,a=Math.imul(D,U),n=n+Math.imul(E,H)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(L,H)|0,a=a+Math.imul(L,G)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(S,Y)|0,a=a+Math.imul(S,X)|0,n=n+Math.imul(k,J)|0,i=(i=i+Math.imul(k,K)|0)+Math.imul(M,J)|0,a=a+Math.imul(M,K)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,$)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(d,at)|0,i=(i=i+Math.imul(d,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0;var kt=(c+(n=n+Math.imul(f,lt)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(h,lt)|0))<<13)|0;c=((a=a+Math.imul(h,ct)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(I,V),i=(i=Math.imul(I,U))+Math.imul(R,V)|0,a=Math.imul(R,U),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(D,H)|0,a=a+Math.imul(D,G)|0,n=n+Math.imul(E,Y)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(L,Y)|0,a=a+Math.imul(L,X)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,K)|0)+Math.imul(S,J)|0,a=a+Math.imul(S,K)|0,n=n+Math.imul(k,$)|0,i=(i=i+Math.imul(k,tt)|0)+Math.imul(M,$)|0,a=a+Math.imul(M,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(v,at)|0,i=(i=i+Math.imul(v,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(d,lt)|0,i=(i=i+Math.imul(d,ct)|0)+Math.imul(g,lt)|0,a=a+Math.imul(g,ct)|0;var Mt=(c+(n=n+Math.imul(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(h,ft)|0))<<13)|0;c=((a=a+Math.imul(h,ht)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(F,V),i=(i=Math.imul(F,U))+Math.imul(N,V)|0,a=Math.imul(N,U),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(R,H)|0,a=a+Math.imul(R,G)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(D,Y)|0,a=a+Math.imul(D,X)|0,n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,K)|0)+Math.imul(L,J)|0,a=a+Math.imul(L,K)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,tt)|0)+Math.imul(S,$)|0,a=a+Math.imul(S,tt)|0,n=n+Math.imul(k,rt)|0,i=(i=i+Math.imul(k,nt)|0)+Math.imul(M,rt)|0,a=a+Math.imul(M,nt)|0,n=n+Math.imul(b,at)|0,i=(i=i+Math.imul(b,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(v,lt)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(y,lt)|0,a=a+Math.imul(y,ct)|0,n=n+Math.imul(d,ft)|0,i=(i=i+Math.imul(d,ht)|0)+Math.imul(g,ft)|0,a=a+Math.imul(g,ht)|0;var At=(c+(n=n+Math.imul(f,dt)|0)|0)+((8191&(i=(i=i+Math.imul(f,gt)|0)+Math.imul(h,dt)|0))<<13)|0;c=((a=a+Math.imul(h,gt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(F,H),i=(i=Math.imul(F,G))+Math.imul(N,H)|0,a=Math.imul(N,G),n=n+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(R,Y)|0,a=a+Math.imul(R,X)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(D,J)|0,a=a+Math.imul(D,K)|0,n=n+Math.imul(E,$)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,nt)|0)+Math.imul(S,rt)|0,a=a+Math.imul(S,nt)|0,n=n+Math.imul(k,at)|0,i=(i=i+Math.imul(k,ot)|0)+Math.imul(M,at)|0,a=a+Math.imul(M,ot)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(_,lt)|0,a=a+Math.imul(_,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,ht)|0)+Math.imul(y,ft)|0,a=a+Math.imul(y,ht)|0;var Tt=(c+(n=n+Math.imul(d,dt)|0)|0)+((8191&(i=(i=i+Math.imul(d,gt)|0)+Math.imul(g,dt)|0))<<13)|0;c=((a=a+Math.imul(g,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,Y),i=(i=Math.imul(F,X))+Math.imul(N,Y)|0,a=Math.imul(N,X),n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(R,J)|0,a=a+Math.imul(R,K)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(L,rt)|0,a=a+Math.imul(L,nt)|0,n=n+Math.imul(T,at)|0,i=(i=i+Math.imul(T,ot)|0)+Math.imul(S,at)|0,a=a+Math.imul(S,ot)|0,n=n+Math.imul(k,lt)|0,i=(i=i+Math.imul(k,ct)|0)+Math.imul(M,lt)|0,a=a+Math.imul(M,ct)|0,n=n+Math.imul(b,ft)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(_,ft)|0,a=a+Math.imul(_,ht)|0;var St=(c+(n=n+Math.imul(v,dt)|0)|0)+((8191&(i=(i=i+Math.imul(v,gt)|0)+Math.imul(y,dt)|0))<<13)|0;c=((a=a+Math.imul(y,gt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,J),i=(i=Math.imul(F,K))+Math.imul(N,J)|0,a=Math.imul(N,K),n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(R,$)|0,a=a+Math.imul(R,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,nt)|0,n=n+Math.imul(E,at)|0,i=(i=i+Math.imul(E,ot)|0)+Math.imul(L,at)|0,a=a+Math.imul(L,ot)|0,n=n+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(S,lt)|0,a=a+Math.imul(S,ct)|0,n=n+Math.imul(k,ft)|0,i=(i=i+Math.imul(k,ht)|0)+Math.imul(M,ft)|0,a=a+Math.imul(M,ht)|0;var Ct=(c+(n=n+Math.imul(b,dt)|0)|0)+((8191&(i=(i=i+Math.imul(b,gt)|0)+Math.imul(_,dt)|0))<<13)|0;c=((a=a+Math.imul(_,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,$),i=(i=Math.imul(F,tt))+Math.imul(N,$)|0,a=Math.imul(N,tt),n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,nt)|0,n=n+Math.imul(P,at)|0,i=(i=i+Math.imul(P,ot)|0)+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,n=n+Math.imul(E,lt)|0,i=(i=i+Math.imul(E,ct)|0)+Math.imul(L,lt)|0,a=a+Math.imul(L,ct)|0,n=n+Math.imul(T,ft)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(S,ft)|0,a=a+Math.imul(S,ht)|0;var Et=(c+(n=n+Math.imul(k,dt)|0)|0)+((8191&(i=(i=i+Math.imul(k,gt)|0)+Math.imul(M,dt)|0))<<13)|0;c=((a=a+Math.imul(M,gt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(N,rt)|0,a=Math.imul(N,nt),n=n+Math.imul(I,at)|0,i=(i=i+Math.imul(I,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(D,lt)|0,a=a+Math.imul(D,ct)|0,n=n+Math.imul(E,ft)|0,i=(i=i+Math.imul(E,ht)|0)+Math.imul(L,ft)|0,a=a+Math.imul(L,ht)|0;var Lt=(c+(n=n+Math.imul(T,dt)|0)|0)+((8191&(i=(i=i+Math.imul(T,gt)|0)+Math.imul(S,dt)|0))<<13)|0;c=((a=a+Math.imul(S,gt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(F,at),i=(i=Math.imul(F,ot))+Math.imul(N,at)|0,a=Math.imul(N,ot),n=n+Math.imul(I,lt)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(R,lt)|0,a=a+Math.imul(R,ct)|0,n=n+Math.imul(P,ft)|0,i=(i=i+Math.imul(P,ht)|0)+Math.imul(D,ft)|0,a=a+Math.imul(D,ht)|0;var zt=(c+(n=n+Math.imul(E,dt)|0)|0)+((8191&(i=(i=i+Math.imul(E,gt)|0)+Math.imul(L,dt)|0))<<13)|0;c=((a=a+Math.imul(L,gt)|0)+(i>>>13)|0)+(zt>>>26)|0,zt&=67108863,n=Math.imul(F,lt),i=(i=Math.imul(F,ct))+Math.imul(N,lt)|0,a=Math.imul(N,ct),n=n+Math.imul(I,ft)|0,i=(i=i+Math.imul(I,ht)|0)+Math.imul(R,ft)|0,a=a+Math.imul(R,ht)|0;var Pt=(c+(n=n+Math.imul(P,dt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(D,dt)|0))<<13)|0;c=((a=a+Math.imul(D,gt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(F,ft),i=(i=Math.imul(F,ht))+Math.imul(N,ft)|0,a=Math.imul(N,ht);var Dt=(c+(n=n+Math.imul(I,dt)|0)|0)+((8191&(i=(i=i+Math.imul(I,gt)|0)+Math.imul(R,dt)|0))<<13)|0;c=((a=a+Math.imul(R,gt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(n=Math.imul(F,dt))|0)+((8191&(i=(i=Math.imul(F,gt))+Math.imul(N,dt)|0))<<13)|0;return c=((a=Math.imul(N,gt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,l[0]=mt,l[1]=vt,l[2]=yt,l[3]=xt,l[4]=bt,l[5]=_t,l[6]=wt,l[7]=kt,l[8]=Mt,l[9]=At,l[10]=Tt,l[11]=St,l[12]=Ct,l[13]=Et,l[14]=Lt,l[15]=zt,l[16]=Pt,l[17]=Dt,l[18]=Ot,0!==c&&(l[19]=c,r.length++),r};function d(t,e,r){return(new g).mulp(t,e,r)}function g(t,e){this.x=t,this.y=e}Math.imul||(p=h),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?p(this,t,e):r<63?h(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}(this,t,e):d(this,t,e)},g.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n>=1;return n},g.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,c=0;c=0&&(0!==u||c>=i);c--){var f=0|this.words[c];this.words[c]=u<<26-a|f>>>a,u=f&s}return l&&0!==u&&(l.words[l.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>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},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[i+r]=67108863&a}for(;i>26,this.words[i+r]=67108863&a;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this.strip()},a.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,l=n.length-i.length;if("mod"!==e){(s=new a(null)).length=l+1,s.words=new Array(s.length);for(var c=0;c=0;f--){var h=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new a(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new a(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new a(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,o,s},a.prototype.div=function(t){return this.divmod(t,"div",!1).div},a.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},a.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},a.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},a.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},a.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},a.prototype.divn=function(t){return this.clone().idivn(t)},a.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new a(1),o=new a(0),s=new a(0),l=new a(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var u=r.clone(),f=e.clone();!e.isZero();){for(var h=0,p=1;0==(e.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(u),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var d=0,g=1;0==(r.words[0]&g)&&d<26;++d,g<<=1);if(d>0)for(r.iushrn(d);d-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(u),l.isub(f)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(c)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,o=new a(1),s=new a(0),l=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,u=1;0==(e.words[0]&u)&&c<26;++c,u<<=1);if(c>0)for(e.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(l),o.iushrn(1);for(var f=0,h=1;0==(r.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s)):(r.isub(e),s.isub(o))}return(i=0===e.cmpn(1)?o:s).cmpn(0)<0&&i.iadd(t),i},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new w(t)},a.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(t){return this.red=t,this},a.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},a.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},a.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},a.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},a.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},a.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},a.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},a.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(t){return n(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};function v(t,e){this.name=t,this.p=new a(e,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function x(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function w(t){if("string"==typeof t){var e=a._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){w.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(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=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},i(y,v),y.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new x;else if("p192"===t)e=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return m[t]=e,e},w.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},w.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},w.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},w.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},w.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)},w.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},w.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)},w.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},w.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},w.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},w.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},w.prototype.isqr=function(t){return this.imul(t,t.clone())},w.prototype.sqr=function(t){return this.mul(t,t)},w.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new a(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var s=new a(1).toRed(this),l=s.redNeg(),c=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new a(2*u*u).toRed(this);0!==this.pow(u,c).cmp(l);)u.redIAdd(l);for(var f=this.pow(u,i),h=this.pow(t,i.addn(1).iushrn(1)),p=this.pow(t,i),d=o;0!==p.cmp(s);){for(var g=p,m=0;0!==g.cmp(s);m++)g=g.redSqr();n(m=0;n--){for(var c=e.words[n],u=l-1;u>=0;u--){var f=c>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===u)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},w.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},w.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new k(t)},i(k,w),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},k.prototype.imul=function(t,e){if(t.isZero()||e.isZero())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).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},k.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new a(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(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)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:85}],77:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i=t.length,a=0;for(e=0;e>>1;if(!(u<=0)){var f,h=i.mallocDouble(2*u*s),p=i.mallocInt32(s);if((s=l(t,u,h,p))>0){if(1===u&&n)a.init(s),f=a.sweepComplete(u,r,0,s,h,p,0,s,h,p);else{var d=i.mallocDouble(2*u*c),g=i.mallocInt32(c);(c=l(e,u,d,g))>0&&(a.init(s+c),f=1===u?a.sweepBipartite(u,r,0,s,h,p,0,c,d,g):o(u,r,n,s,h,p,c,d,g),i.free(d),i.free(g))}i.free(h),i.free(p)}return f}}}function u(t,e){n.push([t,e])}},{"./lib/intersect":80,"./lib/sweep":84,"typedarray-pool":481}],79:[function(t,e,r){"use strict";var n="d",i="ax",a="vv",o="fp",s="es",l="rs",c="re",u="rb",f="ri",h="rp",p="bs",d="be",g="bb",m="bi",v="bp",y="rv",x="Q",b=[n,i,a,l,c,u,f,p,d,g,m];function _(t){var e="bruteForce"+(t?"Full":"Partial"),r=[],_=b.slice();t||_.splice(3,0,o);var w=["function "+e+"("+_.join()+"){"];function k(e,o){var _=function(t,e,r){var o="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),_=["function ",o,"(",b.join(),"){","var ",s,"=2*",n,";"],w="for(var i="+l+","+h+"="+s+"*"+l+";i<"+c+";++i,"+h+"+="+s+"){var x0="+u+"["+i+"+"+h+"],x1="+u+"["+i+"+"+h+"+"+n+"],xi="+f+"[i];",k="for(var j="+p+","+v+"="+s+"*"+p+";j<"+d+";++j,"+v+"+="+s+"){var y0="+g+"["+i+"+"+v+"],"+(r?"y1="+g+"["+i+"+"+v+"+"+n+"],":"")+"yi="+m+"[j];";return t?_.push(w,x,":",k):_.push(k,x,":",w),r?_.push("if(y1"+d+"-"+p+"){"),t?(k(!0,!1),w.push("}else{"),k(!1,!1)):(w.push("if("+o+"){"),k(!0,!0),w.push("}else{"),k(!0,!1),w.push("}}else{if("+o+"){"),k(!1,!0),w.push("}else{"),k(!1,!1),w.push("}")),w.push("}}return "+e);var M=r.join("")+w.join("");return new Function(M)()}r.partial=_(!1),r.full=_(!0)},{}],80:[function(t,e,r){"use strict";e.exports=function(t,e,r,a,u,S,C,E,L){!function(t,e){var r=8*i.log2(e+1)*(t+1)|0,a=i.nextPow2(b*r);w.length0;){var O=(P-=1)*b,I=w[O],R=w[O+1],B=w[O+2],F=w[O+3],N=w[O+4],j=w[O+5],V=P*_,U=k[V],q=k[V+1],H=1&j,G=!!(16&j),W=u,Y=S,X=E,Z=L;if(H&&(W=E,Y=L,X=u,Z=S),!(2&j&&(B=m(t,I,R,B,W,Y,q),R>=B)||4&j&&(R=v(t,I,R,B,W,Y,U))>=B)){var J=B-R,K=N-F;if(G){if(t*J*(J+K)=p0)&&!(p1>=hi)",["p0","p1"]),g=u("lo===p0",["p0"]),m=u("lo>>1,h=2*t,p=f,d=s[h*f+e];for(;c=x?(p=y,d=x):v>=_?(p=m,d=v):(p=b,d=_):x>=_?(p=y,d=x):_>=v?(p=m,d=v):(p=b,d=_);for(var w=h*(u-1),k=h*p,M=0;Mr&&i[f+e]>c;--u,f-=o){for(var h=f,p=f+o,d=0;d=0&&i.push("lo=e[k+n]");t.indexOf("hi")>=0&&i.push("hi=e[k+o]");return r.push(n.replace("_",i.join()).replace("$",t)),Function.apply(void 0,r)};var n="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"},{}],83:[function(t,e,r){"use strict";e.exports=function(t,e){e<=4*n?i(0,e-1,t):function t(e,r,f){var h=(r-e+1)/6|0,p=e+h,d=r-h,g=e+r>>1,m=g-h,v=g+h,y=p,x=m,b=g,_=v,w=d,k=e+1,M=r-1,A=0;c(y,x,f)&&(A=y,y=x,x=A);c(_,w,f)&&(A=_,_=w,w=A);c(y,b,f)&&(A=y,y=b,b=A);c(x,b,f)&&(A=x,x=b,b=A);c(y,_,f)&&(A=y,y=_,_=A);c(b,_,f)&&(A=b,b=_,_=A);c(x,w,f)&&(A=x,x=w,w=A);c(x,b,f)&&(A=x,x=b,b=A);c(_,w,f)&&(A=_,_=w,w=A);var T=f[2*x];var S=f[2*x+1];var C=f[2*_];var E=f[2*_+1];var L=2*y;var z=2*b;var P=2*w;var D=2*p;var O=2*g;var I=2*d;for(var R=0;R<2;++R){var B=f[L+R],F=f[z+R],N=f[P+R];f[D+R]=B,f[O+R]=F,f[I+R]=N}o(m,e,f);o(v,r,f);for(var j=k;j<=M;++j)if(u(j,T,S,f))j!==k&&a(j,k,f),++k;else if(!u(j,C,E,f))for(;;){if(u(M,C,E,f)){u(M,T,S,f)?(s(j,k,M,f),++k,--M):(a(j,M,f),--M);break}if(--Mt;){var c=r[l-2],u=r[l-1];if(cr[e+1])}function u(t,e,r,n){var i=n[t*=2];return i>>1;a(p,S);for(var C=0,E=0,k=0;k=o)d(c,u,E--,L=L-o|0);else if(L>=0)d(s,l,C--,L);else if(L<=-o){L=-L-o|0;for(var z=0;z>>1;a(p,C);for(var E=0,L=0,z=0,M=0;M>1==p[2*M+3]>>1&&(D=2,M+=1),P<0){for(var O=-(P>>1)-1,I=0;I>1)-1;0===D?d(s,l,E--,O):1===D?d(c,u,L--,O):2===D&&d(f,h,z--,O)}}},scanBipartite:function(t,e,r,n,i,c,u,f,h,m,v,y){var x=0,b=2*t,_=e,w=e+t,k=1,M=1;n?M=o:k=o;for(var A=i;A>>1;a(p,E);for(var L=0,A=0;A=o?(P=!n,T-=o):(P=!!n,T-=1),P)g(s,l,L++,T);else{var D=y[T],O=b*T,I=v[O+e+1],R=v[O+e+1+t];t:for(var B=0;B>>1;a(p,k);for(var M=0,x=0;x=o)s[M++]=b-o;else{var T=d[b-=1],S=m*b,C=h[S+e+1],E=h[S+e+1+t];t:for(var L=0;L=0;--L)if(s[L]===b){for(var O=L+1;Oa)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return u(t)}return l(t,e,r)}function l(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return j(t)||t&&j(t.buffer)?function(t,e,r){if(e<0||t.byteLength=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function p(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||j(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return B(t).length;e=(""+e).toLowerCase(),n=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function g(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),V(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){var a,o=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var u=-1;for(a=r;as&&(r=s-l),a=r;a>=0;a--){for(var f=!0,h=0;hi&&(n=i):n=i;var a=e.length;n>a/2&&(n=a/2);for(var o=0;o>8,i=r%256,a.push(i),a.push(n);return a}(e,t.length-r),t,r,n)}function k(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function M(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(u=c);break;case 2:128==(192&(a=t[i+1]))&&(l=(31&c)<<6|63&a)>127&&(u=l);break;case 3:a=t[i+1],o=t[i+2],128==(192&a)&&128==(192&o)&&(l=(15&c)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:a=t[i+1],o=t[i+2],s=t[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(l=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,f=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=f}return function(t){var e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return C(this,e,r);case"utf8":case"utf-8":return M(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return S(this,e,r);case"base64":return k(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.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+=" ... ")),""},s.prototype.compare=function(t,e,r,n,i){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var a=i-n,o=r-e,l=Math.min(a,o),c=this.slice(n,i),u=t.slice(e,r),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return v(this,t,e,r);case"utf8":case"utf-8":return y(this,t,e,r);case"ascii":return x(this,t,e,r);case"latin1":case"binary":return b(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function z(t,e,r,n,i,a){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function P(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function O(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,0,r,8),i.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||L(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||L(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);for(var n=this[t],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||L(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*e)),a},s.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||L(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||z(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,n)||z(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=t/a&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||z(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||z(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||z(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||z(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||z(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);z(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);z(this,t,e,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||z(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||z(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||z(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||z(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||z(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return D(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return D(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return O(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return O(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function F(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function N(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function j(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function V(t){return t!=t}},{"base64-js":56,ieee754:356}],87:[function(t,e,r){"use strict";var n=t("./lib/monotone"),i=t("./lib/triangulation"),a=t("./lib/delaunay"),o=t("./lib/filter");function s(t){return[Math.min(t[0],t[1]),Math.max(t[0],t[1])]}function l(t,e){return t[0]-e[0]||t[1]-e[1]}function c(t,e,r){return e in t?t[e]:r}e.exports=function(t,e,r){Array.isArray(e)?(r=r||{},e=e||[]):(r=e||{},e=[]);var u=!!c(r,"delaunay",!0),f=!!c(r,"interior",!0),h=!!c(r,"exterior",!0),p=!!c(r,"infinity",!1);if(!f&&!h||0===t.length)return[];var d=n(t,e);if(u||f!==h||p){for(var g=i(t.length,function(t){return t.map(s).sort(l)}(e)),m=0;m0;){for(var u=r.pop(),s=r.pop(),f=-1,h=-1,l=o[s],d=1;d=0||(e.flip(s,u),i(t,e,r,f,s,h),i(t,e,r,s,h,f),i(t,e,r,h,u,f),i(t,e,r,u,f,h)))}}},{"binary-search-bounds":92,"robust-in-sphere":444}],89:[function(t,e,r){"use strict";var n,i=t("binary-search-bounds");function a(t,e,r,n,i,a,o){this.cells=t,this.neighbor=e,this.flags=n,this.constraint=r,this.active=i,this.next=a,this.boundary=o}function o(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}e.exports=function(t,e,r){var n=function(t,e){for(var r=t.cells(),n=r.length,i=0;i0||l.length>0;){for(;s.length>0;){var p=s.pop();if(c[p]!==-i){c[p]=i;u[p];for(var d=0;d<3;++d){var g=h[3*p+d];g>=0&&0===c[g]&&(f[3*p+d]?l.push(g):(s.push(g),c[g]=i))}}}var m=l;l=s,s=m,l.length=0,i=-i}var v=function(t,e,r){for(var n=0,i=0;i1&&i(r[h[p-2]],r[h[p-1]],a)>0;)t.push([h[p-1],h[p-2],o]),p-=1;h.length=p,h.push(o);var d=u.upperIds;for(p=d.length;p>1&&i(r[d[p-2]],r[d[p-1]],a)<0;)t.push([d[p-2],d[p-1],o]),p-=1;d.length=p,d.push(o)}}function p(t,e){var r;return(r=t.a[0]v[0]&&i.push(new c(v,m,s,f),new c(m,v,o,f))}i.sort(u);for(var y=i[0].a[0]-(1+Math.abs(i[0].a[0]))*Math.pow(2,-52),x=[new l([y,1],[y,0],-1,[],[],[],[])],b=[],f=0,_=i.length;f<_;++f){var w=i[f],k=w.type;k===a?h(b,x,t,w.a,w.idx):k===s?d(x,t,w):g(x,t,w)}return b}},{"binary-search-bounds":92,"robust-orientation":446}],91:[function(t,e,r){"use strict";var n=t("binary-search-bounds");function i(t,e){this.stars=t,this.edges=e}e.exports=function(t,e){for(var r=new Array(t),n=0;n=0}}(),a.removeTriangle=function(t,e,r){var n=this.stars;o(n[t],e,r),o(n[e],r,t),o(n[r],t,e)},a.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},a.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;n>>1,x=a[m]"];return i?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("}"),i?a.push("return -1};"):a.push("return i};"),a.join("")}function i(t,e,r,i){return 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(""))()}e.exports={ge:i(">=",!1,"GE"),gt:i(">",!1,"GT"),lt:i("<",!0,"LT"),le:i("<=",!0,"LE"),eq:i("-",!0,"EQ",!0)}},{}],93:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1,r=1;rr?r:t:te?e:t}},{}],97:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n;if(r){n=e;for(var i=new Array(e.length),a=0;ae[2]?1:0)}function v(t,e,r){if(0!==t.length){if(e)for(var n=0;n=0;--a){var x=e[u=(S=n[a])[0]],b=x[0],_=x[1],w=t[b],k=t[_];if((w[0]-k[0]||w[1]-k[1])<0){var M=b;b=_,_=M}x[0]=b;var A,T=x[1]=S[1];for(i&&(A=x[2]);a>0&&n[a-1][0]===u;){var S,C=(S=n[--a])[1];i?e.push([T,C,A]):e.push([T,C]),T=C}i?e.push([T,_,A]):e.push([T,_])}return h}(t,e,h,m,r));return v(e,y,r),!!y||(h.length>0||m.length>0)}},{"./lib/rat-seg-intersect":98,"big-rat":60,"big-rat/cmp":58,"big-rat/to-float":72,"box-intersect":78,nextafter:394,"rat-vec":428,"robust-segment-intersect":449,"union-find":482}],98:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var a=s(e,t),f=s(n,r),h=u(a,f);if(0===o(h))return null;var p=s(t,r),d=u(f,p),g=i(d,h),m=c(a,g);return l(t,m)};var n=t("big-rat/mul"),i=t("big-rat/div"),a=t("big-rat/sub"),o=t("big-rat/sign"),s=t("rat-vec/sub"),l=t("rat-vec/add"),c=t("rat-vec/muls");function u(t,e){return a(n(t[0],e[1]),n(t[1],e[0]))}},{"big-rat/div":59,"big-rat/mul":69,"big-rat/sign":70,"big-rat/sub":71,"rat-vec/add":427,"rat-vec/muls":429,"rat-vec/sub":430}],99:[function(t,e,r){"use strict";var n=t("clamp");function i(t,e){null==e&&(e=!0);var r=t[0],i=t[1],a=t[2],o=t[3];return null==o&&(o=e?1:255),e&&(r*=255,i*=255,a*=255,o*=255),16777216*(r=255&n(r,0,255))+((i=255&n(i,0,255))<<16)+((a=255&n(a,0,255))<<8)+(o=255&n(o,0,255))}e.exports=i,e.exports.to=i,e.exports.from=function(t,e){var r=(t=+t)>>>24,n=(16711680&t)>>>16,i=(65280&t)>>>8,a=255&t;return!1===e?[r,n,i,a]:[r/255,n/255,i/255,a/255]}},{clamp:96}],100:[function(t,e,r){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],101:[function(t,e,r){"use strict";var n=t("color-rgba"),i=t("clamp"),a=t("dtype");e.exports=function(t,e){"float"!==e&&e||(e="array"),"uint"===e&&(e="uint8"),"uint_clamped"===e&&(e="uint8_clamped");var r=a(e),o=new r(4);if(t instanceof r)return Array.isArray(t)?t.slice():(o.set(t),o);var s="uint8"!==e&&"uint8_clamped"!==e;return t instanceof Uint8Array||t instanceof Uint8ClampedArray?(o[0]=t[0],o[1]=t[1],o[2]=t[2],o[3]=null!=t[3]?t[3]:255,s&&(o[0]/=255,o[1]/=255,o[2]/=255,o[3]/=255),o):(t.length&&"string"!=typeof t||((t=n(t))[0]/=255,t[1]/=255,t[2]/=255),s?(o[0]=t[0],o[1]=t[1],o[2]=t[2],o[3]=null!=t[3]?t[3]:1):(o[0]=i(Math.round(255*t[0]),0,255),o[1]=i(Math.round(255*t[1]),0,255),o[2]=i(Math.round(255*t[2]),0,255),o[3]=null==t[3]?255:i(Math.floor(255*t[3]),0,255)),o)}},{clamp:96,"color-rgba":103,dtype:136}],102:[function(t,e,r){(function(r){"use strict";var n=t("color-name"),i=t("is-plain-obj"),a=t("defined");e.exports=function(t){var e,s,l=[],c=1;if("string"==typeof t)if(n[t])l=n[t].slice(),s="rgb";else if("transparent"===t)c=0,s="rgb",l=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var u=t.slice(1),f=u.length,h=f<=4;c=1,h?(l=[parseInt(u[0]+u[0],16),parseInt(u[1]+u[1],16),parseInt(u[2]+u[2],16)],4===f&&(c=parseInt(u[3]+u[3],16)/255)):(l=[parseInt(u[0]+u[1],16),parseInt(u[2]+u[3],16),parseInt(u[4]+u[5],16)],8===f&&(c=parseInt(u[6]+u[7],16)/255)),l[0]||(l[0]=0),l[1]||(l[1]=0),l[2]||(l[2]=0),s="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var p=e[1],u=p.replace(/a$/,"");s=u;var f="cmyk"===u?4:"gray"===u?1:3;l=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===f?parseFloat(t)/100:"rgb"===u?255*parseFloat(t)/100:parseFloat(t);if("h"===u[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)}),p===u&&l.push(1),c=void 0===l[f]?1:l[f],l=l.slice(0,f)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(l=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),s=t.match(/([a-z])/gi).join("").toLowerCase());else if("number"==typeof t)s="rgb",l=[t>>>16,(65280&t)>>>8,255&t];else if(i(t)){var d=a(t.r,t.red,t.R,null);null!==d?(s="rgb",l=[d,a(t.g,t.green,t.G),a(t.b,t.blue,t.B)]):(s="hsl",l=[a(t.h,t.hue,t.H),a(t.s,t.saturation,t.S),a(t.l,t.lightness,t.L,t.b,t.brightness)]),c=a(t.a,t.alpha,t.opacity,1),null!=t.opacity&&(c/=100)}else(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(l=[t[0],t[1],t[2]],s="rgb",c=4===t.length?t[3]:1);return{space:s,values:l,alpha:c}};var o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"color-name":100,defined:132,"is-plain-obj":366}],103:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t){var e;if("string"!=typeof t)throw Error("Argument should be a string");var r=n(t);return r.space?((e=Array(3))[0]=a(r.values[0],0,255),e[1]=a(r.values[1],0,255),e[2]=a(r.values[2],0,255),"h"===r.space[0]&&(e=i.rgb(e)),e.push(a(r.alpha,0,1)),e):[]}},{clamp:96,"color-parse":102,"color-space/hsl":104}],104:[function(t,e,r){"use strict";var n=t("./rgb");e.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,r,n,i,a,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[a=255*l,a,a];e=2*l-(r=l<.5?l*(1+s):l+s-l*s),i=[0,0,0];for(var c=0;c<3;c++)(n=o+1/3*-(c-1))<0?n++:n>1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[c]=255*a;return i}},n.hsl=function(t){var e,r,n=t[0]/255,i=t[1]/255,a=t[2]/255,o=Math.min(n,i,a),s=Math.max(n,i,a),l=s-o;return s===o?e=0:n===s?e=(i-a)/l:i===s?e=2+(a-n)/l:a===s&&(e=4+(n-i)/l),(e=Math.min(60*e,360))<0&&(e+=360),r=(o+s)/2,[e,100*(s===o?0:r<=.5?l/(s+o):l/(2-s-o)),100*r]}},{"./rgb":105}],105:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],106:[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:1,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],107:[function(t,e,r){"use strict";var n=t("./colorScale"),i=t("lerp");function a(t){return[t[0]/255,t[1]/255,t[2]/255,t[3]]}function o(t){for(var e,r="#",n=0;n<3;++n)r+=("00"+(e=(e=t[n]).toString(16))).substr(e.length);return r}function s(t){return"rgba("+t.join(",")+")"}e.exports=function(t){var e,r,l,c,u,f,h,p,d,g;t||(t={});p=(t.nshades||72)-1,h=t.format||"hex",(f=t.colormap)||(f="jet");if("string"==typeof f){if(f=f.toLowerCase(),!n[f])throw Error(f+" not a supported colorscale");u=n[f]}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);u=f.slice()}if(u.length>p)throw new Error(f+" map requires nshades to be at least size "+u.length);d=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:t.alpha.slice():"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1];e=u.map(function(t){return Math.round(t.index*p)}),d[0]=Math.min(Math.max(d[0],0),1),d[1]=Math.min(Math.max(d[1],0),1);var m=u.map(function(t,e){var r=u[e].index,n=u[e].rgb.slice();return 4===n.length&&n[3]>=0&&n[3]<=1?n:(n[3]=d[0]+(d[1]-d[0])*r,n)}),v=[];for(g=0;g0?-1:l(t,e,a)?-1:1:0===s?c>0?1:l(t,e,r)?1:-1:i(c-s)}var h=n(t,e,r);if(h>0)return o>0&&n(t,e,a)>0?1:-1;if(h<0)return o>0||n(t,e,a)>0?1:-1;var p=n(t,e,a);return p>0?1:l(t,e,r)?1:-1};var n=t("robust-orientation"),i=t("signum"),a=t("two-sum"),o=t("robust-product"),s=t("robust-sum");function l(t,e,r){var n=a(t[0],-e[0]),i=a(t[1],-e[1]),l=a(r[0],-e[0]),c=a(r[1],-e[1]),u=s(o(n,l),o(i,c));return u[u.length-1]>=0}},{"robust-orientation":446,"robust-product":447,"robust-sum":451,signum:452,"two-sum":480}],109:[function(t,e,r){e.exports=function(t,e){var r=t.length,a=t.length-e.length;if(a)return a;switch(r){case 0:return 0;case 1:return t[0]-e[0];case 2:return t[0]+t[1]-e[0]-e[1]||n(t[0],t[1])-n(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];if(a=o+t[2]-(s+e[2]))return a;var l=n(t[0],t[1]),c=n(e[0],e[1]);return n(l,t[2])-n(c,e[2])||n(l+t[2],o)-n(c+e[2],s);case 4:var u=t[0],f=t[1],h=t[2],p=t[3],d=e[0],g=e[1],m=e[2],v=e[3];return u+f+h+p-(d+g+m+v)||n(u,f,h,p)-n(d,g,m,v,d)||n(u+f,u+h,u+p,f+h,f+p,h+p)-n(d+g,d+m,d+v,g+m,g+v,m+v)||n(u+f+h,u+f+p,u+h+p,f+h+p)-n(d+g+m,d+g+v,d+m+v,g+m+v);default:for(var y=t.slice().sort(i),x=e.slice().sort(i),b=0;bt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}},{}],113:[function(t,e,r){"use strict";e.exports=function(t){var e=n(t),r=e.length;if(r<=2)return[];for(var i=new Array(r),a=e[r-1],o=0;o=e[l]&&(s+=1);a[o]=s}}return t}(o,r)}};var n=t("incremental-convex-hull"),i=t("affine-hull")},{"affine-hull":47,"incremental-convex-hull":357}],115:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],116:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a){var o=i-1,s=i*i,l=o*o,c=(1+2*i)*l,u=i*l,f=s*(3-2*i),h=s*o;if(t.length){a||(a=new Array(t.length));for(var p=t.length-1;p>=0;--p)a[p]=c*t[p]+u*e[p]+f*r[p]+h*n[p];return a}return c*t+u*e+f*r+h*n},e.exports.derivative=function(t,e,r,n,i,a){var o=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){a||(a=new Array(t.length));for(var u=t.length-1;u>=0;--u)a[u]=o*t[u]+s*e[u]+l*r[u]+c*n[u];return a}return o*t+s*e+l*r[u]+c*n}},{}],117:[function(t,e,r){"use strict";var n=t("./lib/thunk.js");e.exports=function(t){var e=new function(){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};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;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)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),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(e.shapeArgs.push(i),ir.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,n(e)}},{"./lib/thunk.js":119}],118:[function(t,e,r){"use strict";var n=t("uniq");function i(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],c=[],u=0,f=0;for(n=0;n0&&l.push("var "+c.join(",")),n=a-1;n>=0;--n)u=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",u,"]"].join(""))),l.push("}")}return l.join("\n")}function a(t,e,r){for(var n=t.body,i=[],a=[],o=0;o0&&y.push("shape=SS.slice(0)"),t.indexArgs.length>0){var x=new Array(r);for(l=0;l0&&v.push("var "+y.join(",")),l=0;l3&&v.push(a(t.pre,t,s));var k=a(t.body,t,s),M=function(t){for(var e=0,r=t[0].length;e0,c=[],u=0;u0;){"].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(u=0;u3&&v.push(a(t.post,t,s)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+v.join("\n")+"\n----------");var A=[t.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",M,function(t){for(var e=new Array(t.length),r=!0,n=0;n0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}(s)].join("");return new Function(["function ",A,"(",m.join(","),"){",v.join("\n"),"} return ",A].join(""))()}},{uniq:483}],119:[function(t,e,r){"use strict";var n=t("./compile.js");e.exports=function(t){var e=["'use strict'","var CACHED={}"],r=[],i=t.funcName+"_cwise_thunk";e.push(["return function ",i,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],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;u0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+f+".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"+f+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[u])+"]"))}for(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--\x3e0;) {"),e.push("if (!("+c.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),u=0;ue?1:t>=e?0:NaN},r=function(t){var r;return 1===t.length&&(r=t,t=function(t,n){return e(r(t),n)}),{left:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}};var n=r(e),i=n.right,a=n.left;function o(t,e){return[t,e]}var s=function(t){return null===t?NaN:+t},l=function(t,e){var r,n,i=t.length,a=0,o=-1,l=0,c=0;if(null==e)for(;++o1)return c/(a-1)},c=function(t,e){var r=l(t,e);return r?Math.sqrt(r):r},u=function(t,e){var r,n,i,a=t.length,o=-1;if(null==e){for(;++o=r)for(n=i=r;++or&&(n=r),i=r)for(n=i=r;++or&&(n=r),i=0?(a>=v?10:a>=y?5:a>=x?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=v?10:a>=y?5:a>=x?2:1)}function _(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),a=n/i;return a>=v?i*=10:a>=y?i*=5:a>=x&&(i*=2),e=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t);return o+(+r(t[a+1],a+1,t)-o)*(i-a)}},M=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++ar&&(n=r)}else for(;++a=r)for(n=r;++ar&&(n=r);return n},A=function(t){if(!(i=t.length))return[];for(var e=-1,r=M(t,T),n=new Array(r);++et?1:e>=t?0:NaN},t.deviation=c,t.extent=u,t.histogram=function(){var t=g,e=u,r=w;function n(n){var a,o,s=n.length,l=new Array(s);for(a=0;af;)h.pop(),--p;var d,g=new Array(p+1);for(a=0;a<=p;++a)(d=g[a]=[]).x0=a>0?h[a-1]:u,d.x1=a=r)for(n=r;++an&&(n=r)}else for(;++a=r)for(n=r;++an&&(n=r);return n},t.mean=function(t,e){var r,n=t.length,i=n,a=-1,o=0;if(null==e)for(;++a=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r},t.min=M,t.pairs=function(t,e){null==e&&(e=o);for(var r=0,n=t.length-1,i=t[0],a=new Array(n<0?0:n);r0)return[t];if((n=e0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++s=l.length)return null!=t&&n.sort(t),null!=e?e(n):n;for(var s,c,f,h=-1,p=n.length,d=l[i++],g=r(),m=a();++hl.length)return r;var i,a=c[n-1];return null!=e&&n>=l.length?i=r.entries():(i=[],r.each(function(e,r){i.push({key:r,values:t(e,n)})})),null!=a?i.sort(function(t,e){return a(t.key,e.key)}):i}(u(t,0,a,o),0)},key:function(t){return l.push(t),s},sortKeys:function(t){return c[l.length-1]=t,s},sortValues:function(e){return t=e,s},rollup:function(t){return e=t,s}}},t.set=c,t.map=r,t.keys=function(t){var e=[];for(var r in t)e.push(r);return e},t.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},t.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof r&&void 0!==e?r:n.d3=n.d3||{})},{}],125:[function(t,e,r){var n;n=this,function(t){"use strict";var e=function(t,e,r){t.prototype=e.prototype=r,r.constructor=t};function r(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function n(){}var i="\\s*([+-]?\\d+)\\s*",a="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",o="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",s=/^#([0-9a-f]{3})$/,l=/^#([0-9a-f]{6})$/,c=new RegExp("^rgb\\("+[i,i,i]+"\\)$"),u=new RegExp("^rgb\\("+[o,o,o]+"\\)$"),f=new RegExp("^rgba\\("+[i,i,i,a]+"\\)$"),h=new RegExp("^rgba\\("+[o,o,o,a]+"\\)$"),p=new RegExp("^hsl\\("+[a,o,o]+"\\)$"),d=new RegExp("^hsla\\("+[a,o,o,a]+"\\)$"),g={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function m(t){var e;return t=(t+"").trim().toLowerCase(),(e=s.exec(t))?new _((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=l.exec(t))?v(parseInt(e[1],16)):(e=c.exec(t))?new _(e[1],e[2],e[3],1):(e=u.exec(t))?new _(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=f.exec(t))?y(e[1],e[2],e[3],e[4]):(e=h.exec(t))?y(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=p.exec(t))?w(e[1],e[2]/100,e[3]/100,1):(e=d.exec(t))?w(e[1],e[2]/100,e[3]/100,e[4]):g.hasOwnProperty(t)?v(g[t]):"transparent"===t?new _(NaN,NaN,NaN,0):null}function v(t){return new _(t>>16&255,t>>8&255,255&t,1)}function y(t,e,r,n){return n<=0&&(t=e=r=NaN),new _(t,e,r,n)}function x(t){return t instanceof n||(t=m(t)),t?new _((t=t.rgb()).r,t.g,t.b,t.opacity):new _}function b(t,e,r,n){return 1===arguments.length?x(t):new _(t,e,r,null==n?1:n)}function _(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function w(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new M(t,e,r,n)}function k(t,e,r,i){return 1===arguments.length?function(t){if(t instanceof M)return new M(t.h,t.s,t.l,t.opacity);if(t instanceof n||(t=m(t)),!t)return new M;if(t instanceof M)return t;var e=(t=t.rgb()).r/255,r=t.g/255,i=t.b/255,a=Math.min(e,r,i),o=Math.max(e,r,i),s=NaN,l=o-a,c=(o+a)/2;return l?(s=e===o?(r-i)/l+6*(r0&&c<1?0:s,new M(s,l,c,t.opacity)}(t):new M(t,e,r,null==i?1:i)}function M(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function A(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}e(n,m,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),e(_,b,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new _(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new _(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),e(M,k,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new M(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new M(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,i=2*r-n;return new _(A(t>=240?t-240:t+120,i,n),A(t,i,n),A(t<120?t+240:t-120,i,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var T=Math.PI/180,S=180/Math.PI,C=.95047,E=1,L=1.08883,z=4/29,P=6/29,D=3*P*P,O=P*P*P;function I(t){if(t instanceof B)return new B(t.l,t.a,t.b,t.opacity);if(t instanceof q){var e=t.h*T;return new B(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof _||(t=x(t));var r=V(t.r),n=V(t.g),i=V(t.b),a=F((.4124564*r+.3575761*n+.1804375*i)/C),o=F((.2126729*r+.7151522*n+.072175*i)/E);return new B(116*o-16,500*(a-o),200*(o-F((.0193339*r+.119192*n+.9503041*i)/L)),t.opacity)}function R(t,e,r,n){return 1===arguments.length?I(t):new B(t,e,r,null==n?1:n)}function B(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function F(t){return t>O?Math.pow(t,1/3):t/D+z}function N(t){return t>P?t*t*t:D*(t-z)}function j(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function V(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function U(t,e,r,n){return 1===arguments.length?function(t){if(t instanceof q)return new q(t.h,t.c,t.l,t.opacity);t instanceof B||(t=I(t));var e=Math.atan2(t.b,t.a)*S;return new q(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new q(t,e,r,null==n?1:n)}function q(t,e,r,n){this.h=+t,this.c=+e,this.l=+r,this.opacity=+n}e(B,R,r(n,{brighter:function(t){return new B(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new B(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return t=E*N(t),new _(j(3.2404542*(e=C*N(e))-1.5371385*t-.4985314*(r=L*N(r))),j(-.969266*e+1.8760108*t+.041556*r),j(.0556434*e-.2040259*t+1.0572252*r),this.opacity)}})),e(q,U,r(n,{brighter:function(t){return new q(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new q(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return I(this).rgb()}}));var H=-.14861,G=1.78277,W=-.29227,Y=-.90649,X=1.97294,Z=X*Y,J=X*G,K=G*W-Y*H;function Q(t,e,r,n){return 1===arguments.length?function(t){if(t instanceof $)return new $(t.h,t.s,t.l,t.opacity);t instanceof _||(t=x(t));var e=t.r/255,r=t.g/255,n=t.b/255,i=(K*n+Z*e-J*r)/(K+Z-J),a=n-i,o=(X*(r-i)-W*a)/Y,s=Math.sqrt(o*o+a*a)/(X*i*(1-i)),l=s?Math.atan2(o,a)*S-120:NaN;return new $(l<0?l+360:l,s,i,t.opacity)}(t):new $(t,e,r,null==n?1:n)}function $(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}e($,Q,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new $(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new $(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*T,e=+this.l,r=isNaN(this.s)?0:this.s*e*(1-e),n=Math.cos(t),i=Math.sin(t);return new _(255*(e+r*(H*n+G*i)),255*(e+r*(W*n+Y*i)),255*(e+r*(X*n)),this.opacity)}})),t.color=m,t.rgb=b,t.hsl=k,t.lab=R,t.hcl=U,t.cubehelix=Q,Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof r&&void 0!==e?r:n.d3=n.d3||{})},{}],126:[function(t,e,r){var n;n=this,function(t){"use strict";var e={value:function(){}};function r(){for(var t,e=0,r=arguments.length,i={};e=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),l=-1,c=s.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++l0)for(var r,n,i=new Array(r),a=0;ah+c||np+c||au.index){var f=h-s.x-s.vx,m=p-s.y-s.vy,v=f*f+m*m;vt.r&&(t.r=t[e].r)}function h(){if(r){var e,i,a=r.length;for(n=new Array(a),e=0;e=c)){(t.data!==r||t.next)&&(0===f&&(d+=(f=o())*f),0===h&&(d+=(h=o())*h),d1?(null==r?u.remove(t):u.set(t,y(r)),e):u.get(t)},find:function(e,r,n){var i,a,o,s,l,c=0,u=t.length;for(null==n?n=1/0:n*=n,c=0;c1?(h.on(t,r),e):h.on(t)}}},t.forceX=function(t){var e,r,n,i=a(.1);function o(t){for(var i,a=0,o=e.length;a=1?(n=1,e-1):Math.floor(n*e),a=t[i],o=t[i+1],s=i>0?t[i-1]:2*a-o,l=i180||r<-180?r-360*Math.round(r/360):r):a(isNaN(t)?e:t)}function l(t){return 1==(t=+t)?c:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):a(isNaN(e)?r:e)}}function c(t,e){var r=e-t;return r?o(t,r):a(isNaN(t)?e:t)}var u=function t(r){var n=l(r);function i(t,r){var i=n((t=e.rgb(t)).r,(r=e.rgb(r)).r),a=n(t.g,r.g),o=n(t.b,r.b),s=c(t.opacity,r.opacity);return function(e){return t.r=i(e),t.g=a(e),t.b=o(e),t.opacity=s(e),t+""}}return i.gamma=t,i}(1);function f(t){return function(r){var n,i,a=r.length,o=new Array(a),s=new Array(a),l=new Array(a);for(n=0;na&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:m(r,n)})),a=x.lastIndex;return a180?e+=360:e-t>180&&(t+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:m(t,e)})):e&&r.push(i(r)+"rotate("+e+n)}(a.rotate,o.rotate,s,l),function(t,e,r,a){t!==e?a.push({i:r.push(i(r)+"skewX(",null,n)-2,x:m(t,e)}):e&&r.push(i(r)+"skewX("+e+n)}(a.skewX,o.skewX,s,l),function(t,e,r,n,a,o){if(t!==r||e!==n){var s=a.push(i(a)+"scale(",null,",",null,")");o.push({i:s-4,x:m(t,r)},{i:s-2,x:m(e,n)})}else 1===r&&1===n||a.push(i(a)+"scale("+r+","+n+")")}(a.scaleX,a.scaleY,o.scaleX,o.scaleY,s,l),a=o=null,function(t){for(var e,r=-1,n=l.length;++r=(a=(g+v)/2))?g=a:v=a,(u=r>=(o=(m+y)/2))?m=o:y=o,i=p,!(p=p[f=u<<1|c]))return i[f]=d,t;if(s=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===s&&r===l)return d.next=p,i?i[f]=d:t._root=d,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(c=e>=(a=(g+v)/2))?g=a:v=a,(u=r>=(o=(m+y)/2))?m=o:y=o}while((f=u<<1|c)==(h=(l>=o)<<1|s>=a));return i[h]=p,i[f]=d,t}var r=function(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i};function n(t){return t[0]}function i(t){return t[1]}function a(t,e,r){var a=new o(null==e?n:e,null==r?i:r,NaN,NaN,NaN,NaN);return null==t?a:a.addAll(t)}function o(t,e,r,n,i,a){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function s(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var l=a.prototype=o.prototype;l.copy=function(){var t,e,r=new o(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=s(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var i=0;i<4;++i)(e=n.source[i])&&(e.length?t.push({source:e,target:n.target[i]=new Array(4)}):n.target[i]=s(e));return r},l.add=function(t){var r=+this._x.call(null,t),n=+this._y.call(null,t);return e(this.cover(r,n),r,n,t)},l.addAll=function(t){var r,n,i,a,o=t.length,s=new Array(o),l=new Array(o),c=1/0,u=1/0,f=-1/0,h=-1/0;for(n=0;nf&&(f=i),ah&&(h=a));for(ft||t>i||n>e||e>a))return this;var o,s,l=i-r,c=this._root;switch(s=(e<(n+a)/2)<<1|t<(r+i)/2){case 0:do{(o=new Array(4))[s]=c,c=o}while(a=n+(l*=2),t>(i=r+l)||e>a);break;case 1:do{(o=new Array(4))[s]=c,c=o}while(a=n+(l*=2),(r=i-l)>t||e>a);break;case 2:do{(o=new Array(4))[s]=c,c=o}while(n=a-(l*=2),t>(i=r+l)||n>e);break;case 3:do{(o=new Array(4))[s]=c,c=o}while(n=a-(l*=2),(r=i-l)>t||n>e)}this._root&&this._root.length&&(this._root=c)}return this._x0=r,this._y0=n,this._x1=i,this._y1=a,this},l.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},l.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},l.find=function(t,e,n){var i,a,o,s,l,c,u,f=this._x0,h=this._y0,p=this._x1,d=this._y1,g=[],m=this._root;for(m&&g.push(new r(m,f,h,p,d)),null==n?n=1/0:(f=t-n,h=e-n,p=t+n,d=e+n,n*=n);c=g.pop();)if(!(!(m=c.node)||(a=c.x0)>p||(o=c.y0)>d||(s=c.x1)=y)<<1|t>=v)&&(c=g[g.length-1],g[g.length-1]=g[g.length-1-u],g[g.length-1-u]=c)}else{var x=t-+this._x.call(null,m.data),b=e-+this._y.call(null,m.data),_=x*x+b*b;if(_=(s=(d+m)/2))?d=s:m=s,(u=o>=(l=(g+v)/2))?g=l:v=l,e=p,!(p=p[f=u<<1|c]))return this;if(!p.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(r=e,h=f)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,n?(i?n.next=i:delete n.next,this):e?(i?e[f]=i:delete e[f],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(r?r[h]=p:this._root=p),this):(this._root=i,this)},l.removeAll=function(t){for(var e=0,r=t.length;e=0&&r._call.call(null,t),r=r._next;--n}function v(){l=(s=u.now())+c,n=i=0;try{m()}finally{n=0,function(){var t,n,i=e,a=1/0;for(;i;)i._call?(a>i._time&&(a=i._time),t=i,i=i._next):(n=i._next,i._next=null,i=t?t._next=n:e=n);r=t,x(a)}(),l=0}}function y(){var t=u.now(),e=t-s;e>o&&(c-=e,s=t)}function x(t){n||(i&&(i=clearTimeout(i)),t-l>24?(t<1/0&&(i=setTimeout(v,t-u.now()-c)),a&&(a=clearInterval(a))):(a||(s=u.now(),a=setInterval(y,o)),n=1,f(v)))}d.prototype=g.prototype={constructor:d,restart:function(t,n,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?h():+i)+(null==n?0:+n),this._next||r===this||(r?r._next=this:e=this,r=this),this._call=t,this._time=i,x()},stop:function(){this._call&&(this._call=null,this._time=1/0,x())}};t.now=h,t.timer=g,t.timerFlush=m,t.timeout=function(t,e,r){var n=new d;return e=null==e?0:+e,n.restart(function(r){n.stop(),t(r+e)},e,r),n},t.interval=function(t,e,r){var n=new d,i=e;return null==e?(n.restart(t,e,r),n):(e=+e,r=null==r?h():+r,n.restart(function a(o){o+=i,n.restart(a,i+=e,r),t(o)},e,r),n)},Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof r&&void 0!==e?r:n.d3=n.d3||{})},{}],131:[function(t,e,r){!function(){var t={version:"3.5.17"},r=[].slice,n=function(t){return r.call(t)},i=this.document;function a(t){return t&&(t.ownerDocument||t.document||t).documentElement}function o(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(i)try{n(i.documentElement.childNodes)[0].nodeType}catch(t){n=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}),i)try{i.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var s=this.Element.prototype,l=s.setAttribute,c=s.setAttributeNS,u=this.CSSStyleDeclaration.prototype,f=u.setProperty;s.setAttribute=function(t,e){l.call(this,t,e+"")},s.setAttributeNS=function(t,e,r){c.call(this,t,e,r+"")},u.setProperty=function(t,e,r){f.call(this,t,e+"",r)}}function h(t,e){return te?1:t>=e?0:NaN}function p(t){return null===t?NaN:+t}function d(t){return!isNaN(t)}function g(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}}t.ascending=h,t.descending=function(t,e){return et?1:e>=t?0:NaN},t.min=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++in&&(r=n)}else{for(;++i=n){r=n;break}for(;++in&&(r=n)}return r},t.max=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++ir&&(r=n)}else{for(;++i=n){r=n;break}for(;++ir&&(r=n)}return r},t.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=i=n;break}for(;++an&&(r=n),i=n){r=i=n;break}for(;++an&&(r=n),i1)return o/(l-1)},t.deviation=function(){var e=t.variance.apply(this,arguments);return e?Math.sqrt(e):e};var m=g(h);function v(t){return t.length}t.bisectLeft=m.left,t.bisect=t.bisectRight=m.right,t.bisector=function(t){return g(1===t.length?function(e,r){return h(t(e),r)}:t)},t.shuffle=function(t,e,r){(a=arguments.length)<3&&(r=t.length,a<2&&(e=0));for(var n,i,a=r-e;a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},t.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},t.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r};var y=Math.abs;function x(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function b(){this._=Object.create(null)}t.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=[],a=function(t){var e=1;for(;t*e%1;)e*=10;return e}(y(r)),o=-1;if(t*=a,e*=a,(r*=a)<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=i.length)return r?r.call(n,a):e?a.sort(e):a;for(var l,c,u,f,h=-1,p=a.length,d=i[s++],g=new b;++h=i.length)return e;var n=[],o=a[r++];return e.forEach(function(e,i){n.push({key:e,values:t(i,r)})}),o?n.sort(function(t,e){return o(t.key,e.key)}):n}(o(t.map,e,0),0)},n.key=function(t){return i.push(t),n},n.sortKeys=function(t){return a[i.length-1]=t,n},n.sortValues=function(t){return e=t,n},n.rollup=function(t){return r=t,n},n},t.set=function(t){var e=new L;if(t)for(var r=0,n=t.length;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}},t.event=null,t.requote=function(t){return t.replace(V,"\\$&")};var V=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,U={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function q(t){return U(t,Y),t}var H=function(t,e){return e.querySelector(t)},G=function(t,e){return e.querySelectorAll(t)},W=function(t,e){var r=t.matches||t[D(t,"matchesSelector")];return(W=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(H=function(t,e){return Sizzle(t,e)[0]||null},G=Sizzle,W=Sizzle.matchesSelector),t.selection=function(){return t.select(i.documentElement)};var Y=t.selection.prototype=[];function X(t){return"function"==typeof t?t:function(){return H(t,this)}}function Z(t){return"function"==typeof t?t:function(){return G(t,this)}}Y.select=function(t){var e,r,n,i,a=[];t=X(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),K.hasOwnProperty(r)?{space:K[r],local:t}:t}},Y.attr=function(e,r){if(arguments.length<2){if("string"==typeof e){var n=this.node();return(e=t.ns.qualify(e)).local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(r in e)this.each(Q(r,e[r]));return this}return this.each(Q(e,r))},Y.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=et(t)).length,i=-1;if(e=r.classList){for(;++i=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},Y.sort=function(t){t=function(t){arguments.length||(t=h);return function(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}}.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.slice(0,o));var l=dt.get(e);function c(){var t=this[a];t&&(this.removeEventListener(e,t,t.$),delete this[a])}return l&&(e=l,s=mt),o?r?function(){var t=s(r,n(arguments));c.call(this),this.addEventListener(e,this[a]=t,t.$=i),t._=r}:c:r?I:function(){var r,n=new RegExp("^__on([^.]+)"+t.requote(e)+"$");for(var i in this)if(r=i.match(n)){var a=this[i];this.removeEventListener(r[1],a,a.$),delete this[i]}}}t.selection.enter=ft,t.selection.enter.prototype=ht,ht.append=Y.append,ht.empty=Y.empty,ht.node=Y.node,ht.call=Y.call,ht.size=Y.size,ht.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s=n&&(n=e+1);!(o=s[n])&&++n0?1:t<0?-1:0}function Pt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function Dt(t){return t>1?0:t<-1?At:Math.acos(t)}function Ot(t){return t>1?Ct:t<-1?-Ct:Math.asin(t)}function It(t){return((t=Math.exp(t))+1/t)/2}function Rt(t){return(t=Math.sin(t/2))*t}var Bt=Math.SQRT2;t.interpolateZoom=function(t,e){var r,n,i=t[0],a=t[1],o=t[2],s=e[0],l=e[1],c=e[2],u=s-i,f=l-a,h=u*u+f*f;if(h0&&(e=e.transition().duration(g)),e.call(w.event)}function S(){c&&c.domain(l.range().map(function(t){return(t-h.x)/h.k}).map(l.invert)),f&&f.domain(u.range().map(function(t){return(t-h.y)/h.k}).map(u.invert))}function C(t){m++||t({type:"zoomstart"})}function E(t){S(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function L(t){--m||(t({type:"zoomend"}),r=null)}function z(){var e=this,r=_.of(e,arguments),n=0,i=t.select(o(e)).on(y,function(){n=1,A(t.mouse(e),a),E(r)}).on(x,function(){i.on(y,null).on(x,null),s(n),L(r)}),a=k(t.mouse(e)),s=xt(e);ss.call(e),C(r)}function P(){var e,r=this,n=_.of(r,arguments),i={},a=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,c="touchend"+o,u=[],f=t.select(r),p=xt(r);function d(){var n=t.touches(r);return e=h.k,n.forEach(function(t){t.identifier in i&&(i[t.identifier]=k(t))}),n}function g(){var e=t.event.target;t.select(e).on(l,m).on(c,y),u.push(e);for(var n=t.event.changedTouches,o=0,f=n.length;o1){v=p[0];var x=p[1],b=v[0]-x[0],_=v[1]-x[1];a=b*b+_*_}}function m(){var o,l,c,u,f=t.touches(r);ss.call(r);for(var h=0,p=f.length;h360?t-=360:t<0&&(t+=360),t<60?n+(i-n)*t/60:t<180?i:t<240?n+(i-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(i=r<=.5?r*(1+e):r+e-r*e),new ae(a(t+120),a(t),a(t-120))}function Gt(e,r,n){return this instanceof Gt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Gt?new Gt(e.h,e.c,e.l):ee(e instanceof Xt?e.l:(e=he((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Gt(e,r,n)}qt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ut(this.h,this.s,this.l/t)},qt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ut(this.h,this.s,t*this.l)},qt.rgb=function(){return Ht(this.h,this.s,this.l)},t.hcl=Gt;var Wt=Gt.prototype=new Vt;function Yt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Xt(r,Math.cos(t*=Et)*e,Math.sin(t)*e)}function Xt(t,e,r){return this instanceof Xt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Xt?new Xt(t.l,t.a,t.b):t instanceof Gt?Yt(t.h,t.c,t.l):he((t=ae(t)).r,t.g,t.b):new Xt(t,e,r)}Wt.brighter=function(t){return new Gt(this.h,this.c,Math.min(100,this.l+Zt*(arguments.length?t:1)))},Wt.darker=function(t){return new Gt(this.h,this.c,Math.max(0,this.l-Zt*(arguments.length?t:1)))},Wt.rgb=function(){return Yt(this.h,this.c,this.l).rgb()},t.lab=Xt;var Zt=18,Jt=.95047,Kt=1,Qt=1.08883,$t=Xt.prototype=new Vt;function te(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new ae(ie(3.2404542*(i=re(i)*Jt)-1.5371385*(n=re(n)*Kt)-.4985314*(a=re(a)*Qt)),ie(-.969266*i+1.8760108*n+.041556*a),ie(.0556434*i-.2040259*n+1.0572252*a))}function ee(t,e,r){return t>0?new Gt(Math.atan2(r,e)*Lt,Math.sqrt(e*e+r*r),t):new Gt(NaN,NaN,t)}function re(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ne(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function ie(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ae(t,e,r){return this instanceof ae?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ae?new ae(t.r,t.g,t.b):ue(""+t,ae,Ht):new ae(t,e,r)}function oe(t){return new ae(t>>16,t>>8&255,255&t)}function se(t){return oe(t)+""}$t.brighter=function(t){return new Xt(Math.min(100,this.l+Zt*(arguments.length?t:1)),this.a,this.b)},$t.darker=function(t){return new Xt(Math.max(0,this.l-Zt*(arguments.length?t:1)),this.a,this.b)},$t.rgb=function(){return te(this.l,this.a,this.b)},t.rgb=ae;var le=ae.prototype=new Vt;function ce(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function ue(t,e,r){var n,i,a,o=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(de(i[0]),de(i[1]),de(i[2]))}return(a=ge.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function fe(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e0&&l<1?0:n),new Ut(n,i,l)}function he(t,e,r){var n=ne((.4124564*(t=pe(t))+.3575761*(e=pe(e))+.1804375*(r=pe(r)))/Jt),i=ne((.2126729*t+.7151522*e+.072175*r)/Kt);return Xt(116*i-16,500*(n-i),200*(i-ne((.0193339*t+.119192*e+.9503041*r)/Qt)))}function pe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function de(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}le.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&&e=200&&e<300||304===e){try{t=i.call(o,c)}catch(t){return void s.error.call(o,t)}s.load.call(o,t)}else s.error.call(o,c)}return!this.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(e)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=f:c.onreadystatechange=function(){c.readyState>3&&f()},c.onprogress=function(e){var r=t.event;t.event=e;try{s.progress.call(o,c)}finally{t.event=r}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?l[t]:(null==e?delete l[t]:l[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(r=null==t?null:t+"",o):r},o.responseType=function(t){return arguments.length?(u=t,o):u},o.response=function(t){return i=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(n(arguments)))}}),o.send=function(t,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),c.open(t,e,!0),null==r||"accept"in l||(l.accept=r+",*/*"),c.setRequestHeader)for(var a in l)c.setRequestHeader(a,l[a]);return null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=u&&(c.responseType=u),null!=i&&o.on("error",i).on("load",function(t){i(null,t)}),s.beforesend.call(o,c),c.send(null==n?null:n),o},o.abort=function(){return c.abort(),o},t.rebind(o,s,"on"),null==a?o:o.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(a))}ge.forEach(function(t,e){ge.set(t,oe(e))}),t.functor=me,t.xhr=ve(z),t.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function i(t,r,n){arguments.length<3&&(n=r,r=null);var i=ye(t,e,null==r?a:o(r),n);return i.row=function(t){return arguments.length?i.response(null==(r=t)?a:o(t)):r},i}function a(t){return i.parse(t.responseText)}function o(t){return function(e){return i.parse(e.responseText,t)}}function s(e){return e.map(l).join(t)}function l(t){return r.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return i.parse=function(t,e){var r;return i.parseRows(t,function(t,n){if(r)return r(t,n-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");r=e?function(t,r){return e(i(t),r)}:i})},i.parseRows=function(t,e){var r,i,a={},o={},s=[],l=t.length,c=0,u=0;function f(){if(c>=l)return o;if(i)return i=!1,a;var e=c;if(34===t.charCodeAt(e)){for(var r=e;r++24?(isFinite(e)&&(clearTimeout(we),we=setTimeout(Ae,e)),_e=0):(_e=1,ke(Ae))}function Te(){for(var t=Date.now(),e=xe;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Se(){for(var t,e=xe,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}});t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Ce(e,r))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Ee[8+n/3]};var Le=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ze=t.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(e,r){return(e=t.round(e,Ce(e,r))).toFixed(Math.max(0,Math.min(20,Ce(e*(1+1e-15),r))))}});function Pe(t){return t+""}var De=t.time={},Oe=Date;function Ie(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Ie.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(){Re.setUTCDate.apply(this._,arguments)},setDay:function(){Re.setUTCDay.apply(this._,arguments)},setFullYear:function(){Re.setUTCFullYear.apply(this._,arguments)},setHours:function(){Re.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Re.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Re.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Re.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Re.setUTCSeconds.apply(this._,arguments)},setTime:function(){Re.setTime.apply(this._,arguments)}};var Re=Date.prototype;function Be(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o68?1900:2e3),r+i[0].length):-1}function Je(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Ke(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function Qe(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function $e(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function ir(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=y(e)/60|0,i=y(e)%60;return r+Ue(n,"0",2)+Ue(i,"0",2)}function ar(t,e,r){Ve.lastIndex=0;var n=Ve.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function or(t){for(var e=t.length,r=-1;++r0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(r-=s,r+s)),!((l+=s+1)>e));)s=i[o=(o+1)%i.length];return a.reverse().join(n)}:z;return function(e){var n=Le.exec(e),i=n[1]||" ",s=n[2]||">",l=n[3]||"-",c=n[4]||"",u=n[5],f=+n[6],h=n[7],p=n[8],d=n[9],g=1,m="",v="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(u||"0"===i&&"="===s)&&(u=i="0",s="="),d){case"n":h=!0,d="g";break;case"%":g=100,v="%",d="f";break;case"p":g=100,v="%",d="r";break;case"b":case"o":case"x":case"X":"#"===c&&(m="0"+d.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,d="r"}"$"===c&&(m=a[0],v=a[1]),"r"!=d||p||(d="g"),null!=p&&("g"==d?p=Math.max(1,Math.min(21,p)):"e"!=d&&"f"!=d||(p=Math.max(0,Math.min(20,p)))),d=ze.get(d)||Pe;var b=u&&h;return function(e){var n=v;if(y&&e%1)return"";var a=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===l?"":l;if(g<0){var c=t.formatPrefix(e,p);e=c.scale(e),n=c.symbol+v}else e*=g;var _,w,k=(e=d(e,p)).lastIndexOf(".");if(k<0){var M=x?e.lastIndexOf("e"):-1;M<0?(_=e,w=""):(_=e.substring(0,M),w=e.substring(M))}else _=e.substring(0,k),w=r+e.substring(k+1);!u&&h&&(_=o(_,1/0));var A=m.length+_.length+w.length+(b?0:a.length),T=A"===s?T+a+e:"^"===s?T.substring(0,A>>=1)+a+e+T.substring(A):a+(b?e:T+e))+n}}}(e),timeFormat:function(e){var r=e.dateTime,n=e.date,i=e.time,a=e.periods,o=e.days,s=e.shortDays,l=e.months,c=e.shortMonths;function u(t){var e=t.length;function r(r){for(var n,i,a,o=[],s=-1,l=0;++s=c)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=w[o in Ne?e.charAt(s++):o])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}u.utc=function(t){var e=u(t);function r(t){try{var r=new(Oe=Ie);return r._=t,e(r)}finally{Oe=Date}}return r.parse=function(t){try{Oe=Ie;var r=e.parse(t);return r&&r._}finally{Oe=Date}},r.toString=e.toString,r},u.multi=u.utc.multi=or;var h=t.map(),p=qe(o),d=He(o),g=qe(s),m=He(s),v=qe(l),y=He(l),x=qe(c),b=He(c);a.forEach(function(t,e){h.set(t.toLowerCase(),e)});var _={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return c[t.getMonth()]},B:function(t){return l[t.getMonth()]},c:u(r),d:function(t,e){return Ue(t.getDate(),e,2)},e:function(t,e){return Ue(t.getDate(),e,2)},H:function(t,e){return Ue(t.getHours(),e,2)},I:function(t,e){return Ue(t.getHours()%12||12,e,2)},j:function(t,e){return Ue(1+De.dayOfYear(t),e,3)},L:function(t,e){return Ue(t.getMilliseconds(),e,3)},m:function(t,e){return Ue(t.getMonth()+1,e,2)},M:function(t,e){return Ue(t.getMinutes(),e,2)},p:function(t){return a[+(t.getHours()>=12)]},S:function(t,e){return Ue(t.getSeconds(),e,2)},U:function(t,e){return Ue(De.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ue(De.mondayOfYear(t),e,2)},x:u(n),X:u(i),y:function(t,e){return Ue(t.getFullYear()%100,e,2)},Y:function(t,e){return Ue(t.getFullYear()%1e4,e,4)},Z:ir,"%":function(){return"%"}},w={a:function(t,e,r){g.lastIndex=0;var n=g.exec(e.slice(r));return n?(t.w=m.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){p.lastIndex=0;var n=p.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){v.lastIndex=0;var n=v.exec(e.slice(r));return n?(t.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,e,r){return f(t,_.c.toString(),e,r)},d:Qe,e:Qe,H:tr,I:tr,j:$e,L:nr,m:Ke,M:er,p:function(t,e,r){var n=h.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)},S:rr,U:We,w:Ge,W:Ye,x:function(t,e,r){return f(t,_.x.toString(),e,r)},X:function(t,e,r){return f(t,_.X.toString(),e,r)},y:Ze,Y:Xe,Z:Je,"%":ar};return u}(e)}};var sr=t.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"]});function lr(){}t.format=sr.numberFormat,t.geo={},lr.prototype={s:0,t:0,add:function(t){ur(t,this.t,cr),ur(cr.s,this.s,this),this.s?this.t+=cr.t:this.s=cr.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var cr=new lr;function ur(t,e,r){var n=r.s=t+e,i=n-t,a=n-i;r.t=t-a+(e-i)}function fr(t,e){t&&pr.hasOwnProperty(t.type)&&pr[t.type](t,e)}t.geo.stream=function(t,e){t&&hr.hasOwnProperty(t.type)?hr[t.type](t,e):fr(t,e)};var hr={Feature:function(t,e){fr(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n=0?1:-1,s=o*a,l=Math.cos(e),c=Math.sin(e),u=i*c,f=n*l+u*Math.cos(s),h=u*o*Math.sin(s);Cr.add(Math.atan2(h,f)),r=t,n=l,i=c}Er.point=function(o,s){Er.point=a,r=(t=o)*Et,n=Math.cos(s=(e=s)*Et/2+At/4),i=Math.sin(s)},Er.lineEnd=function(){a(t,e)}}function zr(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 Pr(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Dr(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 Or(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Ir(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Rr(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 Br(t){return[Math.atan2(t[1],t[0]),Ot(t[2])]}function Fr(t,e){return y(t[0]-e[0])kt?i=90:c<-kt&&(r=-90),f[0]=e,f[1]=n}};function p(t,a){u.push(f=[e=t,n=t]),ai&&(i=a)}function d(t,o){var s=zr([t*Et,o*Et]);if(l){var c=Dr(l,s),u=Dr([c[1],-c[0],0],c);Rr(u),u=Br(u);var f=t-a,h=f>0?1:-1,d=u[0]*Lt*h,g=y(f)>180;if(g^(h*ai&&(i=m);else if(g^(h*a<(d=(d+360)%360-180)&&di&&(i=o);g?t_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t):n>=e?(tn&&(n=t)):t>a?_(e,t)>_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t)}else p(t,o);l=s,a=t}function g(){h.point=d}function m(){f[0]=e,f[1]=n,h.point=p,l=null}function v(t,e){if(l){var r=t-a;c+=y(r)>180?r+(r>0?360:-360):r}else o=t,s=e;Er.point(t,e),d(t,e)}function x(){Er.lineStart()}function b(){v(o,s),Er.lineEnd(),y(c)>kt&&(e=-(n=180)),f[0]=e,f[1]=n,l=null}function _(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function k(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):s.push(g=p);for(var l,c,p,d=-1/0,g=(o=0,s[c=s.length-1]);o<=c;g=p,++o)p=s[o],(l=_(g[1],p[0]))>d&&(d=l,e=p[0],n=g[1])}return u=f=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,i]]}}(),t.geo.centroid=function(e){vr=yr=xr=br=_r=wr=kr=Mr=Ar=Tr=Sr=0,t.geo.stream(e,Nr);var r=Ar,n=Tr,i=Sr,a=r*r+n*n+i*i;return a=0;--s)i.point((f=u[s])[0],f[1]);else n(p.x,p.p.x,-1,i);p=p.p}u=(p=p.o).z,d=!d}while(!p.v);i.lineEnd()}}}function Xr(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n=0?1:-1,k=w*_,M=k>At,A=d*x;if(Cr.add(Math.atan2(A*w*Math.sin(k),g*b+A*Math.cos(k))),a+=M?_+w*Tt:_,M^h>=r^v>=r){var T=Dr(zr(f),zr(t));Rr(T);var S=Dr(i,T);Rr(S);var C=(M^_>=0?-1:1)*Ot(S[2]);(n>C||n===C&&(T[0]||T[1]))&&(o+=M^_>=0?1:-1)}if(!m++)break;h=v,d=x,g=b,f=t}}return(a<-kt||a0){for(x||(o.polygonStart(),x=!0),o.lineStart();++a1&&2&e&&r.push(r.pop().concat(r.shift())),s.push(r.filter(Kr))}return u}}function Kr(t){return t.length>1}function Qr(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:I,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function $r(t,e){return((t=t.x)[0]<0?t[1]-Ct-kt:Ct-t[1])-((e=e.x)[0]<0?e[1]-Ct-kt:Ct-e[1])}var tn=Jr(Wr,function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?At:-At,l=y(a-r);y(l-At)0?Ct:-Ct),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=At&&(y(r-i)kt?Math.atan((Math.sin(e)*(a=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+n)/2}(r,n,a,o),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=a,n=o),i=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}},function(t,e,r,n){var i;if(null==t)i=r*Ct,n.point(-At,i),n.point(0,i),n.point(At,i),n.point(At,0),n.point(At,-i),n.point(0,-i),n.point(-At,-i),n.point(-At,0),n.point(-At,i);else if(y(t[0]-e[0])>kt){var a=t[0]0)){if(a/=h,h<0){if(a0){if(a>f)return;a>u&&(u=a)}if(a=r-l,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>u&&(u=a)}else if(h>0){if(a0)){if(a/=p,p<0){if(a0){if(a>f)return;a>u&&(u=a)}if(a=n-c,p||!(a<0)){if(a/=p,p<0){if(a>f)return;a>u&&(u=a)}else if(p>0){if(a0&&(i.a={x:l+u*h,y:c+u*p}),f<1&&(i.b={x:l+f*h,y:c+f*p}),i}}}}}}var rn=1e9;function nn(e,r,n,i){return function(l){var c,u,f,h,p,d,g,m,v,y,x,b=l,_=Qr(),w=en(e,r,n,i),k={point:T,lineStart:function(){k.point=S,u&&u.push(f=[]);y=!0,v=!1,g=m=NaN},lineEnd:function(){c&&(S(h,p),d&&v&&_.rejoin(),c.push(_.buffer()));k.point=T,v&&l.lineEnd()},polygonStart:function(){l=_,c=[],u=[],x=!0},polygonEnd:function(){l=b,c=t.merge(c);var r=function(t){for(var e=0,r=u.length,n=t[1],i=0;in&&Pt(c,a,t)>0&&++e:a[1]<=n&&Pt(c,a,t)<0&&--e,c=a;return 0!==e}([e,i]),n=x&&r,a=c.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),M(null,null,1,l),l.lineEnd()),a&&Yr(c,o,r,M,l),l.polygonEnd()),c=u=f=null}};function M(t,o,l,c){var u=0,f=0;if(null==t||(u=a(t,l))!==(f=a(o,l))||s(t,o)<0^l>0)do{c.point(0===u||3===u?e:n,u>1?i:r)}while((u=(u+l+4)%4)!==f);else c.point(o[0],o[1])}function A(t,a){return e<=t&&t<=n&&r<=a&&a<=i}function T(t,e){A(t,e)&&l.point(t,e)}function S(t,e){var r=A(t=Math.max(-rn,Math.min(rn,t)),e=Math.max(-rn,Math.min(rn,e)));if(u&&f.push([t,e]),y)h=t,p=e,d=r,y=!1,r&&(l.lineStart(),l.point(t,e));else if(r&&v)l.point(t,e);else{var n={a:{x:g,y:m},b:{x:t,y:e}};w(n)?(v||(l.lineStart(),l.point(n.a.x,n.a.y)),l.point(n.b.x,n.b.y),r||l.lineEnd(),x=!1):r&&(l.lineStart(),l.point(t,e),x=!1)}g=t,m=e,v=r}return k};function a(t,i){return y(t[0]-e)0?0:3:y(t[0]-n)0?2:1:y(t[1]-r)0?1:0:i>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var r=a(t,1),n=a(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]}}function an(t){var e=0,r=At/3,n=Sn(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*At/180,r=t[1]*At/180):[e/At*180,r/At*180]},i}function on(t,e){var r=Math.sin(t),n=(r+Math.sin(e))/2,i=1+r*(2*n-r),a=Math.sqrt(i)/n;function o(t,e){var r=Math.sqrt(i-2*n*Math.sin(e))/n;return[r*Math.sin(t*=n),a-r*Math.cos(t)]}return o.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/n,Ot((i-(t*t+r*r)*n*n)/(2*n))]},o}t.geo.clipExtent=function(){var t,e,r,n,i,a,o={stream:function(t){return i&&(i.valid=!1),(i=a(t)).valid=!0,i},extent:function(s){return arguments.length?(a=nn(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),o):[[t,e],[r,n]]}};return o.extent([[0,0],[960,500]])},(t.geo.conicEqualArea=function(){return an(on)}).raw=on,t.geo.albers=function(){return t.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},t.geo.albersUsa=function(){var e,r,n,i,a=t.geo.albers(),o=t.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=t.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,r){e=[t,r]}};function c(t){var a=t[0],o=t[1];return e=null,r(a,o),e||(n(a,o),e)||i(a,o),e}return c.invert=function(t){var e=a.scale(),r=a.translate(),n=(t[0]-r[0])/e,i=(t[1]-r[1])/e;return(i>=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},c.stream=function(t){var e=a.stream(t),r=o.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()}}},c.precision=function(t){return arguments.length?(a.precision(t),o.precision(t),s.precision(t),c):a.precision()},c.scale=function(t){return arguments.length?(a.scale(t),o.scale(.35*t),s.scale(t),c.translate(a.translate())):a.scale()},c.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),u=+t[0],f=+t[1];return r=a.translate(t).clipExtent([[u-.455*e,f-.238*e],[u+.455*e,f+.238*e]]).stream(l).point,n=o.translate([u-.307*e,f+.201*e]).clipExtent([[u-.425*e+kt,f+.12*e+kt],[u-.214*e-kt,f+.234*e-kt]]).stream(l).point,i=s.translate([u-.205*e,f+.212*e]).clipExtent([[u-.214*e+kt,f+.166*e+kt],[u-.115*e-kt,f+.234*e-kt]]).stream(l).point,c},c.scale(1070)};var sn,ln,cn,un,fn,hn,pn={point:I,lineStart:I,lineEnd:I,polygonStart:function(){ln=0,pn.lineStart=dn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=I,sn+=y(ln/2)}};function dn(){var t,e,r,n;function i(t,e){ln+=n*t-r*e,r=t,n=e}pn.point=function(a,o){pn.point=i,t=r=a,e=n=o},pn.lineEnd=function(){i(t,e)}}var gn={point:function(t,e){tfn&&(fn=t);ehn&&(hn=e)},lineStart:I,lineEnd:I,polygonStart:I,polygonEnd:I};function mn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var vn,yn={point:xn,lineStart:bn,lineEnd:_n,polygonStart:function(){yn.lineStart=wn},polygonEnd:function(){yn.point=xn,yn.lineStart=bn,yn.lineEnd=_n}};function xn(t,e){xr+=t,br+=e,++_r}function bn(){var t,e;function r(r,n){var i=r-t,a=n-e,o=Math.sqrt(i*i+a*a);wr+=o*(t+r)/2,kr+=o*(e+n)/2,Mr+=o,xn(t=r,e=n)}yn.point=function(n,i){yn.point=r,xn(t=n,e=i)}}function _n(){yn.point=xn}function wn(){var t,e,r,n;function i(t,e){var i=t-r,a=e-n,o=Math.sqrt(i*i+a*a);wr+=o*(r+t)/2,kr+=o*(n+e)/2,Mr+=o,Ar+=(o=n*t-r*e)*(r+t),Tr+=o*(n+e),Sr+=3*o,xn(r=t,n=e)}yn.point=function(a,o){yn.point=i,xn(t=r=a,e=n=o)},yn.lineEnd=function(){i(t,e)}}function kn(t){var e=.5,r=Math.cos(30*Et),n=16;function i(e){return(n?function(e){var r,i,o,s,l,c,u,f,h,p,d,g,m={point:v,lineStart:y,lineEnd:b,polygonStart:function(){e.polygonStart(),m.lineStart=_},polygonEnd:function(){e.polygonEnd(),m.lineStart=y}};function v(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){f=NaN,m.point=x,e.lineStart()}function x(r,i){var o=zr([r,i]),s=t(r,i);a(f,h,u,p,d,g,f=s[0],h=s[1],u=r,p=o[0],d=o[1],g=o[2],n,e),e.point(f,h)}function b(){m.point=v,e.lineEnd()}function _(){y(),m.point=w,m.lineEnd=k}function w(t,e){x(r=t,e),i=f,o=h,s=p,l=d,c=g,m.point=x}function k(){a(f,h,u,p,d,g,i,o,r,s,l,c,n,e),m.lineEnd=b,b()}return m}:function(e){return An(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})})(e)}function a(n,i,o,s,l,c,u,f,h,p,d,g,m,v){var x=u-n,b=f-i,_=x*x+b*b;if(_>4*e&&m--){var w=s+p,k=l+d,M=c+g,A=Math.sqrt(w*w+k*k+M*M),T=Math.asin(M/=A),S=y(y(M)-1)e||y((x*z+b*P)/_-.5)>.3||s*p+l*d+c*g0&&16,i):Math.sqrt(e)},i}function Mn(t){this.stream=t}function An(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 Tn(t){return Sn(function(){return t})()}function Sn(e){var r,n,i,a,o,s,l=kn(function(t,e){return[(t=r(t,e))[0]*c+a,o-t[1]*c]}),c=150,u=480,f=250,h=0,p=0,d=0,g=0,m=0,v=tn,x=z,b=null,_=null;function w(t){return[(t=i(t[0]*Et,t[1]*Et))[0]*c+a,o-t[1]*c]}function k(t){return(t=i.invert((t[0]-a)/c,(o-t[1])/c))&&[t[0]*Lt,t[1]*Lt]}function M(){i=Gr(n=zn(d,g,m),r);var t=r(h,p);return a=u-t[0]*c,o=f+t[1]*c,A()}function A(){return s&&(s.valid=!1,s=null),w}return w.stream=function(t){return s&&(s.valid=!1),(s=Cn(v(n,l(x(t))))).valid=!0,s},w.clipAngle=function(t){return arguments.length?(v=null==t?(b=t,tn):function(t){var e=Math.cos(t),r=e>0,n=y(e)>kt;return Jr(i,function(t){var e,s,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(f,h){var p,d=[f,h],g=i(f,h),m=r?g?0:o(f,h):g?o(f+(f<0?At:-At),h):0;if(!e&&(c=l=g)&&t.lineStart(),g!==l&&(p=a(e,d),(Fr(e,p)||Fr(d,p))&&(d[0]+=kt,d[1]+=kt,g=i(d[0],d[1]))),g!==l)u=0,g?(t.lineStart(),p=a(d,e),t.point(p[0],p[1])):(p=a(e,d),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(n&&e&&r^g){var v;m&s||!(v=a(d,e,!0))||(u=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!g||e&&Fr(e,d)||t.point(d[0],d[1]),e=d,l=g,s=m},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}},In(t,6*Et),r?[0,-t]:[-At,t-At]);function i(t,r){return Math.cos(t)*Math.cos(r)>e}function a(t,r,n){var i=[1,0,0],a=Dr(zr(t),zr(r)),o=Pr(a,a),s=a[0],l=o-s*s;if(!l)return!n&&t;var c=e*o/l,u=-e*s/l,f=Dr(i,a),h=Ir(i,c);Or(h,Ir(a,u));var p=f,d=Pr(h,p),g=Pr(p,p),m=d*d-g*(Pr(h,h)-1);if(!(m<0)){var v=Math.sqrt(m),x=Ir(p,(-d-v)/g);if(Or(x,h),x=Br(x),!n)return x;var b,_=t[0],w=r[0],k=t[1],M=r[1];w<_&&(b=_,_=w,w=b);var A=w-_,T=y(A-At)0^x[1]<(y(x[0]-_)At^(_<=x[0]&&x[0]<=w)){var S=Ir(p,(-d+v)/g);return Or(S,h),[x,Br(S)]}}}function o(e,n){var i=r?t:At-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}}((b=+t)*Et),A()):b},w.clipExtent=function(t){return arguments.length?(_=t,x=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):z,A()):_},w.scale=function(t){return arguments.length?(c=+t,M()):c},w.translate=function(t){return arguments.length?(u=+t[0],f=+t[1],M()):[u,f]},w.center=function(t){return arguments.length?(h=t[0]%360*Et,p=t[1]%360*Et,M()):[h*Lt,p*Lt]},w.rotate=function(t){return arguments.length?(d=t[0]%360*Et,g=t[1]%360*Et,m=t.length>2?t[2]%360*Et:0,M()):[d*Lt,g*Lt,m*Lt]},t.rebind(w,l,"precision"),function(){return r=e.apply(this,arguments),w.invert=r.invert&&k,M()}}function Cn(t){return An(t,function(e,r){t.point(e*Et,r*Et)})}function En(t,e){return[t,e]}function Ln(t,e){return[t>At?t-Tt:t<-At?t+Tt:t,e]}function zn(t,e,r){return t?e||r?Gr(Dn(t),On(e,r)):Dn(t):e||r?On(e,r):Ln}function Pn(t){return function(e,r){return[(e+=t)>At?e-Tt:e<-At?e+Tt:e,r]}}function Dn(t){var e=Pn(t);return e.invert=Pn(-t),e}function On(t,e){var r=Math.cos(t),n=Math.sin(t),i=Math.cos(e),a=Math.sin(e);function o(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,c=Math.sin(e),u=c*r+s*n;return[Math.atan2(l*i-u*a,s*r-c*n),Ot(u*i+l*a)]}return o.invert=function(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,c=Math.sin(e),u=c*i-l*a;return[Math.atan2(l*i+c*a,s*r+u*n),Ot(u*r-s*n)]},o}function In(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=Rn(r,i),a=Rn(r,a),(o>0?ia)&&(i+=o*Tt)):(i=t+o*Tt,a=t-.5*l);for(var c,u=i;o>0?u>a:u2?t[2]*Et:0),e.invert=function(e){return(e=t.invert(e[0]*Et,e[1]*Et))[0]*=Lt,e[1]*=Lt,e},e},Ln.invert=En,t.geo.circle=function(){var t,e,r=[0,0],n=6;function i(){var t="function"==typeof r?r.apply(this,arguments):r,n=zn(-t[0]*Et,-t[1]*Et,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=Lt,t[1]*=Lt}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(r=t,i):r},i.angle=function(r){return arguments.length?(e=In((t=+r)*Et,n*Et),i):t},i.precision=function(r){return arguments.length?(e=In(t*Et,(n=+r)*Et),i):n},i.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Et,i=t[1]*Et,a=e[1]*Et,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),c=Math.cos(i),u=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-l*f*s)*r),l*u+c*f*s)},t.geo.graticule=function(){var e,r,n,i,a,o,s,l,c,u,f,h,p=10,d=p,g=90,m=360,v=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return t.range(Math.ceil(i/g)*g,n,g).map(f).concat(t.range(Math.ceil(l/m)*m,s,m).map(h)).concat(t.range(Math.ceil(r/p)*p,e,p).filter(function(t){return y(t%g)>kt}).map(c)).concat(t.range(Math.ceil(o/d)*d,a,d).filter(function(t){return y(t%m)>kt}).map(u))}return x.lines=function(){return b().map(function(t){return{type:"LineString",coordinates:t}})},x.outline=function(){return{type:"Polygon",coordinates:[f(i).concat(h(s).slice(1),f(n).reverse().slice(1),h(l).reverse().slice(1))]}},x.extent=function(t){return arguments.length?x.majorExtent(t).minorExtent(t):x.minorExtent()},x.majorExtent=function(t){return arguments.length?(i=+t[0][0],n=+t[1][0],l=+t[0][1],s=+t[1][1],i>n&&(t=i,i=n,n=t),l>s&&(t=l,l=s,s=t),x.precision(v)):[[i,l],[n,s]]},x.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),o>a&&(t=o,o=a,a=t),x.precision(v)):[[r,o],[e,a]]},x.step=function(t){return arguments.length?x.majorStep(t).minorStep(t):x.minorStep()},x.majorStep=function(t){return arguments.length?(g=+t[0],m=+t[1],x):[g,m]},x.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],x):[p,d]},x.precision=function(t){return arguments.length?(v=+t,c=Bn(o,a,90),u=Fn(r,e,v),f=Bn(l,s,90),h=Fn(i,n,v),x):v},x.majorExtent([[-180,-90+kt],[180,90-kt]]).minorExtent([[-180,-80-kt],[180,80+kt]])},t.geo.greatArc=function(){var e,r,n=Nn,i=jn;function a(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}return a.distance=function(){return t.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},a.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,a):n},a.target=function(t){return arguments.length?(i=t,r="function"==typeof t?null:t,a):i},a.precision=function(){return arguments.length?a:0},a},t.geo.interpolate=function(t,e){return r=t[0]*Et,n=t[1]*Et,i=e[0]*Et,a=e[1]*Et,o=Math.cos(n),s=Math.sin(n),l=Math.cos(a),c=Math.sin(a),u=o*Math.cos(r),f=o*Math.sin(r),h=l*Math.cos(i),p=l*Math.sin(i),d=2*Math.asin(Math.sqrt(Rt(a-n)+o*l*Rt(i-r))),g=1/Math.sin(d),(m=d?function(t){var e=Math.sin(t*=d)*g,r=Math.sin(d-t)*g,n=r*u+e*h,i=r*f+e*p,a=r*s+e*c;return[Math.atan2(i,n)*Lt,Math.atan2(a,Math.sqrt(n*n+i*i))*Lt]}:function(){return[r*Lt,n*Lt]}).distance=d,m;var r,n,i,a,o,s,l,c,u,f,h,p,d,g,m},t.geo.length=function(e){return vn=0,t.geo.stream(e,Vn),vn};var Vn={sphere:I,point:I,lineStart:function(){var t,e,r;function n(n,i){var a=Math.sin(i*=Et),o=Math.cos(i),s=y((n*=Et)-t),l=Math.cos(s);vn+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=r*a-e*o*l)*s),e*a+r*o*l),t=n,e=a,r=o}Vn.point=function(i,a){t=i*Et,e=Math.sin(a*=Et),r=Math.cos(a),Vn.point=n},Vn.lineEnd=function(){Vn.point=Vn.lineEnd=I}},lineEnd:I,polygonStart:I,polygonEnd:I};function Un(t,e){function r(e,r){var n=Math.cos(e),i=Math.cos(r),a=t(n*i);return[a*i*Math.sin(e),a*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),i=e(n),a=Math.sin(i),o=Math.cos(i);return[Math.atan2(t*a,n*o),Math.asin(n&&r*a/n)]},r}var qn=Un(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(t.geo.azimuthalEqualArea=function(){return Tn(qn)}).raw=qn;var Hn=Un(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},z);function Gn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(At/4+t/2)},i=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(n(e)/n(t)),a=r*Math.pow(n(t),i)/i;if(!i)return Xn;function o(t,e){a>0?e<-Ct+kt&&(e=-Ct+kt):e>Ct-kt&&(e=Ct-kt);var r=a/Math.pow(n(e),i);return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}return o.invert=function(t,e){var r=a-e,n=zt(i)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/i,2*Math.atan(Math.pow(a/n,1/i))-Ct]},o}function Wn(t,e){var r=Math.cos(t),n=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),i=r/n+t;if(y(n)1&&Pt(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function ri(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Tn(Kn)}).raw=Kn,Qn.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ct]},(t.geo.transverseMercator=function(){var t=Zn(Qn),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):[(t=r())[0],t[1],t[2]-90]},r([0,0,90])}).raw=Qn,t.geom={},t.geom.hull=function(t){var e=$n,r=ti;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,i=me(e),a=me(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)p.push(t[s[c[n]][2]]);for(n=+f;nkt)s=s.L;else{if(!((i=a-xi(s,o))>kt)){n>-kt?(e=s.P,r=s):i>-kt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=di(t);if(ci.insert(e,l),e||r){if(e===r)return ki(e),r=di(e.site),ci.insert(l,r),l.edge=r.edge=Ti(e.site,l.site),wi(e),void wi(r);if(r){ki(e),ki(r);var c=e.site,u=c.x,f=c.y,h=t.x-u,p=t.y-f,d=r.site,g=d.x-u,m=d.y-f,v=2*(h*m-p*g),y=h*h+p*p,x=g*g+m*m,b={x:(m*y-p*x)/v+u,y:(h*x-g*y)/v+f};Si(r.edge,c,d,b),l.edge=Ti(c,t,null,b),r.edge=Ti(t,d,null,b),wi(e),wi(r)}else l.edge=Ti(e.site,l.site)}}function yi(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-1/0;var s=(r=o.site).x,l=r.y,c=l-e;if(!c)return s;var u=s-n,f=1/a-1/c,h=u/c;return f?(-h+Math.sqrt(h*h-2*f*(u*u/(-2*c)-l+c/2+i-a/2)))/f+n:(n+s)/2}function xi(t,e){var r=t.N;if(r)return yi(r,e);var n=t.site;return n.y===e?n.x:1/0}function bi(t){this.site=t,this.edges=[]}function _i(t,e){return e.angle-t.angle}function wi(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,a=r.site;if(n!==a){var o=i.x,s=i.y,l=n.x-o,c=n.y-s,u=a.x-o,f=2*(l*(m=a.y-s)-c*u);if(!(f>=-Mt)){var h=l*l+c*c,p=u*u+m*m,d=(m*h-c*p)/f,g=(l*p-u*h)/f,m=g+s,v=pi.pop()||new function(){Li(this),this.x=this.y=this.arc=this.site=this.cy=null};v.arc=t,v.site=i,v.x=d+o,v.y=m+Math.sqrt(d*d+g*g),v.cy=m,t.circle=v;for(var y=null,x=fi._;x;)if(v.y=s)return;if(h>d){if(a){if(a.y>=c)return}else a={x:m,y:l};r={x:m,y:c}}else{if(a){if(a.y1)if(h>d){if(a){if(a.y>=c)return}else a={x:(l-i)/n,y:l};r={x:(c-i)/n,y:c}}else{if(a){if(a.y=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.xkt||y(i-r)>kt)&&(s.splice(o,0,new Ci((v=a.site,x=u,b=y(n-f)kt?{x:f,y:y(e-f)kt?{x:y(r-d)kt?{x:h,y:y(e-h)kt?{x:y(r-p)=r&&c.x<=i&&c.y>=n&&c.y<=o?[[r,o],[i,o],[i,n],[r,n]]:[]).point=t[s]}),e}function s(t){return t.map(function(t,e){return{x:Math.round(n(t,e)/kt)*kt,y:Math.round(i(t,e)/kt)*kt,i:e}})}return o.links=function(t){return Oi(s(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},o.triangles=function(t){var e=[];return Oi(s(t)).cells.forEach(function(r,n){for(var i,a,o,s,l=r.site,c=r.edges.sort(_i),u=-1,f=c.length,h=c[f-1].edge,p=h.l===l?h.r:h.l;++ua&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:Vi(r,n)})),a=Hi.lastIndex;return ag&&(g=l.x),l.y>m&&(m=l.y),c.push(l.x),u.push(l.y);else for(f=0;fg&&(g=b),_>m&&(m=_),c.push(b),u.push(_)}var w=g-p,k=m-d;function M(t,e,r,n,i,a,o,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,c=t.y;if(null!=l)if(y(l-r)+y(c-n)<.01)A(t,e,r,n,i,a,o,s);else{var u=t.point;t.x=t.y=t.point=null,A(t,u,l,c,i,a,o,s),A(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else A(t,e,r,n,i,a,o,s)}function A(t,e,r,n,i,a,o,s){var l=.5*(i+o),c=.5*(a+s),u=r>=l,f=n>=c,h=f<<1|u;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){M(T,t,+v(t,++f),+x(t,f),p,d,g,m)}}),u?i=l:o=l,f?a=c:s=c,M(t,e,r,n,i,a,o,s)}w>k?m=d+w:g=p+k;var T={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){M(T,t,+v(t,++f),+x(t,f),p,d,g,m)}};if(T.visit=function(t){!function t(e,r,n,i,a,o){if(!e(r,n,i,a,o)){var s=.5*(n+a),l=.5*(i+o),c=r.nodes;c[0]&&t(e,c[0],n,i,s,l),c[1]&&t(e,c[1],s,i,a,l),c[2]&&t(e,c[2],n,l,s,o),c[3]&&t(e,c[3],s,l,a,o)}}(t,T,p,d,g,m)},T.find=function(t){return function(t,e,r,n,i,a,o){var s,l=1/0;return function t(c,u,f,h,p){if(!(u>a||f>o||h=_)<<1|e>=b,k=w+4;w=0&&!(n=t.interpolators[i](e,r)););return n}function Wi(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ea(t){return 1-Math.cos(t*Ct)}function ra(t){return Math.pow(2,10*(t-1))}function na(t){return 1-Math.sqrt(1-t*t)}function ia(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function aa(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function oa(t){var e,r,n,i=[t.a,t.b],a=[t.c,t.d],o=la(i),s=sa(i,a),l=la(((e=a)[0]+=(n=-s)*(r=i)[0],e[1]+=n*r[1],e))||0;i[0]*a[1]=0?t.slice(0,n):t,a=n>=0?t.slice(n+1):"in";return i=Xi.get(i)||Yi,a=Zi.get(a)||z,e=a(i.apply(null,r.call(arguments,1))),function(t){return t<=0?0:t>=1?1:e(t)}},t.interpolateHcl=function(e,r){e=t.hcl(e),r=t.hcl(r);var n=e.h,i=e.c,a=e.l,o=r.h-n,s=r.c-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.c:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Yt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateHsl=function(e,r){e=t.hsl(e),r=t.hsl(r);var n=e.h,i=e.s,a=e.l,o=r.h-n,s=r.s-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.s:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Ht(n+o*t,i+s*t,a+l*t)+""}},t.interpolateLab=function(e,r){e=t.lab(e),r=t.lab(r);var n=e.l,i=e.a,a=e.b,o=r.l-n,s=r.a-i,l=r.b-a;return function(t){return te(n+o*t,i+s*t,a+l*t)+""}},t.interpolateRound=aa,t.transform=function(e){var r=i.createElementNS(t.ns.prefix.svg,"g");return(t.transform=function(t){if(null!=t){r.setAttribute("transform",t);var e=r.transform.baseVal.consolidate()}return new oa(e?e.matrix:ca)})(e)},oa.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ca={a:1,b:0,c:0,d:1,e:0,f:0};function ua(t){return t.length?t.pop()+",":""}function fa(e,r){var n=[],i=[];return e=t.transform(e),r=t.transform(r),function(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:Vi(t[0],e[0])},{i:i-2,x:Vi(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(e.translate,r.translate,n,i),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(ua(r)+"rotate(",null,")")-2,x:Vi(t,e)})):e&&r.push(ua(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,i),function(t,e,r,n){t!==e?n.push({i:r.push(ua(r)+"skewX(",null,")")-2,x:Vi(t,e)}):e&&r.push(ua(r)+"skewX("+e+")")}(e.skew,r.skew,n,i),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(ua(r)+"scale(",null,",",null,")");n.push({i:i-4,x:Vi(t[0],e[0])},{i:i-2,x:Vi(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(ua(r)+"scale("+e+")")}(e.scale,r.scale,n,i),e=r=null,function(t){for(var e,r=-1,a=i.length;++r0?n=t:(e.c=null,e.t=NaN,e=null,l.end({type:"end",alpha:n=0})):t>0&&(l.start({type:"start",alpha:n=t}),e=Me(s.tick)),s):n},s.start=function(){var t,e,r,n=v.length,l=y.length,u=c[0],d=c[1];for(t=0;t=0;)r.push(i[n])}function Aa(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++o=0;)o.push(u=c[l]),u.parent=a,u.depth=a.depth+1;r&&(a.value=0),a.children=c}else r&&(a.value=+r.call(n,a,a.depth)||0),delete a.children;return Aa(i,function(e){var n,i;t&&(n=e.children)&&n.sort(t),r&&(i=e.parent)&&(i.value+=e.value)}),s}return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Ma(t,function(t){t.children&&(t.value=0)}),Aa(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},t.layout.partition=function(){var e=t.layout.hierarchy(),r=[1,1];function n(t,n){var i=e.call(this,t,n);return function t(e,r,n,i){var a=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,a&&(o=a.length)){var o,s,l,c=-1;for(n=e.value?n/e.value:0;++cs&&(s=n),o.push(n)}for(r=0;ri&&(n=r,i=e);return n}function Na(t){return t.reduce(ja,0)}function ja(t,e){return t+e[1]}function Va(t,e){return Ua(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ua(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function qa(e){return[t.min(e),t.max(e)]}function Ha(t,e){return t.value-e.value}function Ga(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Wa(t,e){t._pack_next=e,e._pack_prev=t}function Ya(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 Xa(t){if((e=t.children)&&(l=e.length)){var e,r,n,i,a,o,s,l,c=1/0,u=-1/0,f=1/0,h=-1/0;if(e.forEach(Za),(r=e[0]).x=-r.r,r.y=0,x(r),l>1&&((n=e[1]).x=n.r,n.y=0,x(n),l>2))for(Ka(r,n,i=e[2]),x(i),Ga(r,i),r._pack_prev=i,Ga(i,n),n=r._pack_next,a=3;a0)for(o=-1;++o=f[0]&&l<=f[1]&&((s=c[t.bisect(h,l,1,d)-1]).y+=g,s.push(a[o]));return c}return a.value=function(t){return arguments.length?(r=t,a):r},a.range=function(t){return arguments.length?(n=me(t),a):n},a.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return Ua(e,t)}:me(t),a):i},a.frequency=function(t){return arguments.length?(e=!!t,a):e},a},t.layout.pack=function(){var e,r=t.layout.hierarchy().sort(Ha),n=0,i=[1,1];function a(t,a){var o=r.call(this,t,a),s=o[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,Aa(s,function(t){t.r=+u(t.value)}),Aa(s,Xa),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/c))/2;Aa(s,function(t){t.r+=f}),Aa(s,Xa),Aa(s,function(t){t.r-=f})}return function t(e,r,n,i){var a=e.children;e.x=r+=i*e.x;e.y=n+=i*e.y;e.r*=i;if(a)for(var o=-1,s=a.length;++op.x&&(p=t),t.depth>d.depth&&(d=t)});var g=r(h,p)/2-h.x,m=n[0]/(p.x+r(p,h)/2+g),v=n[1]/(d.depth||1);Ma(u,function(t){t.x=(t.x+g)*m,t.y=t.depth*v})}return c}function o(t){var e=t.children,n=t.parent.children,i=t.i?n[t.i-1]:null;if(e.length){!function(t){var e,r=0,n=0,i=t.children,a=i.length;for(;--a>=0;)(e=i[a]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var a=(e[0].z+e[e.length-1].z)/2;i?(t.z=i.z+r(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+r(t._,i._));t.parent.A=function(t,e,n){if(e){for(var i,a=t,o=t,s=e,l=a.parent.children[0],c=a.m,u=o.m,f=s.m,h=l.m;s=to(s),a=$a(a),s&&a;)l=$a(l),(o=to(o)).a=t,(i=s.z+f-a.z-c+r(s._,a._))>0&&(eo(ro(s,t,n),t,i),c+=i,u+=i),f+=s.m,c+=a.m,h+=l.m,u+=o.m;s&&!to(o)&&(o.t=s,o.m+=f-u),a&&!$a(l)&&(l.t=a,l.m+=c-h,n=t)}return n}(t,i,t.parent.A||n[0])}function s(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function l(t){t.x*=n[0],t.y=t.depth*n[1]}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t)?l:null,a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null==(n=t)?null:l,a):i?n:null},ka(a,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=Qa,n=[1,1],i=!1;function a(a,o){var s,l=e.call(this,a,o),c=l[0],u=0;Aa(c,function(e){var n=e.children;n&&n.length?(e.x=function(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}(n),e.y=function(e){return 1+t.max(e,function(t){return t.y})}(n)):(e.x=s?u+=r(e,s):0,e.y=0,s=e)});var f=function t(e){var r=e.children;return r&&r.length?t(r[0]):e}(c),h=function t(e){var r,n=e.children;return n&&(r=n.length)?t(n[r-1]):e}(c),p=f.x-r(f,h)/2,d=h.x+r(h,f)/2;return Aa(c,i?function(t){t.x=(t.x-c.x)*n[0],t.y=(c.y-t.y)*n[1]}:function(t){t.x=(t.x-p)/(d-p)*n[0],t.y=(1-(c.y?t.y/c.y:1))*n[1]}),l}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t),a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null!=(n=t),a):i?n:null},ka(a,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,i=[1,1],a=null,o=no,s=!1,l="squarify",c=.5*(1+Math.sqrt(5));function u(t,e){for(var r,n,i=-1,a=t.length;++i0;)s.push(r=c[i-1]),s.area+=r.area,"squarify"!==l||(n=p(s,g))<=h?(c.pop(),h=n):(s.area-=s.pop().area,d(s,g,a,!1),g=Math.min(a.dx,a.dy),s.length=s.area=0,h=1/0);s.length&&(d(s,g,a,!0),s.length=s.area=0),e.forEach(f)}}function h(t){var e=t.children;if(e&&e.length){var r,n=o(t),i=e.slice(),a=[];for(u(i,n.dx*n.dy/t.value),a.area=0;r=i.pop();)a.push(r),a.area+=r.area,null!=r.z&&(d(a,r.z?n.dx:n.dy,n,!i.length),a.length=a.area=0);e.forEach(h)}}function p(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return e*=e,(n*=n)?Math.max(e*i*c/n,n/(e*a*c)):1/0}function d(t,e,r,i){var a,o=-1,s=t.length,l=r.x,c=r.y,u=e?n(t.area/e):0;if(e==r.dx){for((i||u>r.dy)&&(u=r.dy);++or.dx)&&(u=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var e=t.random.normal.apply(t,arguments);return function(){return Math.exp(e())}},bates:function(e){var r=t.random.irwinHall(e);return function(){return r()/e}},irwinHall:function(t){return function(){for(var e=0,r=0;r2?fo:so,s=i?pa:ha;return a=t(e,r,s,n),o=t(r,e,s,Gi),l}function l(t){return a(t)}l.invert=function(t){return o(t)};l.domain=function(t){return arguments.length?(e=t.map(Number),s()):e};l.range=function(t){return arguments.length?(r=t,s()):r};l.rangeRound=function(t){return l.range(t).interpolate(aa)};l.clamp=function(t){return arguments.length?(i=t,s()):i};l.interpolate=function(t){return arguments.length?(n=t,s()):n};l.ticks=function(t){return mo(e,t)};l.tickFormat=function(t,r){return vo(e,t,r)};l.nice=function(t){return po(e,t),s()};l.copy=function(){return t(e,r,n,i)};return s()}([0,1],[0,1],Gi,!1)};var yo={s:1,g:1,p:1,r:1,e:1};function xo(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}t.scale.log=function(){return function e(r,n,i,a){function o(t){return(i?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function s(t){return i?Math.pow(n,t):-Math.pow(n,-t)}function l(t){return r(o(t))}l.invert=function(t){return s(r.invert(t))};l.domain=function(t){return arguments.length?(i=t[0]>=0,r.domain((a=t.map(Number)).map(o)),l):a};l.base=function(t){return arguments.length?(n=+t,r.domain(a.map(o)),l):n};l.nice=function(){var t=lo(a.map(o),i?Math:_o);return r.domain(t),a=t.map(s),l};l.ticks=function(){var t=ao(a),e=[],r=t[0],l=t[1],c=Math.floor(o(r)),u=Math.ceil(o(l)),f=n%1?2:n;if(isFinite(u-c)){if(i){for(;c0;h--)e.push(s(c)*h);for(c=0;e[c]l;u--);e=e.slice(c,u)}return e};l.tickFormat=function(e,r){if(!arguments.length)return bo;arguments.length<2?r=bo:"function"!=typeof r&&(r=t.format(r));var i=Math.max(1,n*e/l.ticks().length);return function(t){var e=t/s(Math.round(o(t)));return e*n0?i[t-1]:r[0],tf?0:1;if(c=St)return l(c,p)+(s?l(s,1-p):"")+"Z";var d,g,m,v,y,x,b,_,w,k,M,A,T=0,S=0,C=[];if((v=(+o.apply(this,arguments)||0)/2)&&(m=n===Co?Math.sqrt(s*s+c*c):+n.apply(this,arguments),p||(S*=-1),c&&(S=Ot(m/c*Math.sin(v))),s&&(T=Ot(m/s*Math.sin(v)))),c){y=c*Math.cos(u+S),x=c*Math.sin(u+S),b=c*Math.cos(f-S),_=c*Math.sin(f-S);var E=Math.abs(f-u-2*S)<=At?0:1;if(S&&Oo(y,x,b,_)===p^E){var L=(u+f)/2;y=c*Math.cos(L),x=c*Math.sin(L),b=_=null}}else y=x=0;if(s){w=s*Math.cos(f-T),k=s*Math.sin(f-T),M=s*Math.cos(u+T),A=s*Math.sin(u+T);var z=Math.abs(u-f+2*T)<=At?0:1;if(T&&Oo(w,k,M,A)===1-p^z){var P=(u+f)/2;w=s*Math.cos(P),k=s*Math.sin(P),M=A=null}}else w=k=0;if(h>kt&&(d=Math.min(Math.abs(c-s)/2,+r.apply(this,arguments)))>.001){g=s0?0:1}function Io(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,c=-s*a,u=t[0]+l,f=t[1]+c,h=e[0]+l,p=e[1]+c,d=(u+h)/2,g=(f+p)/2,m=h-u,v=p-f,y=m*m+v*v,x=r-n,b=u*p-h*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*v-m*_)/y,k=(-b*m-v*_)/y,M=(b*v+m*_)/y,A=(-b*m+v*_)/y,T=w-d,S=k-g,C=M-d,E=A-g;return T*T+S*S>C*C+E*E&&(w=M,k=A),[[w-l,k-c],[w*r/x,k*r/x]]}function Ro(t){var e=$n,r=ti,n=Wr,i=Fo,a=i.key,o=.7;function s(a){var s,l=[],c=[],u=-1,f=a.length,h=me(e),p=me(r);function d(){l.push("M",i(t(c),o))}for(;++u1&&i.push("H",n[0]);return i.join("")},"step-before":jo,"step-after":Vo,basis:Ho,"basis-open":function(t){if(t.length<4)return Fo(t);var e,r=[],n=-1,i=t.length,a=[0],o=[0];for(;++n<3;)e=t[n],a.push(e[0]),o.push(e[1]);r.push(Go(Xo,a)+","+Go(Xo,o)),--n;for(;++n9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));s=-1;for(;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}(t))}});function Fo(t){return t.length>1?t.join("L"):t+"Z"}function No(t){return t.join("L")+"Z"}function jo(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var c=2;cAt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return a.radius=function(t){return arguments.length?(r=me(t),a):r},a.source=function(e){return arguments.length?(t=me(e),a):t},a.target=function(t){return arguments.length?(e=me(t),a):e},a.startAngle=function(t){return arguments.length?(n=me(t),a):n},a.endAngle=function(t){return arguments.length?(i=me(t),a):i},a},t.svg.diagonal=function(){var t=Nn,e=jn,r=ts;function n(n,i){var a=t.call(this,n,i),o=e.call(this,n,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return"M"+(l=l.map(r))[0]+"C"+l[1]+" "+l[2]+" "+l[3]}return n.source=function(e){return arguments.length?(t=me(e),n):t},n.target=function(t){return arguments.length?(e=me(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},t.svg.diagonal.radial=function(){var e=t.svg.diagonal(),r=ts,n=e.projection;return e.projection=function(t){return arguments.length?n(function(t){return function(){var e=t.apply(this,arguments),r=e[0],n=e[1]-Ct;return[r*Math.cos(n),r*Math.sin(n)]}}(r=t)):r},e},t.svg.symbol=function(){var t=rs,e=es;function r(r,n){return(is.get(t.call(this,r,n))||ns)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=me(e),r):t},r.size=function(t){return arguments.length?(e=me(t),r):e},r};var is=t.map({circle:ns,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*os)),r=e*os;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/as),r=e*as/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/as),r=e*as/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});t.svg.symbolTypes=is.keys();var as=Math.sqrt(3),os=Math.tan(30*Et);Y.transition=function(t){for(var e,r,n=us||++ps,i=ms(t),a=[],o=fs||{time:Date.now(),ease:ta,delay:0,duration:250},s=-1,l=this.length;++s0;)c[--h].call(t,o);if(a>=1)return f.event&&f.event.end.call(t,t.__data__,e),--u.count?delete u[n]:delete t[r],1}f||(a=i.time,o=Me(function(t){var e=f.delay;if(o.t=e+a,e<=t)return h(t-e);o.c=h},0,a),f=u[n]={tween:new b,time:a,timer:o,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++u.count)}hs.call=Y.call,hs.empty=Y.empty,hs.node=Y.node,hs.size=Y.size,t.transition=function(e,r){return e&&e.transition?us?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=hs,hs.select=function(t){var e,r,n,i=this.id,a=this.namespace,o=[];t=X(t);for(var s=-1,l=this.length;++srect,.s>rect").attr("width",s[1]-s[0])}function g(t){t.select(".extent").attr("y",l[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",l[1]-l[0])}function m(){var f,m,v=this,y=t.select(t.event.target),x=n.of(v,arguments),b=t.select(v),_=y.datum(),w=!/^(n|s)$/.test(_)&&i,k=!/^(e|w)$/.test(_)&&a,M=y.classed("extent"),A=xt(v),T=t.mouse(v),S=t.select(o(v)).on("keydown.brush",function(){32==t.event.keyCode&&(M||(f=null,T[0]-=s[1],T[1]-=l[1],M=2),F())}).on("keyup.brush",function(){32==t.event.keyCode&&2==M&&(T[0]+=s[1],T[1]+=l[1],M=0,F())});if(t.event.changedTouches?S.on("touchmove.brush",L).on("touchend.brush",P):S.on("mousemove.brush",L).on("mouseup.brush",P),b.interrupt().selectAll("*").interrupt(),M)T[0]=s[0]-T[0],T[1]=l[0]-T[1];else if(_){var C=+/w$/.test(_),E=+/^n/.test(_);m=[s[1-C]-T[0],l[1-E]-T[1]],T[0]=s[C],T[1]=l[E]}else t.event.altKey&&(f=T.slice());function L(){var e=t.mouse(v),r=!1;m&&(e[0]+=m[0],e[1]+=m[1]),M||(t.event.altKey?(f||(f=[(s[0]+s[1])/2,(l[0]+l[1])/2]),T[0]=s[+(e[0]1?{floor:function(e){for(;s(e=t.floor(e));)e=Es(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Es(+e+1);return e}}:t))},i.ticks=function(t,e){var r=ao(i.domain()),n=null==t?a(r,10):"number"==typeof t?a(r,t):!t.range&&[{range:t},e];return n&&(t=n[0],e=n[1]),t.range(r[0],Es(+r[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Cs(e.copy(),r,n)},ho(i,e)}function Es(t){return new Date(t)}Ms.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Ss:Ts,Ss.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Ss.toString=Ts.toString,De.second=Be(function(t){return new Oe(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),De.seconds=De.second.range,De.seconds.utc=De.second.utc.range,De.minute=Be(function(t){return new Oe(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),De.minutes=De.minute.range,De.minutes.utc=De.minute.utc.range,De.hour=Be(function(t){var e=t.getTimezoneOffset()/60;return new Oe(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),De.hours=De.hour.range,De.hours.utc=De.hour.utc.range,De.month=Be(function(t){return(t=De.day(t)).setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),De.months=De.month.range,De.months.utc=De.month.utc.range;var Ls=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],zs=[[De.second,1],[De.second,5],[De.second,15],[De.second,30],[De.minute,1],[De.minute,5],[De.minute,15],[De.minute,30],[De.hour,1],[De.hour,3],[De.hour,6],[De.hour,12],[De.day,1],[De.day,2],[De.week,1],[De.month,1],[De.month,3],[De.year,1]],Ps=Ms.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",Wr]]),Ds={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Es)},floor:z,ceil:z};zs.year=De.year,De.scale=function(){return Cs(t.scale.linear(),zs,Ps)};var Os=zs.map(function(t){return[t[0].utc,t[1]]}),Is=As.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",Wr]]);function Rs(t){return JSON.parse(t.responseText)}function Bs(t){var e=i.createRange();return e.selectNode(i.body),e.createContextualFragment(t.responseText)}Os.year=De.year.utc,De.scale.utc=function(){return Cs(t.scale.linear(),Os,Is)},t.text=ve(function(t){return t.responseText}),t.json=function(t,e){return ye(t,"application/json",Rs,e)},t.html=function(t,e){return ye(t,"text/html",Bs,e)},t.xml=ve(function(t){return t.responseXML}),"object"==typeof e&&e.exports?e.exports=t:this.d3=t}()},{}],132:[function(t,e,r){e.exports=function(){for(var t=0;t=2)return!1;t[r]=n}return!0}):_.filter(function(t){for(var e=0;e<=s;++e){var r=v[t[e]];if(r<0)return!1;t[e]=r}return!0});if(1&s)for(var u=0;u<_.length;++u){var b=_[u],h=b[0];b[0]=b[1],b[1]=h}return _}},{"incremental-convex-hull":357,uniq:483}],134:[function(t,e,r){(function(t){var r=!1;if("undefined"!=typeof Float64Array){var n=new Float64Array(1),i=new Uint32Array(n.buffer);if(n[0]=1,r=!0,1072693248===i[1]){e.exports=function(t){return n[0]=t,[i[0],i[1]]},e.exports.pack=function(t,e){return i[0]=t,i[1]=e,n[0]},e.exports.lo=function(t){return n[0]=t,i[0]},e.exports.hi=function(t){return n[0]=t,i[1]}}else if(1072693248===i[0]){e.exports=function(t){return n[0]=t,[i[1],i[0]]},e.exports.pack=function(t,e){return i[1]=t,i[0]=e,n[0]},e.exports.lo=function(t){return n[0]=t,i[1]},e.exports.hi=function(t){return n[0]=t,i[0]}}else r=!1}if(!r){var a=new t(8);e.exports=function(t){return a.writeDoubleLE(t,0,!0),[a.readUInt32LE(0,!0),a.readUInt32LE(4,!0)]},e.exports.pack=function(t,e){return a.writeUInt32LE(t,0,!0),a.writeUInt32LE(e,4,!0),a.readDoubleLE(0,!0)},e.exports.lo=function(t){return a.writeDoubleLE(t,0,!0),a.readUInt32LE(0,!0)},e.exports.hi=function(t){return a.writeDoubleLE(t,0,!0),a.readUInt32LE(4,!0)}}e.exports.sign=function(t){return e.exports.hi(t)>>>31},e.exports.exponent=function(t){return(e.exports.hi(t)<<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){return!(2146435072&e.exports.hi(t))}}).call(this,t("buffer").Buffer)},{buffer:86}],135:[function(t,e,r){var n=t("abs-svg-path"),i=t("normalize-svg-path"),a={M:"moveTo",C:"bezierCurveTo"};e.exports=function(t,e){t.beginPath(),i(n(e)).forEach(function(e){var r=e[0],n=e.slice(1);t[a[r]].apply(t,n)}),t.closePath()}},{"abs-svg-path":45,"normalize-svg-path":395}],136:[function(t,e,r){e.exports=function(t){switch(t){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},{}],137:[function(t,e,r){"use strict";e.exports=function(t,e){switch(void 0===e&&(e=0),typeof t){case"number":if(t>0)return function(t,e){var r,n;for(r=new Array(t),n=0;n80*r){n=l=t[0],s=c=t[1];for(var b=r;bl&&(l=u),p>c&&(c=p);g=0!==(g=Math.max(l-n,c-s))?1/g:0}return o(y,x,r,n,s,g),x}function i(t,e,r,n,i){var a,o;if(i===A(t,e,r,n)>0)for(a=e;a=e;a-=n)o=w(a,t[a],t[a+1],o);return o&&y(o,o.next)&&(k(o),o=o.next),o}function a(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!y(n,n.next)&&0!==v(n.prev,n,n.next))n=n.next;else{if(k(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,i,f,h){if(t){!h&&f&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=p(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,l,c=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,c*=2}while(o>1)}(i)}(t,n,i,f);for(var d,g,m=t;t.prev!==t.next;)if(d=t.prev,g=t.next,f?l(t,n,i,f):s(t))e.push(d.i/r),e.push(t.i/r),e.push(g.i/r),k(t),t=g.next,m=g.next;else if((t=g)===m){h?1===h?o(t=c(t,e,r),e,r,n,i,f,2):2===h&&u(t,e,r,n,i,f):o(a(t),e,r,n,i,f,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(v(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(g(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&v(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function l(t,e,r,n){var i=t.prev,a=t,o=t.next;if(v(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,f=p(s,l,e,r,n),h=p(c,u,e,r,n),d=t.prevZ,m=t.nextZ;d&&d.z>=f&&m&&m.z<=h;){if(d!==t.prev&&d!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,m!==t.prev&&m!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&v(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;d&&d.z>=f;){if(d!==t.prev&&d!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=h;){if(m!==t.prev&&m!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&v(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function c(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!y(i,a)&&x(i,n,n.next,a)&&b(i,a)&&b(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),k(n),k(n.next),n=t=a),n=n.next}while(n!==t);return n}function u(t,e,r,n,i,s){var l=t;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&m(l,c)){var u=_(l,c);return l=a(l,l.next),u=a(u,u.next),o(l,e,r,n,i,s),void o(u,e,r,n,i,s)}c=c.next}l=l.next}while(l!==t)}function f(t,e){return t.x-e.x}function h(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=u&&i!==n.x&&g(ar.x)&&b(n,t)&&(r=n,h=l),n=n.next;return r}(t,e)){var r=_(e,t);a(r,r.next)}}function p(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function d(t){var e=t,r=t;do{e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function m(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&x(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&b(t,e)&&b(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)}function v(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function y(t,e){return t.x===e.x&&t.y===e.y}function x(t,e,r,n){return!!(y(t,e)&&y(r,n)||y(t,n)&&y(r,e))||v(t,e,r)>0!=v(t,e,n)>0&&v(r,n,t)>0!=v(r,n,e)>0}function b(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function _(t,e){var r=new M(t.i,t.x,t.y),n=new M(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function w(t,e,r,n){var i=new M(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function k(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function M(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function A(t,e,r,n){for(var i=0,a=e,o=r-n;a0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],139:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var i=0;i=55296&&y<=56319&&(w+=t[++r]),w=k?h.call(k,M,w,g):w,e?(p.value=w,d(m,g,p)):m[g]=w,++g;v=g}if(void 0===v)for(v=o(t.length),e&&(m=new e(v)),r=0;r0?1:-1}},{}],150:[function(t,e,r){"use strict";var n=t("../math/sign"),i=Math.abs,a=Math.floor;e.exports=function(t){return isNaN(t)?0:0!==(t=Number(t))&&isFinite(t)?n(t)*a(i(t)):t}},{"../math/sign":147}],151:[function(t,e,r){"use strict";var n=t("./to-integer"),i=Math.max;e.exports=function(t){return i(0,n(t))}},{"./to-integer":150}],152:[function(t,e,r){"use strict";var n=t("./valid-callable"),i=t("./valid-value"),a=Function.prototype.bind,o=Function.prototype.call,s=Object.keys,l=Object.prototype.propertyIsEnumerable;e.exports=function(t,e){return function(r,c){var u,f=arguments[2],h=arguments[3];return r=Object(i(r)),n(c),u=s(r),h&&u.sort("function"==typeof h?a.call(h,r):void 0),"function"!=typeof t&&(t=u[t]),o.call(t,u,function(t,n){return l.call(r,t)?o.call(c,f,r[t],t,r,n):e})}}},{"./valid-callable":170,"./valid-value":172}],153:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?Object.assign:t("./shim")},{"./is-implemented":154,"./shim":155}],154:[function(t,e,r){"use strict";e.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},{}],155:[function(t,e,r){"use strict";var n=t("../keys"),i=t("../valid-value"),a=Math.max;e.exports=function(t,e){var r,o,s,l=a(arguments.length,2);for(t=Object(i(t)),s=function(n){try{t[n]=e[n]}catch(t){r||(r=t)}},o=1;o-1}},{}],176:[function(t,e,r){"use strict";var n=Object.prototype.toString,i=n.call("");e.exports=function(t){return"string"==typeof t||t&&"object"==typeof t&&(t instanceof String||n.call(t)===i)||!1}},{}],177:[function(t,e,r){"use strict";var n=Object.create(null),i=Math.random;e.exports=function(){var t;do{t=i().toString(36).slice(2)}while(n[t]);return t}},{}],178:[function(t,e,r){"use strict";var n,i=t("es5-ext/object/set-prototype-of"),a=t("es5-ext/string/#/contains"),o=t("d"),s=t("es6-symbol"),l=t("./"),c=Object.defineProperty;n=e.exports=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");l.call(this,t),e=e?a.call(e,"key+value")?"key+value":a.call(e,"key")?"key":"value":"value",c(this,"__kind__",o("",e))},i&&i(n,l),delete n.prototype.constructor,n.prototype=Object.create(l.prototype,{_resolve:o(function(t){return"value"===this.__kind__?this.__list__[t]:"key+value"===this.__kind__?[t,this.__list__[t]]:t})}),c(n.prototype,s.toStringTag,o("c","Array Iterator"))},{"./":181,d:122,"es5-ext/object/set-prototype-of":167,"es5-ext/string/#/contains":173,"es6-symbol":186}],179:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),i=t("es5-ext/object/valid-callable"),a=t("es5-ext/string/is-string"),o=t("./get"),s=Array.isArray,l=Function.prototype.call,c=Array.prototype.some;e.exports=function(t,e){var r,u,f,h,p,d,g,m,v=arguments[2];if(s(t)||n(t)?r="array":a(t)?r="string":t=o(t),i(e),f=function(){h=!0},"array"!==r)if("string"!==r)for(u=t.next();!u.done;){if(l.call(e,v,u.value,f),h)return;u=t.next()}else for(d=t.length,p=0;p=55296&&m<=56319&&(g+=t[++p]),l.call(e,v,g,f),!h);++p);else c.call(t,function(t){return l.call(e,v,t,f),h})}},{"./get":180,"es5-ext/function/is-arguments":144,"es5-ext/object/valid-callable":170,"es5-ext/string/is-string":176}],180:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),i=t("es5-ext/string/is-string"),a=t("./array"),o=t("./string"),s=t("./valid-iterable"),l=t("es6-symbol").iterator;e.exports=function(t){return"function"==typeof s(t)[l]?t[l]():n(t)?new a(t):i(t)?new o(t):new a(t)}},{"./array":178,"./string":183,"./valid-iterable":184,"es5-ext/function/is-arguments":144,"es5-ext/string/is-string":176,"es6-symbol":186}],181:[function(t,e,r){"use strict";var n,i=t("es5-ext/array/#/clear"),a=t("es5-ext/object/assign"),o=t("es5-ext/object/valid-callable"),s=t("es5-ext/object/valid-value"),l=t("d"),c=t("d/auto-bind"),u=t("es6-symbol"),f=Object.defineProperty,h=Object.defineProperties;e.exports=n=function(t,e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");h(this,{__list__:l("w",s(t)),__context__:l("w",e),__nextIndex__:l("w",0)}),e&&(o(e.on),e.on("_add",this._onAdd),e.on("_delete",this._onDelete),e.on("_clear",this._onClear))},delete n.prototype.constructor,h(n.prototype,a({_next:l(function(){var t;if(this.__list__)return this.__redo__&&void 0!==(t=this.__redo__.shift())?t:this.__nextIndex__=this.__nextIndex__||(++this.__nextIndex__,this.__redo__?(this.__redo__.forEach(function(e,r){e>=t&&(this.__redo__[r]=++e)},this),this.__redo__.push(t)):f(this,"__redo__",l("c",[t])))}),_onDelete:l(function(t){var e;t>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(-1!==(e=this.__redo__.indexOf(t))&&this.__redo__.splice(e,1),this.__redo__.forEach(function(e,r){e>t&&(this.__redo__[r]=--e)},this)))}),_onClear:l(function(){this.__redo__&&i.call(this.__redo__),this.__nextIndex__=0})}))),f(n.prototype,u.iterator,l(function(){return this}))},{d:122,"d/auto-bind":121,"es5-ext/array/#/clear":140,"es5-ext/object/assign":153,"es5-ext/object/valid-callable":170,"es5-ext/object/valid-value":172,"es6-symbol":186}],182:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),i=t("es5-ext/object/is-value"),a=t("es5-ext/string/is-string"),o=t("es6-symbol").iterator,s=Array.isArray;e.exports=function(t){return!!i(t)&&(!!s(t)||(!!a(t)||(!!n(t)||"function"==typeof t[o])))}},{"es5-ext/function/is-arguments":144,"es5-ext/object/is-value":161,"es5-ext/string/is-string":176,"es6-symbol":186}],183:[function(t,e,r){"use strict";var n,i=t("es5-ext/object/set-prototype-of"),a=t("d"),o=t("es6-symbol"),s=t("./"),l=Object.defineProperty;n=e.exports=function(t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");t=String(t),s.call(this,t),l(this,"__length__",a("",t.length))},i&&i(n,s),delete n.prototype.constructor,n.prototype=Object.create(s.prototype,{_next:a(function(){if(this.__list__)return this.__nextIndex__=55296&&e<=56319?r+this.__list__[this.__nextIndex__++]:r})}),l(n.prototype,o.toStringTag,a("c","String Iterator"))},{"./":181,d:122,"es5-ext/object/set-prototype-of":167,"es6-symbol":186}],184:[function(t,e,r){"use strict";var n=t("./is-iterable");e.exports=function(t){if(!n(t))throw new TypeError(t+" is not iterable");return t}},{"./is-iterable":182}],185:[function(t,e,r){(function(n,i){!function(t,n){"object"==typeof r&&void 0!==e?e.exports=n():t.ES6Promise=n()}(this,function(){"use strict";function e(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},a=0,o=void 0,s=void 0,l=function(t,e){g[a]=t,g[a+1]=e,2===(a+=2)&&(s?s(m):_())};var c="undefined"!=typeof window?window:void 0,u=c||{},f=u.MutationObserver||u.WebKitMutationObserver,h="undefined"==typeof self&&void 0!==n&&"[object process]"==={}.toString.call(n),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var t=setTimeout;return function(){return t(m,1)}}var g=new Array(1e3);function m(){for(var t=0;t0&&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){if(!i(e))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}return n.listener=e,this.on(t,n),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(o=(r=this._events[t]).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(n<0)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(i(r=this._events[t]))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){return 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)}},{}],196:[function(t,e,r){"use strict";e.exports=function(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]]]}},{}],197:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&function(t){for(var e,r=t.length,n=0;n13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],198:[function(t,e,r){"use strict";e.exports=function(t,e,r){switch(arguments.length){case 0:return new o([0],[0],0);case 1:if("number"==typeof t){var n=l(t);return new o(n,n,0)}return new o(t,l(t.length),0);case 2:if("number"==typeof e){var n=l(t.length);return new o(t,n,+e)}r=0;case 3:if(t.length!==e.length)throw new Error("state and velocity lengths must match");return new o(t,e,r)}};var n=t("cubic-hermite"),i=t("binary-search-bounds");function a(t,e,r){return Math.min(e,Math.max(t,r))}function o(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1){h=l.length-1;var d=t-e[r-1];for(p=0;p=r-1)for(var u=s.length-1,f=(e[r-1],0);f=0;--r)if(t[--e])return!1;return!0},s.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--f)n.push(a(l[f-1],c[f-1],arguments[f])),i.push(0)}},s.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t1e-6?1/s:0;this._time.push(t);for(var h=r;h>0;--h){var p=a(c[h-1],u[h-1],arguments[h]);n.push(p),i.push((p-n[o++])*f)}}},s.set=function(t){var e=this.dimension;if(!(t0;--l)r.push(a(o[l-1],s[l-1],arguments[l])),n.push(0)}},s.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var n=this._state,i=this._velocity,o=n.length-this.dimension,s=this.bounds,l=s[0],c=s[1],u=t-e,f=u>1e-6?1/u:0;this._time.push(t);for(var h=r;h>0;--h){var p=arguments[h];n.push(a(l[h-1],c[h-1],n[o++]+p)),i.push(p*f)}}},s.idle=function(t){var e=this.lastT();if(!(t=0;--f)n.push(a(l[f],c[f],n[o]+u*i[o])),i.push(0),o+=1}}},{"binary-search-bounds":73,"cubic-hermite":116}],199:[function(t,e,r){var n=t("dtype");e.exports=function(t,e,r){if(!t)throw new TypeError("must specify data as first parameter");if(r=0|+(r||0),Array.isArray(t)&&Array.isArray(t[0])){var i=t[0].length,a=t.length*i;e&&"string"!=typeof e||(e=new(n(e||"float32"))(a+r));var o=e.length-r;if(a!==o)throw new Error("source length "+a+" ("+i+"x"+t.length+") does not match destination length "+o);for(var s=0,l=r;s=0;--p){o=u[p];f[p]<=0?u[p]=new a(o._color,o.key,o.value,u[p+1],o.right,o._count+1):u[p]=new a(o._color,o.key,o.value,o.left,u[p+1],o._count+1)}for(p=u.length-1;p>1;--p){var d=u[p-1];o=u[p];if(d._color===i||o._color===i)break;var g=u[p-2];if(g.left===d)if(d.left===o){if(!(m=g.right)||m._color!==n){if(g._color=n,g.left=d.right,d._color=i,d.right=g,u[p-2]=d,u[p-1]=o,l(g),l(d),p>=3)(v=u[p-3]).left===g?v.left=d:v.right=d;break}d._color=i,g.right=s(i,m),g._color=n,p-=1}else{if(!(m=g.right)||m._color!==n){if(d.right=o.left,g._color=n,g.left=o.right,o._color=i,o.left=d,o.right=g,u[p-2]=o,u[p-1]=d,l(g),l(d),l(o),p>=3)(v=u[p-3]).left===g?v.left=o:v.right=o;break}d._color=i,g.right=s(i,m),g._color=n,p-=1}else if(d.right===o){if(!(m=g.left)||m._color!==n){if(g._color=n,g.right=d.left,d._color=i,d.left=g,u[p-2]=d,u[p-1]=o,l(g),l(d),p>=3)(v=u[p-3]).right===g?v.right=d:v.left=d;break}d._color=i,g.left=s(i,m),g._color=n,p-=1}else{var m;if(!(m=g.left)||m._color!==n){var v;if(d.left=o.right,g._color=n,g.right=o.left,o._color=i,o.right=d,o.left=g,u[p-2]=o,u[p-1]=d,l(g),l(d),l(o),p>=3)(v=u[p-3]).right===g?v.right=o:v.left=o;break}d._color=i,g.left=s(i,m),g._color=n,p-=1}}return u[0]._color=i,new c(r,u[0])},u.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return function t(e,r){var n;if(r.left&&(n=t(e,r.left)))return n;return(n=e(r.key,r.value))||(r.right?t(e,r.right):void 0)}(t,this.root);case 2:return function t(e,r,n,i){if(r(e,i.key)<=0){var a;if(i.left&&(a=t(e,r,n,i.left)))return a;if(a=n(i.key,i.value))return a}if(i.right)return t(e,r,n,i.right)}(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return function t(e,r,n,i,a){var o,s=n(e,a.key),l=n(r,a.key);if(s<=0){if(a.left&&(o=t(e,r,n,i,a.left)))return o;if(l>0&&(o=i(a.key,a.value)))return o}if(l>0&&a.right)return t(e,r,n,i,a.right)}(e,r,this._compare,t,this.root)}},Object.defineProperty(u,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new f(this,t)}}),Object.defineProperty(u,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),u.at=function(t){if(t<0)return new f(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new f(this,[])},u.ge=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a<=0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new f(this,n)},u.gt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a<0&&(i=n.length),r=a<0?r.left:r.right}return n.length=i,new f(this,n)},u.lt=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a>0&&(i=n.length),r=a<=0?r.left:r.right}return n.length=i,new f(this,n)},u.le=function(t){for(var e=this._compare,r=this.root,n=[],i=0;r;){var a=e(t,r.key);n.push(r),a>=0&&(i=n.length),r=a<0?r.left:r.right}return n.length=i,new f(this,n)},u.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 f(this,n);r=i<=0?r.left:r.right}return new f(this,[])},u.remove=function(t){var e=this.find(t);return e?e.remove():this},u.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=n<=0?r.left:r.right}};var h=f.prototype;function p(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,e){return te?1:0}Object.defineProperty(h,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(h,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),h.clone=function(){return new f(this.tree,this._stack.slice())},h.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 a(r._color,r.key,r.value,r.left,r.right,r._count);for(var u=t.length-2;u>=0;--u){(r=t[u]).left===t[u+1]?e[u]=new a(r._color,r.key,r.value,e[u+1],r.right,r._count):e[u]=new a(r._color,r.key,r.value,r.left,e[u+1],r._count)}if((r=e[e.length-1]).left&&r.right){var f=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var h=e[f-1];e.push(new a(r._color,h.key,h.value,r.left,r.right,r._count)),e[f-1].key=r.key,e[f-1].value=r.value;for(u=e.length-2;u>=f;--u)r=e[u],e[u]=new a(r._color,r.key,r.value,r.left,e[u+1],r._count);e[f-1].left=e[f]}if((r=e[e.length-1])._color===n){var d=e[e.length-2];d.left===r?d.left=null:d.right===r&&(d.right=null),e.pop();for(u=0;u=0;--u){if(e=t[u],0===u)return void(e._color=i);if((r=t[u-1]).left===e){if((a=r.right).right&&a.right._color===n)return c=(a=r.right=o(a)).right=o(a.right),r.right=a.left,a.left=r,a.right=c,a._color=r._color,e._color=i,r._color=i,c._color=i,l(r),l(a),u>1&&((f=t[u-2]).left===r?f.left=a:f.right=a),void(t[u-1]=a);if(a.left&&a.left._color===n)return c=(a=r.right=o(a)).left=o(a.left),r.right=c.left,a.left=c.right,c.left=r,c.right=a,c._color=r._color,r._color=i,a._color=i,e._color=i,l(r),l(a),l(c),u>1&&((f=t[u-2]).left===r?f.left=c:f.right=c),void(t[u-1]=c);if(a._color===i){if(r._color===n)return r._color=i,void(r.right=s(n,a));r.right=s(n,a);continue}a=o(a),r.right=a.left,a.left=r,a._color=r._color,r._color=n,l(r),l(a),u>1&&((f=t[u-2]).left===r?f.left=a:f.right=a),t[u-1]=a,t[u]=r,u+11&&((f=t[u-2]).right===r?f.right=a:f.left=a),void(t[u-1]=a);if(a.right&&a.right._color===n)return c=(a=r.left=o(a)).right=o(a.right),r.left=c.right,a.right=c.left,c.right=r,c.left=a,c._color=r._color,r._color=i,a._color=i,e._color=i,l(r),l(a),l(c),u>1&&((f=t[u-2]).right===r?f.right=c:f.left=c),void(t[u-1]=c);if(a._color===i){if(r._color===n)return r._color=i,void(r.left=s(n,a));r.left=s(n,a);continue}var f;a=o(a),r.left=a.right,a.right=r,a._color=r._color,r._color=n,l(r),l(a),u>1&&((f=t[u-2]).right===r?f.right=a:f.left=a),t[u-1]=a,t[u]=r,u+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(h,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(h,"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}),h.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(h,"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}}),h.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),n=e[e.length-1];r[r.length-1]=new a(n._color,n.key,t,n.left,n.right,n._count);for(var i=e.length-2;i>=0;--i)(n=e[i]).left===e[i+1]?r[i]=new a(n._color,n.key,n.value,r[i+1],n.right,n._count):r[i]=new a(n._color,n.key,n.value,n.left,r[i+1],n._count);return new c(this.tree._compare,r[0])},h.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(h,"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}})},{}],201:[function(t,e,r){var n=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],i=607/128,a=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function o(t){if(t<0)return Number("0/0");for(var e=a[0],r=a.length-1;r>0;--r)e+=a[r]/(t+r);var n=t+i+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}e.exports=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(o(e));e-=1;for(var r=n[0],i=1;i<9;i++)r+=n[i]/(e+i);var a=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(a,e+.5)*Math.exp(-a)*r},e.exports.log=o},{}],202:[function(t,e,r){e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("must specify type string");if(e=e||{},"undefined"==typeof document&&!e.canvas)return null;var r=e.canvas||document.createElement("canvas");"number"==typeof e.width&&(r.width=e.width);"number"==typeof e.height&&(r.height=e.height);var n,i=e;try{var a=[t];0===t.indexOf("webgl")&&a.push("experimental-"+t);for(var o=0;o0?(p[u]=-1,d[u]=0):(p[u]=0,d[u]=1)}}var g=[0,0,0],m={model:l,view:l,projection:l};f.isOpaque=function(){return!0},f.isTransparent=function(){return!1},f.drawTransparent=function(t){};var v=[0,0,0],y=[0,0,0],x=[0,0,0];f.draw=function(t){t=t||m;for(var e=this.gl,r=t.model||l,n=t.view||l,i=t.projection||l,a=this.bounds,s=o(r,n,i,a),u=s.cubeEdges,f=s.axis,h=n[12],b=n[13],_=n[14],w=n[15],k=this.pixelRatio*(i[3]*h+i[7]*b+i[11]*_+i[15]*w)/e.drawingBufferHeight,M=0;M<3;++M)this.lastCubeProps.cubeEdges[M]=u[M],this.lastCubeProps.axis[M]=f[M];var A=p;for(M=0;M<3;++M)d(p[M],M,this.bounds,u,f);e=this.gl;var T=g;for(M=0;M<3;++M)this.backgroundEnable[M]?T[M]=f[M]:T[M]=0;this._background.draw(r,n,i,a,T,this.backgroundColor),this._lines.bind(r,n,i,this);for(M=0;M<3;++M){var S=[0,0,0];f[M]>0?S[M]=a[1][M]:S[M]=a[0][M];for(var C=0;C<2;++C){var E=(M+1+C)%3,L=(M+1+(1^C))%3;this.gridEnable[E]&&this._lines.drawGrid(E,L,this.bounds,S,this.gridColor[E],this.gridWidth[E]*this.pixelRatio)}for(C=0;C<2;++C){E=(M+1+C)%3,L=(M+1+(1^C))%3;this.zeroEnable[L]&&a[0][L]<=0&&a[1][L]>=0&&this._lines.drawZero(E,L,this.bounds,S,this.zeroLineColor[L],this.zeroLineWidth[L]*this.pixelRatio)}}for(M=0;M<3;++M){this.lineEnable[M]&&this._lines.drawAxisLine(M,this.bounds,A[M].primalOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio),this.lineMirror[M]&&this._lines.drawAxisLine(M,this.bounds,A[M].mirrorOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio);var z=c(v,A[M].primalMinor),P=c(y,A[M].mirrorMinor),D=this.lineTickLength;for(C=0;C<3;++C){var O=k/r[5*C];z[C]*=D[C]*O,P[C]*=D[C]*O}this.lineTickEnable[M]&&this._lines.drawAxisTicks(M,A[M].primalOffset,z,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio),this.lineTickMirror[M]&&this._lines.drawAxisTicks(M,A[M].mirrorOffset,P,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio)}this._lines.unbind(),this._text.bind(r,n,i,this.pixelRatio);for(M=0;M<3;++M){var I=A[M].primalMinor,R=c(x,A[M].primalOffset);for(C=0;C<3;++C)this.lineTickEnable[M]&&(R[C]+=k*I[C]*Math.max(this.lineTickLength[C],0)/r[5*C]);if(this.tickEnable[M]){for(C=0;C<3;++C)R[C]+=k*I[C]*this.tickPad[C]/r[5*C];this._text.drawTicks(M,this.tickSize[M],this.tickAngle[M],R,this.tickColor[M])}if(this.labelEnable[M]){for(C=0;C<3;++C)R[C]+=k*I[C]*this.labelPad[C]/r[5*C];R[M]+=.5*(a[0][M]+a[1][M]),this._text.drawLabel(M,this.labelSize[M],this.labelAngle[M],R,this.labelColor[M])}}this._text.unbind()},f.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":204,"./lib/cube.js":205,"./lib/lines.js":206,"./lib/text.js":208,"./lib/ticks.js":209}],204:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=[],s=0,l=0;l<3;++l)for(var c=(l+1)%3,u=(l+2)%3,f=[0,0,0],h=[0,0,0],p=-1;p<=1;p+=2){r.push(s,s+2,s+1,s+1,s+2,s+3),f[l]=p,h[l]=p;for(var d=-1;d<=1;d+=2){f[c]=d;for(var g=-1;g<=1;g+=2)f[u]=g,e.push(f[0],f[1],f[2],h[0],h[1],h[2]),s+=1}var m=c;c=u,u=m}var v=n(t,new Float32Array(e)),y=n(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),x=i(t,[{buffer:v,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:v,type:t.FLOAT,size:3,offset:12,stride:24}],y),b=a(t);return b.attributes.position.location=0,b.attributes.normal.location=1,new o(t,v,x,b)};var n=t("gl-buffer"),i=t("gl-vao"),a=t("./shaders").bg;function o(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}var s=o.prototype;s.draw=function(t,e,r,n,i,a){for(var o=!1,s=0;s<3;++s)o=o||i[s];if(o){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:a},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),this.vao.unbind(),l.disable(l.POLYGON_OFFSET_FILL)}},s.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":207,"gl-buffer":211,"gl-vao":284}],205:[function(t,e,r){"use strict";e.exports=function(t,e,r,a){i(s,e,t),i(s,r,s);for(var p=0,y=0;y<2;++y){u[2]=a[y][2];for(var x=0;x<2;++x){u[1]=a[x][1];for(var b=0;b<2;++b)u[0]=a[b][0],h(l[p],u,s),p+=1}}for(var _=-1,y=0;y<8;++y){for(var w=l[y][3],k=0;k<3;++k)c[y][k]=l[y][k]/w;w<0&&(_<0?_=y:c[y][2]S&&(_|=1<S&&(_|=1<c[y][1]&&(I=y));for(var R=-1,y=0;y<3;++y){var B=I^1<c[F][0]&&(F=B)}}var N=g;N[0]=N[1]=N[2]=0,N[n.log2(R^I)]=I&R,N[n.log2(I^F)]=I&F;var j=7^F;j===_||j===O?(j=7^R,N[n.log2(F^j)]=j&F):N[n.log2(R^j)]=j&R;for(var V=m,U=_,M=0;M<3;++M)V[M]=U&1< 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}"]),u=n(["precision mediump float;\n#define GLSLIFY 1\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 i(t,c,u,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":268,glslify:353}],208:[function(t,e,r){(function(r){"use strict";e.exports=function(t,e,r,a,s,l){var u=n(t),f=i(t,[{buffer:u,size:3}]),h=o(t);h.attributes.position.location=0;var p=new c(t,h,u,f);return p.update(e,r,a,s,l),p};var n=t("gl-buffer"),i=t("gl-vao"),a=t("vectorize-text"),o=t("./shaders").text,s=window||r.global||{},l=s.__TEXT_CACHE||{};s.__TEXT_CACHE={};function c(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}var u=c.prototype,f=[0,0];u.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,f[0]=this.gl.drawingBufferWidth,f[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=f},u.unbind=function(){this.vao.unbind()},u.update=function(t,e,r,n,i){this.gl;var o=[];function s(t,e,r,n){var i=l[r];i||(i=l[r]={});var s=i[e];s||(s=i[e]=function(t,e){try{return a(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var c=(n||12)/12,u=s.positions,f=s.cells,h=0,p=f.length;h=0;--g){var m=u[d[g]];o.push(c*m[0],-c*m[1],t)}}for(var c=[0,0,0],u=[0,0,0],f=[0,0,0],h=[0,0,0],p=0;p<3;++p){f[p]=o.length/3|0,s(.5*(t[0][p]+t[1][p]),e[p],r),h[p]=(o.length/3|0)-f[p],c[p]=o.length/3|0;for(var d=0;d=0&&(i=r.length-n-1);var a=Math.pow(10,i),o=Math.round(t*e*a),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/a,c=o%a;o<0?(l=0|-Math.ceil(l),c=0|-c):(l=0|Math.floor(l),c|=0);var u=""+l;if(o<0&&(u="-"+u),i){for(var f=""+c;f.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r},r.equal=function(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;nr)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,a,i),r}function u(t,e){for(var r=n.malloc(t.length,e),i=t.length,a=0;a=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=c(this.gl,this.type,this.length,this.usage,t.data,e):this.length=c(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var s=n.malloc(t.size,r),l=a(s,t.shape);i.assign(l,t),this.length=c(this.gl,this.type,this.length,this.usage,e<0?s:s.subarray(0,t.size),e),n.free(s)}}else if(Array.isArray(t)){var f;f=this.type===this.gl.ELEMENT_ARRAY_BUFFER?u(t,"uint16"):u(t,"float32"),this.length=c(this.gl,this.type,this.length,this.usage,e<0?f:f.subarray(0,t.length),e),n.free(f)}else if("object"==typeof t&&"number"==typeof t.length)this.length=c(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)<=0&&(t=1),this.gl.bufferData(this.type,0|t,this.usage),this.length=t}},e.exports=function(t,e,r,n){if(r=r||t.ARRAY_BUFFER,n=n||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(n!==t.DYNAMIC_DRAW&&n!==t.STATIC_DRAW&&n!==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 i=new s(t,r,t.createBuffer(),0,n);return i.update(e),i}},{ndarray:393,"ndarray-ops":387,"typedarray-pool":481}],212:[function(t,e,r){"use strict";var n=t("gl-vec3"),i=(t("gl-vec4"),function(t,e){for(var r=0;r=e)return r-1;return r}),a=n.create(),o=n.create(),s=function(t,e,r){return tr?r:t},l=function(t,e,r,l){var c=t[0],u=t[1],f=t[2],h=r[0].length,p=r[1].length,d=r[2].length,g=i(r[0],c),m=i(r[1],u),v=i(r[2],f),y=g+1,x=m+1,b=v+1;if(l&&(g=s(g,0,h-1),y=s(y,0,h-1),m=s(m,0,p-1),x=s(x,0,p-1),v=s(v,0,d-1),b=s(b,0,d-1)),g<0||m<0||v<0||y>=h||x>=p||b>=d)return n.create();var _=(c-r[0][g])/(r[0][y]-r[0][g]),w=(u-r[1][m])/(r[1][x]-r[1][m]),k=(f-r[2][v])/(r[2][b]-r[2][v]);(_<0||_>1||isNaN(_))&&(_=0),(w<0||w>1||isNaN(w))&&(w=0),(k<0||k>1||isNaN(k))&&(k=0);var M=v*h*p,A=b*h*p,T=m*h,S=x*h,C=g,E=y,L=e[T+M+C],z=e[T+M+E],P=e[S+M+C],D=e[S+M+E],O=e[T+A+C],I=e[T+A+E],R=e[S+A+C],B=e[S+A+E],F=n.create();return n.lerp(F,L,z,_),n.lerp(a,P,D,_),n.lerp(F,F,a,w),n.lerp(a,O,I,_),n.lerp(o,R,B,_),n.lerp(a,a,o,w),n.lerp(F,F,a,k),F};e.exports=function(t,e){var r;r=t.positions?t.positions:function(t){for(var e=t[0],r=t[1],n=t[2],i=[],a=0;as&&(s=n.length(x)),g){var _=n.distance(b,g);_1.0001)return null;m+=g[u]}if(Math.abs(m-1)>.001)return null;return[f,function(t,e){for(var r=[0,0,0],n=0;n=1},b.isTransparent=function(){return this.opacity<1},b.pickSlots=1,b.setPickBase=function(t){this.pickId=t},b.highlight=function(t){if(t&&this.contourEnable){for(var e=h(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=p.mallocFloat32(6*a),s=0,l=0;l0&&((f=this.triShader).bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind());this.edgeCount>0&&this.lineWidth>0&&((f=this.lineShader).bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind());this.pointCount>0&&((f=this.pointShader).bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind());this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0&&((f=this.contourShader).bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind())},b.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||y,n=t.view||y,i=t.projection||y,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s,l={model:r,view:n,projection:i,clipBounds:a,vectorScale:this.vectorScale,coneScale:this.coneScale,coneOffset:this.coneOffset,pickId:this.pickId/255};((s=this.pickShader).bind(),s.uniforms=l,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)&&((s=this.pointPickShader).bind(),s.uniforms=l,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind())},b.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),a=0;a 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0)); \n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0, \n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float index, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n index = mod(index, segmentCount * 6.0);\n\n float segment = floor(index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex == 3.0) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n // angle = 2pi * ((segment + ((segmentIndex == 1.0 || segmentIndex == 5.0) ? 1.0 : 0.0)) / segmentCount)\n float nextAngle = float(segmentIndex == 1.0 || segmentIndex == 5.0);\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex <= 2.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nvoid main() {\n // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, normal), 0.0);\n normal = normalize(normal * inverse(mat3(model)));\n\n // vec4 m_position = model * vec4(conePosition, 1.0);\n vec4 t_position = view * conePosition;\n gl_Position = projection * t_position;\n f_color = color; //vec4(position.w, color.r, 0, 0);\n f_normal = normal;\n f_data = conePosition.xyz;\n f_eyeDirection = eyePosition - conePosition.xyz;\n f_lightDirection = lightPosition - conePosition.xyz;\n f_uv = uv;\n}"]),a=n(["precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(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\nfloat cookTorranceSpecular(\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(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\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(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = 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=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}"]),s=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]);r.meshShader={vertex:i,fragment:a,attributes:[{name:"position",type:"vec4"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec3"}]},r.pickShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]}},{glslify:353}],216:[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",34000:"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"}},{}],217:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":216}],218:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=n(e),o=i(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}]),l=a(e);l.attributes.position.location=0,l.attributes.color.location=1,l.attributes.offset.location=2;var c=new s(e,r,o,l);return c.update(t),c};var n=t("gl-buffer"),i=t("gl-vao"),a=t("./shaders/index"),o=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function s(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}var l=s.prototype;function c(t,e){for(var r=0;r<3;++r)t[0][r]=Math.min(t[0][r],e[r]),t[1][r]=Math.max(t[1][r],e[r])}l.isOpaque=function(){return this.opacity>=1},l.isTransparent=function(){return this.opacity<1},l.drawTransparent=l.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||o,i=r.projection=t.projection||o;r.model=t.model||o,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var a=n[12],s=n[13],l=n[14],c=n[15],u=this.pixelRatio*(i[3]*a+i[7]*s+i[11]*l+i[15]*c)/e.drawingBufferHeight;this.vao.bind();for(var f=0;f<3;++f)e.lineWidth(this.lineWidth[f]),r.capSize=this.capSize[f]*u,this.lineCount[f]&&e.drawArrays(e.LINES,this.lineOffset[f],this.lineCount[f]);this.vao.unbind()};var u=function(){for(var t=new Array(3),e=0;e<3;++e){for(var r=[],n=1;n<=2;++n)for(var i=-1;i<=1;i+=2){var a=[0,0,0];a[(n+e)%3]=i,r.push(a)}t[e]=r}return t}();function f(t,e,r,n){for(var i=u[n],a=0;a0)(g=u.slice())[s]+=p[1][s],i.push(u[0],u[1],u[2],d[0],d[1],d[2],d[3],0,0,0,g[0],g[1],g[2],d[0],d[1],d[2],d[3],0,0,0),c(this.bounds,g),o+=2+f(i,g,d,s)}}this.lineCount[s]=o-this.lineOffset[s]}this.buffer.update(i)}},l.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":219,"gl-buffer":211,"gl-vao":284}],219:[function(t,e,r){"use strict";var n=t("glslify"),i=t("gl-shader"),a=n(["precision mediump float;\n#define GLSLIFY 1\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=n(["precision mediump float;\n#define GLSLIFY 1\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 i(t,a,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},{"gl-shader":268,glslify:353}],220:[function(t,e,r){"use strict";var n=t("gl-texture2d");e.exports=function(t,e,r,n){i||(i=t.FRAMEBUFFER_UNSUPPORTED,a=t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,o=t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,s=t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var c=t.getExtension("WEBGL_draw_buffers");!l&&c&&function(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);l=new Array(r+1);for(var n=0;n<=r;++n){for(var i=new Array(r),a=0;au||r<0||r>u)throw new Error("gl-fbo: Parameters are too large for FBO");var f=1;if("color"in(n=n||{})){if((f=Math.max(0|n.color,0))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(f>1){if(!c)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(f>t.getParameter(c.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+f+" draw buffers")}}var h=t.UNSIGNED_BYTE,p=t.getExtension("OES_texture_float");if(n.float&&f>0){if(!p)throw new Error("gl-fbo: Context does not support floating point textures");h=t.FLOAT}else n.preferFloat&&f>0&&p&&(h=t.FLOAT);var g=!0;"depth"in n&&(g=!!n.depth);var m=!1;"stencil"in n&&(m=!!n.stencil);return new d(t,e,r,h,f,g,m,c)};var i,a,o,s,l=null;function c(t){return[t.getParameter(t.FRAMEBUFFER_BINDING),t.getParameter(t.RENDERBUFFER_BINDING),t.getParameter(t.TEXTURE_BINDING_2D)]}function u(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function f(t){switch(t){case i:throw new Error("gl-fbo: Framebuffer unsupported");case a:throw new Error("gl-fbo: Framebuffer incomplete attachment");case o:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case s:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function h(t,e,r,i,a,o){if(!i)return null;var s=n(t,e,r,a,i);return s.magFilter=t.NEAREST,s.minFilter=t.NEAREST,s.mipSamples=1,s.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,o,t.TEXTURE_2D,s.handle,0),s}function p(t,e,r,n,i){var a=t.createRenderbuffer();return t.bindRenderbuffer(t.RENDERBUFFER,a),t.renderbufferStorage(t.RENDERBUFFER,n,e,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,a),a}function d(t,e,r,n,i,a,o,s){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=s,this.color=new Array(i);for(var d=0;d1&&s.drawBuffersWEBGL(l[o]);var y=r.getExtension("WEBGL_depth_texture");y?d?t.depth=h(r,i,a,y.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g&&(t.depth=h(r,i,a,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):g&&d?t._depth_rb=p(r,i,a,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):g?t._depth_rb=p(r,i,a,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=p(r,i,a,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var x=r.checkFramebufferStatus(r.FRAMEBUFFER);if(x!==r.FRAMEBUFFER_COMPLETE){for(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),v=0;vi||r<0||r>i)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var a=c(n),o=0;o>8*p&255;this.pickOffset=r,i.bind();var d=i.uniforms;d.viewTransform=t,d.pickOffset=e,d.shape=this.shape;var g=i.attributes;return this.positionBuffer.bind(),g.position.pointer(),this.weightBuffer.bind(),g.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),g.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),f.pick=function(t,e,r){var n=this.pickOffset,i=this.shape[0]*this.shape[1];if(r=n+i)return null;var a=r-n,o=this.xData,s=this.yData;return{object:this,pointId:a,dataCoord:[o[a%this.shape[0]],s[a/this.shape[0]|0]]}},f.update=function(t){var e=(t=t||{}).shape||[0,0],r=t.x||i(e[0]),o=t.y||i(e[1]),s=t.z||new Float32Array(e[0]*e[1]);this.xData=r,this.yData=o;var l=t.colorLevels||[0],c=t.colorValues||[0,0,0,1],u=l.length,f=this.bounds,p=f[0]=r[0],d=f[1]=o[0],g=1/((f[2]=r[r.length-1])-p),m=1/((f[3]=o[o.length-1])-d),v=e[0],y=e[1];this.shape=[v,y];var x=(v-1)*(y-1)*(h.length>>>1);this.numVertices=x;for(var b=a.mallocUint8(4*x),_=a.mallocFloat32(2*x),w=a.mallocUint8(2*x),k=a.mallocUint32(x),M=0,A=0;A 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\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_1540259130(pixelArcLength).xyz);\n}"]),l=[{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 i(t,a,o,null,l)},r.createPickShader=function(t){return i(t,a,s,null,l)}},{"gl-shader":268,glslify:353}],226:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl||t.scene&&t.scene.gl,r=u(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 o=f(e);o.attributes.position.location=0,o.attributes.nextPosition.location=1,o.attributes.arcLength.location=2,o.attributes.lineWidth.location=3,o.attributes.color.location=4;for(var s=n(e),c=i(e,[{buffer:s,size:3,offset:0,stride:48},{buffer:s,size:3,offset:12,stride:48},{buffer:s,size:1,offset:24,stride:48},{buffer:s,size:1,offset:28,stride:48},{buffer:s,size:4,offset:32,stride:48}]),h=l(new Array(1024),[256,1,4]),p=0;p<1024;++p)h.data[p]=255;var d=a(e,h);d.wrap=e.REPEAT;var g=new m(e,r,o,s,c,d);return g.update(t),g};var n=t("gl-buffer"),i=t("gl-vao"),a=t("gl-texture2d"),o=t("glsl-read-float"),s=t("binary-search-bounds"),l=t("ndarray"),c=t("./lib/shaders"),u=c.createShader,f=c.createPickShader,h=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function p(t,e){for(var r=0,n=0;n<3;++n){var i=t[n]-e[n];r+=i*i}return Math.sqrt(r)}function d(t){for(var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],r=0;r<3;++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 g(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function m(t,e,r,n,i,a){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=a,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}var v=m.prototype;v.isTransparent=function(){return this.opacity<1},v.isOpaque=function(){return this.opacity>=1},v.pickSlots=1,v.setPickBase=function(t){this.pickId=t},v.drawTransparent=v.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||h,view:t.view||h,projection:t.projection||h,clipBounds:d(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),n.unbind()},v.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||h,view:t.view||h,projection:t.projection||h,pickId:this.pickId,clipBounds:d(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()},v.update=function(t){var e,r;this.dirty=!0;var n=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var i=t.position||t.positions;if(i){var a=t.color||t.colors||[0,0,0,1],o=t.lineWidth||1,c=[],u=[],f=[],h=0,d=0,g=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],m=!1;t:for(e=1;e0){for(var w=0;w<24;++w)c.push(c[c.length-12]);d+=2,m=!0}continue t}g[0][r]=Math.min(g[0][r],b[r],_[r]),g[1][r]=Math.max(g[1][r],b[r],_[r])}Array.isArray(a[0])?(v=a[e-1],y=a[e]):v=y=a,3===v.length&&(v=[v[0],v[1],v[2],1]),3===y.length&&(y=[y[0],y[1],y[2],1]),x=Array.isArray(o)?o[e-1]:o;var k=h;if(h+=p(b,_),m){for(r=0;r<2;++r)c.push(b[0],b[1],b[2],_[0],_[1],_[2],k,x,v[0],v[1],v[2],v[3]);d+=2,m=!1}c.push(b[0],b[1],b[2],_[0],_[1],_[2],k,x,v[0],v[1],v[2],v[3],b[0],b[1],b[2],_[0],_[1],_[2],k,-x,v[0],v[1],v[2],v[3],_[0],_[1],_[2],b[0],b[1],b[2],h,-x,y[0],y[1],y[2],y[3],_[0],_[1],_[2],b[0],b[1],b[2],h,x,y[0],y[1],y[2],y[3]),d+=4}if(this.buffer.update(c),u.push(h),f.push(i[i.length-1].slice()),this.bounds=g,this.vertexCount=d,this.points=f,this.arcLength=u,"dashes"in t){var M=t.dashes.slice();for(M.unshift(0),e=1;e1.0001)return null;m+=g[u]}if(Math.abs(m-1)>.001)return null;return[f,function(t,e){for(var r=[0,0,0],n=0;n 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}"]),u=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}"]),f=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]),h=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}"]),p=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}"]),d=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n"]);r.meshShader={vertex:i,fragment:a,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:l,fragment:c,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:u,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:h,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:p,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{glslify:353}],249:[function(t,e,r){"use strict";var n=t("gl-shader"),i=t("gl-buffer"),a=t("gl-vao"),o=t("gl-texture2d"),s=t("normals"),l=t("gl-mat4/multiply"),c=t("gl-mat4/invert"),u=t("ndarray"),f=t("colormap"),h=t("simplicial-complex-contour"),p=t("typedarray-pool"),d=t("./lib/shaders"),g=t("./lib/closest-point"),m=d.meshShader,v=d.wireShader,y=d.pointShader,x=d.pickShader,b=d.pointPickShader,_=d.contourShader,w=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function k(t,e,r,n,i,a,o,s,l,c,u,f,h,p,d,g,m,v,y,x,b,_,k,M,A,T,S){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=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=u,this.triangleNormals=h,this.triangleUVs=f,this.triangleIds=c,this.triangleVAO=p,this.triangleCount=0,this.lineWidth=1,this.edgePositions=d,this.edgeColors=m,this.edgeUVs=v,this.edgeIds=g,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=x,this.pointColors=_,this.pointUVs=k,this.pointSizes=M,this.pointIds=b,this.pointVAO=A,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=T,this.contourVAO=S,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=w,this._view=w,this._projection=w,this._resolution=[1,1]}var M=k.prototype;function A(t){var e=n(t,y.vertex,y.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.pointSize.location=4,e}function T(t){var e=n(t,x.vertex,x.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e}function S(t){var e=n(t,b.vertex,b.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}function C(t){var e=n(t,_.vertex,_.fragment);return e.attributes.position.location=0,e}M.isOpaque=function(){return this.opacity>=1},M.isTransparent=function(){return this.opacity<1},M.pickSlots=1,M.setPickBase=function(t){this.pickId=t},M.highlight=function(t){if(t&&this.contourEnable){for(var e=h(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=p.mallocFloat32(6*a),s=0,l=0;l0&&((f=this.triShader).bind(),f.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind());this.edgeCount>0&&this.lineWidth>0&&((f=this.lineShader).bind(),f.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind());this.pointCount>0&&((f=this.pointShader).bind(),f.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind());this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0&&((f=this.contourShader).bind(),f.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind())},M.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||w,n=t.view||w,i=t.projection||w,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s,l={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255};((s=this.pickShader).bind(),s.uniforms=l,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)&&((s=this.pointPickShader).bind(),s.uniforms=l,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind())},M.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),a=0;ai[M]&&(r.uniforms.dataAxis=c,r.uniforms.screenOffset=u,r.uniforms.color=m[t],r.uniforms.angle=v[t],a.drawArrays(a.TRIANGLES,i[M],i[A]-i[M]))),y[t]&&k&&(u[1^t]-=T*p*x[t],r.uniforms.dataAxis=f,r.uniforms.screenOffset=u,r.uniforms.color=b[t],r.uniforms.angle=_[t],a.drawArrays(a.TRIANGLES,w,k)),u[1^t]=T*s[2+(1^t)]-1,d[t+2]&&(u[1^t]+=T*p*g[t+2],Mi[M]&&(r.uniforms.dataAxis=c,r.uniforms.screenOffset=u,r.uniforms.color=m[t+2],r.uniforms.angle=v[t+2],a.drawArrays(a.TRIANGLES,i[M],i[A]-i[M]))),y[t+2]&&k&&(u[1^t]+=T*p*x[t+2],r.uniforms.dataAxis=f,r.uniforms.screenOffset=u,r.uniforms.color=b[t+2],r.uniforms.angle=_[t+2],a.drawArrays(a.TRIANGLES,w,k))}),g.drawTitle=function(){var t=[0,0],e=[0,0];return function(){var r=this.plot,n=this.shader,i=r.gl,a=r.screenBox,o=r.titleCenter,s=r.titleAngle,l=r.titleColor,c=r.pixelRatio;if(this.titleCount){for(var u=0;u<2;++u)e[u]=2*(o[u]*c-a[u])/(a[2+u]-a[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)}}}(),g.bind=(h=[0,0],p=[0,0],d=[0,0],function(){var t=this.plot,e=this.shader,r=t._tickBounds,n=t.dataBox,i=t.screenBox,a=t.viewBox;e.bind();for(var o=0;o<2;++o){var s=r[o],l=r[o+2]-s,c=.5*(n[o+2]+n[o]),u=n[o+2]-n[o],f=a[o],g=a[o+2]-f,m=i[o],v=i[o+2]-m;p[o]=2*l/u*g/v,h[o]=2*(s-c)/u*g/v}d[1]=2*t.pixelRatio/(i[3]-i[1]),d[0]=d[1]*(i[3]-i[1])/(i[2]-i[0]),e.uniforms.dataScale=p,e.uniforms.dataShift=h,e.uniforms.textScale=d,this.vbo.bind(),e.attributes.textCoordinate.pointer()}),g.update=function(t){var e,r,n,i,o,s=[],l=t.ticks,c=t.bounds;for(o=0;o<2;++o){var u=[Math.floor(s.length/3)],f=[-1/0],h=l[o];for(e=0;e=0){var g=e[d]-n[d]*(e[d+2]-e[d])/(n[d+2]-n[d]);0===d?o.drawLine(g,e[1],g,e[3],p[d],h[d]):o.drawLine(e[0],g,e[2],g,p[d],h[d])}}for(d=0;d=0;--t)this.objects[t].dispose();this.objects.length=0;for(t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},c.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},c.removeObject=function(t){for(var e=this.objects,r=0;r0&&0===E[e-1];)E.pop(),L.pop().dispose()}window.addEventListener("resize",N),B.update=function(t){e||(t=t||{},z=!0,P=!0)},B.add=function(t){e||(t.axes=M,S.push(t),C.push(-1),z=!0,P=!0,j())},B.remove=function(t){if(!e){var r=S.indexOf(t);r<0||(S.splice(r,1),C.pop(),z=!0,P=!0,j())}},B.dispose=function(){if(!e&&(e=!0,window.removeEventListener("resize",N),r.removeEventListener("webglcontextlost",q),B.mouseListener.enabled=!1,!B.contextLost)){M.dispose(),T.dispose();for(var t=0;tx.distance)continue;for(var u=0;u0){r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function g(t){return"boolean"!=typeof t||t}},{"./lib/shader":257,"3d-view-controls":41,"a-big-triangle":44,"gl-axes3d":203,"gl-axes3d/properties":210,"gl-fbo":220,"gl-mat4/perspective":238,"gl-select-static":267,"gl-spikes3d":277,"is-mobile":364,"mouse-change":378}],259:[function(t,e,r){var n=t("glslify");r.pointVertex=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\n\nuniform mat3 matrix;\nuniform float pointSize;\nuniform float pointCloud;\n\nhighp float rand(vec2 co) {\n highp float a = 12.9898;\n highp float b = 78.233;\n highp float c = 43758.5453;\n highp float d = dot(co.xy, vec2(a, b));\n highp float e = mod(d, 3.14);\n return fract(sin(e) * c);\n}\n\nvoid main() {\n vec3 hgPosition = matrix * vec3(position, 1);\n gl_Position = vec4(hgPosition.xy, 0, hgPosition.z);\n // if we don't jitter the point size a bit, overall point cloud\n // saturation 'jumps' on zooming, which is disturbing and confusing\n gl_PointSize = pointSize * ((19.5 + rand(position)) / 20.0);\n if(pointCloud != 0.0) { // pointCloud is truthy\n // get the same square surface as circle would be\n gl_PointSize *= 0.886;\n }\n}"]),r.pointFragment=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\nuniform float pointCloud;\n\nvoid main() {\n float radius;\n vec4 baseColor;\n if(pointCloud != 0.0) { // pointCloud is truthy\n if(centerFraction == 1.0) {\n gl_FragColor = color;\n } else {\n gl_FragColor = mix(borderColor, color, centerFraction);\n }\n } else {\n radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 1.0) {\n discard;\n }\n baseColor = mix(borderColor, color, step(radius, centerFraction));\n gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n }\n}\n"]),r.pickVertex=n(["precision mediump float;\n#define GLSLIFY 1\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=n(["precision mediump float;\n#define GLSLIFY 1\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"])},{glslify:353}],260:[function(t,e,r){"use strict";var n=t("gl-shader"),i=t("gl-buffer"),a=t("typedarray-pool"),o=t("./lib/shader");function s(t,e,r,n,i){this.plot=t,this.offsetBuffer=e,this.pickBuffer=r,this.shader=n,this.pickShader=i,this.sizeMin=.5,this.sizeMinCap=2,this.sizeMax=20,this.areaRatio=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.blend=!1,this.pickOffset=0,this.points=null}e.exports=function(t,e){var r=t.gl,a=i(r),l=i(r),c=n(r,o.pointVertex,o.pointFragment),u=n(r,o.pickVertex,o.pickFragment),f=new s(t,a,l,c,u);return f.update(e),t.addObject(f),f};var l,c,u=s.prototype;u.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},u.update=function(t){var e;function r(e,r){return e in t?t[e]:r}t=t||{},this.sizeMin=r("sizeMin",.5),this.sizeMax=r("sizeMax",20),this.color=r("color",[1,0,0,1]).slice(),this.areaRatio=r("areaRatio",1),this.borderColor=r("borderColor",[0,0,0,1]).slice(),this.blend=r("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,o=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,s=t.positions,l=i?s:a.mallocFloat32(s.length),c=o?t.idToIndex:a.mallocInt32(n);if(i||l.set(s),!o)for(l.set(s),e=0;e>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}(this.points,i),u=this.plot.pickPixelRatio*Math.max(Math.min(this.sizeMinCap,this.sizeMin),Math.min(this.sizeMax,this.sizeMax/Math.pow(s,.33333)));l[0]=2/a,l[4]=2/o,l[6]=-2*i[0]/a-1,l[7]=-2*i[1]/o-1,this.offsetBuffer.bind(),r.bind(),r.attributes.position.pointer(),r.uniforms.matrix=l,r.uniforms.color=this.color,r.uniforms.borderColor=this.borderColor,r.uniforms.pointCloud=u<5,r.uniforms.pointSize=u,r.uniforms.centerFraction=Math.min(1,Math.max(0,Math.sqrt(1-this.areaRatio))),e&&(c[0]=255&t,c[1]=t>>8&255,c[2]=t>>16&255,c[3]=t>>24&255,this.pickBuffer.bind(),r.attributes.pickId.pointer(n.UNSIGNED_BYTE),r.uniforms.pickOffset=c,this.pickOffset=t);var f=n.getParameter(n.BLEND),h=n.getParameter(n.DITHER);return f&&!this.blend&&n.disable(n.BLEND),h&&n.disable(n.DITHER),n.drawArrays(n.POINTS,0,this.pointCount),f&&!this.blend&&n.enable(n.BLEND),h&&n.enable(n.DITHER),t+this.pointCount}),u.draw=u.unifiedDraw,u.drawPick=u.unifiedDraw,u.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(r=n+i)return null;var a=r-n,o=this.points;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}}},{"./lib/shader":259,"gl-buffer":211,"gl-shader":268,"typedarray-pool":481}],261:[function(t,e,r){e.exports=function(t,e,r,n){var i,a,o,s,l,c=e[0],u=e[1],f=e[2],h=e[3],p=r[0],d=r[1],g=r[2],m=r[3];(a=c*p+u*d+f*g+h*m)<0&&(a=-a,p=-p,d=-d,g=-g,m=-m);1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n);return t[0]=s*c+l*p,t[1]=s*u+l*d,t[2]=s*f+l*g,t[3]=s*h+l*m,t}},{}],262:[function(t,e,r){"use strict";var n=t("vectorize-text");e.exports=function(t,e){var r=i[e];r||(r=i[e]={});if(t in r)return r[t];for(var a=n(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=n(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-1/0,-1/0]],l=0;l=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var d=[0,0],g=[0,0,0],m=[0,0,0],v=[0,0,0,1],y=[0,0,0,1],x=c.slice(),b=[0,0,0],_=[[0,0,0],[0,0,0]];function w(t){return t[0]=t[1]=t[2]=0,t}function k(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function M(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function A(t,e,r,n,i){var a,s=e.axesProject,l=e.gl,u=t.uniforms,h=r.model||c,p=r.view||c,A=r.projection||c,T=e.axesBounds,S=function(t){for(var e=_,r=0;r<2;++r)for(var n=0;n<3;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}(e.clipBounds);a=e.axes&&e.axes.lastCubeProps?e.axes.lastCubeProps.axis:[1,1,1],d[0]=2/l.drawingBufferWidth,d[1]=2/l.drawingBufferHeight,t.bind(),u.view=p,u.projection=A,u.screenSize=d,u.highlightId=e.highlightId,u.highlightScale=e.highlightScale,u.clipBounds=S,u.pickGroup=e.pickId/255,u.pixelRatio=e.pixelRatio;for(var C=0;C<3;++C)if(s[C]&&e.projectOpacity[C]<1===n){u.scale=e.projectScale[C],u.opacity=e.projectOpacity[C];for(var E=x,L=0;L<16;++L)E[L]=0;for(L=0;L<4;++L)E[5*L]=1;E[5*C]=0,a[C]<0?E[12+C]=T[0][C]:E[12+C]=T[1][C],o(E,h,E),u.model=E;var z=(C+1)%3,P=(C+2)%3,D=w(g),O=w(m);D[z]=1,O[P]=1;var I=f(0,0,0,k(v,D)),R=f(0,0,0,k(y,O));if(Math.abs(I[1])>Math.abs(R[1])){var B=I;I=R,R=B,B=D,D=O,O=B;var F=z;z=P,P=F}I[0]<0&&(D[z]=-1),R[1]>0&&(O[P]=-1);var N=0,j=0;for(L=0;L<4;++L)N+=Math.pow(h[4*z+L],2),j+=Math.pow(h[4*P+L],2);D[z]/=Math.sqrt(N),O[P]/=Math.sqrt(j),u.axes[0]=D,u.axes[1]=O,u.fragClipBounds[0]=M(b,S[0],C,-1e8),u.fragClipBounds[1]=M(b,S[1],C,1e8),e.vao.draw(l.TRIANGLES,e.vertexCount),e.lineWidth>0&&(l.lineWidth(e.lineWidth),e.vao.draw(l.LINES,e.lineVertexCount,e.vertexCount))}}var T=[[-1e8,-1e8,-1e8],[1e8,1e8,1e8]];function S(t,e,r,n,i,a){var o=r.gl;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||c,s.view=n.view||c,s.projection=n.projection||c,d[0]=2/o.drawingBufferWidth,d[1]=2/o.drawingBufferHeight,s.screenSize=d,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=T,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(o.TRIANGLES,r.vertexCount),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}A(e,r,n,i),r.vao.unbind()}p.draw=function(t){S(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},p.drawTransparent=function(t){S(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},p.drawPick=function(t){S(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,this.pickProjectShader,this,t,!1,!0)},p.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||e<0)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;i<3;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},p.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]},p.update=function(t){if("perspective"in(t=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{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],s=[1/0,1/0,1/0],c=[-1/0,-1/0,-1/0],u=t.glyph,f=t.color,h=t.size,p=t.angle,d=t.lineColor,g=0,m=0,v=0,y=n.length;t:for(var x=0;x0&&(L[0]=-o[0]*(1+M[0][0]));var q=w.cells,H=w.positions;for(_=0;_0){var v=r*u;o.drawBox(f-v,h-v,p+v,h+v,a),o.drawBox(f-v,d-v,p+v,d+v,a),o.drawBox(f-v,h-v,f+v,d+v,a),o.drawBox(p-v,h-v,p+v,d+v,a)}}}},s.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()},s.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)}},{"./lib/shaders":265,"gl-buffer":211,"gl-shader":268}],267:[function(t,e,r){"use strict";e.exports=function(t,e){var r=n(t,e),a=i.mallocUint8(e[0]*e[1]*4);return new l(t,r,a)};var n=t("gl-fbo"),i=t("typedarray-pool"),a=t("ndarray"),o=t("bit-twiddle").nextPow2,s=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(_inline_16_arg0_<255||_inline_16_arg1_<255||_inline_16_arg2_<255||_inline_16_arg3_<255){var _inline_16_l=_inline_16_arg4_-_inline_16_arg6_[0],_inline_16_a=_inline_16_arg5_-_inline_16_arg6_[1],_inline_16_f=_inline_16_l*_inline_16_l+_inline_16_a*_inline_16_a;_inline_16_fthis.buffer.length){i.free(this.buffer);for(var n=this.buffer=i.mallocUint8(o(r*e*4)),a=0;ar)for(t=r;te)for(t=e;t=0){for(var k=0|w.type.charAt(w.type.length-1),M=new Array(k),A=0;A=0;)T+=1;_[y]=T}var S=new Array(r.length);function C(){h.program=o.program(p,h._vref,h._fref,b,_);for(var t=0;t=0){var d=h.charCodeAt(h.length-1)-48;if(d<2||d>4)throw new n("","Invalid data type for attribute "+f+": "+h);o(t,e,p[0],i,d,a,f)}else{if(!(h.indexOf("mat")>=0))throw new n("","Unknown data type for attribute "+f+": "+h);var d=h.charCodeAt(h.length-1)-48;if(d<2||d>4)throw new n("","Invalid data type for attribute "+f+": "+h);s(t,e,p,i,d,a,f)}}}return a};var n=t("./GLError");function i(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}var a=i.prototype;function o(t,e,r,n,a,o,s){for(var l=["gl","v"],c=[],u=0;u4)throw new i("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+a+"fv(locations["+e+"],false,obj"+t+")"}throw new i("","Unknown uniform data type for "+name+": "+r)}var a=r.charCodeAt(r.length-1)-48;if(a<2||a>4)throw new i("","Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+a+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+a+"fv(locations["+e+"],obj"+t+")";default:throw new i("","Unrecognized data type for vector "+name+": "+r)}}}function c(e){for(var n=["return function updateProperty(obj){"],i=function t(e,r){if("object"!=typeof r)return[[e,r]];var n=[];for(var i in r){var a=r[i],o=e;parseInt(i)+""===i?o+="["+i+"]":o+="."+i,"object"==typeof a?n.push.apply(n,t(o,a)):n.push([o,a])}return n}("",e),a=0;a4)throw new i("","Invalid data type");return"b"===t.charAt(0)?o(r,!1):o(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new i("","Invalid uniform dimension type for matrix "+name+": "+t);return o(r*r,0)}throw new i("","Unknown uniform data type for "+name+": "+t)}}(r[u].type);var p}function f(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var c=1;c1)for(var l=0;l 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 = max(beckmannSpecular(L, V, N, roughness), 0.);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //decide how to interpolate color \u2014 in vertex or in fragment\n vec4 surfaceColor = step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) + step(.5, vertexColor) * vColor;\n\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"]),s=i(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z = clipPosition.z + zOffset;\n\n gl_Position = clipPosition;\n value = f;\n kill = -1.0;\n worldCoordinate = dataCoordinate;\n planeCoordinate = uv.zw;\n\n vColor = texture2D(colormap, vec2(value, value));\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"]),l=i(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n"]);r.createShader=function(t){var e=n(t,a,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createPickShader=function(t){var e=n(t,a,l,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e.attributes.normal.location=2,e},r.createContourShader=function(t){var e=n(t,s,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e},r.createPickContourShader=function(t){var e=n(t,s,l,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":268,glslify:353}],279:[function(t,e,r){"use strict";e.exports=function(t){var e=t.gl,r=y(e),n=b(e),s=x(e),l=_(e),c=i(e),u=a(e,[{buffer:c,size:4,stride:w,offset:0},{buffer:c,size:3,stride:w,offset:16},{buffer:c,size:3,stride:w,offset:28}]),f=i(e),h=a(e,[{buffer:f,size:4,stride:20,offset:0},{buffer:f,size:1,stride:20,offset:16}]),p=i(e),d=a(e,[{buffer:p,size:2,type:e.FLOAT}]),g=o(e,1,T,e.RGBA,e.UNSIGNED_BYTE);g.minFilter=e.LINEAR,g.magFilter=e.LINEAR;var m=new S(e,[0,0],[[0,0,0],[0,0,0]],r,n,c,u,g,s,l,f,h,p,d),v={levels:[[],[],[]]};for(var k in t)v[k]=t[k];return v.colormap=v.colormap||"jet",m.update(v),m};var n=t("bit-twiddle"),i=t("gl-buffer"),a=t("gl-vao"),o=t("gl-texture2d"),s=t("typedarray-pool"),l=t("colormap"),c=t("ndarray-ops"),u=t("ndarray-pack"),f=t("ndarray"),h=t("surface-nets"),p=t("gl-mat4/multiply"),d=t("gl-mat4/invert"),g=t("binary-search-bounds"),m=t("ndarray-gradient"),v=t("./lib/shaders"),y=v.createShader,x=v.createContourShader,b=v.createPickShader,_=v.createPickContourShader,w=40,k=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],M=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],A=[[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;t<3;++t){var e=A[t],r=(t+2)%3;e[(t+1)%3+0]=1,e[r+3]=1,e[t+6]=1}}();var T=256;function S(t,e,r,n,i,a,o,l,c,u,h,p,d,g){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=n,this._pickShader=i,this._coordinateBuffer=a,this._vao=o,this._colorMap=l,this._contourShader=c,this._contourPickShader=u,this._contourBuffer=h,this._contourVAO=p,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new function(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=d,this._dynamicVAO=g,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=[f(s.mallocFloat(1024),[0,0]),f(s.mallocFloat(1024),[0,0]),f(s.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.vertexColor=0,this.dirty=!0}var C=S.prototype;C.isTransparent=function(){return this.opacity<1},C.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},C.pickSlots=1,C.setPickBase=function(t){this.pickId=t};var E=[0,0,0],L={showSurface:!1,showContour:!1,projections:[k.slice(),k.slice(),k.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function z(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||E,o=e.showSurface,s=e.showContour;for(r=0;r<3;++r)for(o=o||e.surfaceProject[r],n=0;n<3;++n)s=s||e.contourProject[r][n];for(r=0;r<3;++r){var l=L.projections[r];for(n=0;n<16;++n)l[n]=0;for(n=0;n<4;++n)l[5*n]=1;l[5*r]=0,l[12+r]=e.axesBounds[+(a[r]>0)][r],p(l,t.model,l);var c=L.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)c[i][n]=t.clipBounds[i][n];c[0][r]=-1e8,c[1][r]=1e8}return L.showSurface=o,L.showContour=s,L}var P={model:k,view:k,projection:k,inverseModel:k.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,vertexColor:0},D=k.slice(),O=[1,0,0,0,1,0,0,0,1];function I(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=P;n.model=t.model||k,n.view=t.view||k,n.projection=t.projection||k,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=d(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],o=0;o<3;++o)a[o]=Math.min(Math.max(this.clipBounds[i][o],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=O,n.vertexColor=this.vertexColor;var s=D;for(p(s,n.view,n.model),p(s,n.projection,s),d(s,s),i=0;i<3;++i)n.eyePosition[i]=s[12+i]/s[15];var l=s[15];for(i=0;i<3;++i)l+=this.lightPosition[i]*s[4*i+3];for(i=0;i<3;++i){var c=s[12+i];for(o=0;o<3;++o)c+=s[4*o+i]*this.lightPosition[o];n.lightPosition[i]=c/l}var u=z(n,this);if(u.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;i<3;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=u.projections[i],this._shader.uniforms.clipBounds=u.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(u.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var h=this._contourVAO;for(h.bind(),i=0;i<3;++i)for(f.uniforms.permutation=A[i],r.lineWidth(this.contourWidth[i]),o=0;o>4)/16)/255,i=Math.floor(n),a=n-i,o=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(o),l=o-s;i+=1,s+=1;var c=r.position;c[0]=c[1]=c[2]=0;for(var u=0;u<2;++u)for(var f=u?a:1-a,h=0;h<2;++h)for(var p=i+u,d=s+h,m=f*(h?l:1-l),v=0;v<3;++v)c[v]+=this._field[v].get(p,d)*m;for(var y=this._pickResult.level,x=0;x<3;++x)if(y[x]=g.le(this.contourLevels[x],c[x]),y[x]<0)this.contourLevels[x].length>0&&(y[x]=0);else if(y[x]Math.abs(_-c[x])&&(y[x]+=1)}for(r.index[0]=a<.5?i:i+1,r.index[1]=l<.5?s:s+1,r.uv[0]=n/e[0],r.uv[1]=o/e[1],v=0;v<3;++v)r.dataCoordinate[v]=this._field[v].get(r.index[0],r.index[1]);return r},C.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=F(t.contourWidth,Number)),"showContour"in t&&(this.showContour=F(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=F(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=j(t.contourColor)),"contourProject"in t&&(this.contourProject=F(t.contourProject,function(t){return F(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=j(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=F(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=F(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"vertexColor"in t&&(this.vertexColor=t.vertexColor?1:0);var e=t.field||t.coords&&t.coords[2]||null,r=!1;if(e||(e=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in t||"coords"in t){var i=(e.shape[0]+2)*(e.shape[1]+2);i>this._field[2].data.length&&(s.freeFloat(this._field[2].data),this._field[2].data=s.mallocFloat(n.nextPow2(i))),this._field[2]=f(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),B(this._field[2],e),this.shape=e.shape.slice();for(var a=this.shape,o=0;o<2;++o)this._field[2].size>this._field[o].data.length&&(s.freeFloat(this._field[o].data),this._field[o].data=s.mallocFloat(this._field[2].size)),this._field[o]=f(this._field[o].data,[a[0]+2,a[1]+2]);if(t.coords){var p=t.coords;if(!Array.isArray(p)||3!==p.length)throw new Error("gl-surface: invalid coordinates for x/y");for(o=0;o<2;++o){var d=p[o];for(b=0;b<2;++b)if(d.shape[b]!==a[b])throw new Error("gl-surface: coords have incorrect shape");B(this._field[o],d)}}else if(t.ticks){var g=t.ticks;if(!Array.isArray(g)||2!==g.length)throw new Error("gl-surface: invalid ticks");for(o=0;o<2;++o){var v=g[o];if((Array.isArray(v)||v.length)&&(v=f(v)),v.shape[0]!==a[o])throw new Error("gl-surface: invalid tick length");var y=f(v.data,a);y.stride[o]=v.stride[0],y.stride[1^o]=0,B(this._field[o],y)}}else{for(o=0;o<2;++o){var x=[0,0];x[o]=1,this._field[o]=f(this._field[o].data,[a[0]+2,a[1]+2],x,0)}this._field[0].set(0,0,0);for(var b=0;b0){for(var kt=0;kt<5;++kt)nt.pop();W-=1}continue t}nt.push(st[0],st[1],ut[0],ut[1],st[2]),W+=1}}ot.push(W)}this._contourOffsets[it]=at,this._contourCounts[it]=ot}var Mt=s.mallocFloat(nt.length);for(o=0;os||o[1]<0||o[1]>s)throw new Error("gl-texture2d: Invalid texture size");var l=d(o,e.stride.slice()),c=0;"float32"===r?c=t.FLOAT:"float64"===r?(c=t.FLOAT,l=!1,r="float32"):"uint8"===r?c=t.UNSIGNED_BYTE:(c=t.UNSIGNED_BYTE,l=!1,r="uint8");var f,p,m=0;if(2===o.length)m=t.LUMINANCE,o=[o[0],o[1],1],e=n(e.data,o,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==o.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===o[2])m=t.ALPHA;else if(2===o[2])m=t.LUMINANCE_ALPHA;else if(3===o[2])m=t.RGB;else{if(4!==o[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");m=t.RGBA}}c!==t.FLOAT||t.getExtension("OES_texture_float")||(c=t.UNSIGNED_BYTE,l=!1);var v=e.size;if(l)f=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var y=[o[2],o[2]*o[0],1];p=a.malloc(v,r);var x=n(p,o,y,0);"float32"!==r&&"float64"!==r||c!==t.UNSIGNED_BYTE?i.assign(x,e):u(x,e),f=p.subarray(0,v)}var b=g(t);t.texImage2D(t.TEXTURE_2D,0,m,o[0],o[1],0,m,c,f),l||a.free(p);return new h(t,b,o[0],o[1],m,c)}(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")};var o=null,s=null,l=null;function c(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement||"undefined"!=typeof ImageData&&t instanceof ImageData}var u=function(t,e){i.muls(t,e,255)};function f(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||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 h(t,e,r,n,i,a){this.gl=t,this.handle=e,this.format=i,this.type=a,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 o=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return o._wrapS},set:function(t){return o.wrapS=t}},{get:function(){return o._wrapT},set:function(t){return o.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return o._shape[0]},set:function(t){return o.width=t}},{get:function(){return o._shape[1]},set:function(t){return o.height=t}}]),this._shapeVector=l}var p=h.prototype;function d(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 g(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 m(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||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 o=g(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new h(t,o,e,r,n,i)}Object.defineProperties(p,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&o.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),s.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&&o.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),s.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=this.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(),l.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(),l.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;e<2;++e)if(l.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 f(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return f(this,t|=0,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,f(this,this._shape[0],t),t}}}),p.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},p.dispose=function(){this.gl.deleteTexture(this.handle)},p.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)},p.setPixels=function(t,e,r,o){var s=this.gl;this.bind(),Array.isArray(e)?(o=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),o=o||0;var l=c(t)?t:t.raw;if(l){this._mipLevels.indexOf(o)<0?(s.texImage2D(s.TEXTURE_2D,0,this.format,this.format,this.type,l),this._mipLevels.push(o)):s.texSubImage2D(s.TEXTURE_2D,o,e,r,this.format,this.type,l)}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]>>>o||r+t.shape[0]>this._shape[0]>>>o||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");!function(t,e,r,o,s,l,c,f){var h=f.dtype,p=f.shape.slice();if(p.length<2||p.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var g=0,m=0,v=d(p,f.stride.slice());"float32"===h?g=t.FLOAT:"float64"===h?(g=t.FLOAT,v=!1,h="float32"):"uint8"===h?g=t.UNSIGNED_BYTE:(g=t.UNSIGNED_BYTE,v=!1,h="uint8");if(2===p.length)m=t.LUMINANCE,p=[p[0],p[1],1],f=n(f.data,p,[f.stride[0],f.stride[1],1],f.offset);else{if(3!==p.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===p[2])m=t.ALPHA;else if(2===p[2])m=t.LUMINANCE_ALPHA;else if(3===p[2])m=t.RGB;else{if(4!==p[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");m=t.RGBA}p[2]}m!==t.LUMINANCE&&m!==t.ALPHA||s!==t.LUMINANCE&&s!==t.ALPHA||(m=s);if(m!==s)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=f.size,x=c.indexOf(o)<0;x&&c.push(o);if(g===l&&v)0===f.offset&&f.data.length===y?x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,f.data):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,f.data):x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,f.data.subarray(f.offset,f.offset+y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,f.data.subarray(f.offset,f.offset+y));else{var b;b=l===t.FLOAT?a.mallocFloat32(y):a.mallocUint8(y);var _=n(b,p,[p[2],p[2]*p[0],1]);g===t.FLOAT&&l===t.UNSIGNED_BYTE?u(_,f):i.assign(_,f),x?t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,b.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,b.subarray(0,y)),l===t.FLOAT?a.freeFloat32(b):a.freeUint8(b)}}(s,e,r,o,this.format,this.type,this._mipLevels,t)}}},{ndarray:393,"ndarray-ops":387,"typedarray-pool":481}],281:[function(t,e,r){"use strict";e.exports=function(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;i1?0:Math.acos(s)};var n=t("./fromValues"),i=t("./normalize"),a=t("./dot")},{"./dot":293,"./fromValues":295,"./normalize":304}],287:[function(t,e,r){e.exports=function(t){var e=new Float32Array(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}},{}],288:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}},{}],289:[function(t,e,r){e.exports=function(){var t=new Float32Array(3);return t[0]=0,t[1]=0,t[2]=0,t}},{}],290:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2];return t[0]=i*l-a*s,t[1]=a*o-n*l,t[2]=n*s-i*o,t}},{}],291:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(r*r+n*n+i*i)}},{}],292:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}},{}],293:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}},{}],294:[function(t,e,r){e.exports=function(t,e,r,i,a,o){var s,l;e||(e=3);r||(r=0);l=i?Math.min(i*e+r,t.length):t.length;for(s=r;s0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a);return t}},{}],305:[function(t,e,r){e.exports=function(t,e){e=e||1;var r=2*Math.random()*Math.PI,n=2*Math.random()-1,i=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*i,t[1]=Math.sin(r)*i,t[2]=n*e,t}},{}],306:[function(t,e,r){e.exports=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t}},{}],307:[function(t,e,r){e.exports=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t}},{}],308:[function(t,e,r){e.exports=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t}},{}],309:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}},{}],310:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}},{}],311:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}},{}],312:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i}},{}],313:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}},{}],314:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}},{}],315:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2];return t[0]=n*r[0]+i*r[3]+a*r[6],t[1]=n*r[1]+i*r[4]+a*r[7],t[2]=n*r[2]+i*r[5]+a*r[8],t}},{}],316:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,t[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,t[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,t}},{}],317:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],c=r[3],u=c*n+s*a-l*i,f=c*i+l*n-o*a,h=c*a+o*i-s*n,p=-o*n-s*i-l*a;return t[0]=u*c+p*-o+f*-l-h*-s,t[1]=f*c+p*-s+h*-o-u*-l,t[2]=h*c+p*-l+u*-s-f*-o,t}},{}],318:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t}},{}],319:[function(t,e,r){e.exports=function(t){var e=new Float32Array(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}},{}],320:[function(t,e,r){e.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}},{}],321:[function(t,e,r){e.exports=function(){var t=new Float32Array(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}},{}],322:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return Math.sqrt(r*r+n*n+i*i+a*a)}},{}],323:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t[3]=e[3]/r[3],t}},{}],324:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}},{}],325:[function(t,e,r){e.exports=function(t,e,r,n){var i=new Float32Array(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}},{}],326:[function(t,e,r){e.exports={create:t("./create"),clone:t("./clone"),fromValues:t("./fromValues"),copy:t("./copy"),set:t("./set"),add:t("./add"),subtract:t("./subtract"),multiply:t("./multiply"),divide:t("./divide"),min:t("./min"),max:t("./max"),scale:t("./scale"),scaleAndAdd:t("./scaleAndAdd"),distance:t("./distance"),squaredDistance:t("./squaredDistance"),length:t("./length"),squaredLength:t("./squaredLength"),negate:t("./negate"),inverse:t("./inverse"),normalize:t("./normalize"),dot:t("./dot"),lerp:t("./lerp"),random:t("./random"),transformMat4:t("./transformMat4"),transformQuat:t("./transformQuat")}},{"./add":318,"./clone":319,"./copy":320,"./create":321,"./distance":322,"./divide":323,"./dot":324,"./fromValues":325,"./inverse":327,"./length":328,"./lerp":329,"./max":330,"./min":331,"./multiply":332,"./negate":333,"./normalize":334,"./random":335,"./scale":336,"./scaleAndAdd":337,"./set":338,"./squaredDistance":339,"./squaredLength":340,"./subtract":341,"./transformMat4":342,"./transformQuat":343}],327:[function(t,e,r){e.exports=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t}},{}],328:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)}},{}],329:[function(t,e,r){e.exports=function(t,e,r,n){var i=e[0],a=e[1],o=e[2],s=e[3];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t[3]=s+n*(r[3]-s),t}},{}],330:[function(t,e,r){e.exports=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}},{}],331:[function(t,e,r){e.exports=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}},{}],332:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t[3]=e[3]*r[3],t}},{}],333:[function(t,e,r){e.exports=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}},{}],334:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*r+n*n+i*i+a*a;o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=a*o);return t}},{}],335:[function(t,e,r){var n=t("./normalize"),i=t("./scale");e.exports=function(t,e){return e=e||1,t[0]=Math.random(),t[1]=Math.random(),t[2]=Math.random(),t[3]=Math.random(),n(t,t),i(t,t,e),t}},{"./normalize":334,"./scale":336}],336:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}},{}],337:[function(t,e,r){e.exports=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t[3]=e[3]+r[3]*n,t}},{}],338:[function(t,e,r){e.exports=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}},{}],339:[function(t,e,r){e.exports=function(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2],a=e[3]-t[3];return r*r+n*n+i*i+a*a}},{}],340:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}},{}],341:[function(t,e,r){e.exports=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t[3]=e[3]-r[3],t}},{}],342:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,t[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,t[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,t[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,t}},{}],343:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=r[0],s=r[1],l=r[2],c=r[3],u=c*n+s*a-l*i,f=c*i+l*n-o*a,h=c*a+o*i-s*n,p=-o*n-s*i-l*a;return t[0]=u*c+p*-o+f*-l-h*-s,t[1]=f*c+p*-s+h*-o-u*-l,t[2]=h*c+p*-l+u*-s-f*-o,t[3]=e[3],t}},{}],344:[function(t,e,r){e.exports=function(t,e,r,a){return n[0]=a,n[1]=r,n[2]=e,n[3]=t,i[0]};var n=new Uint8Array(4),i=new Float32Array(n.buffer)},{}],345:[function(t,e,r){var n=t("glsl-tokenizer"),i=t("atob-lite");e.exports=function(t){for(var e=Array.isArray(t)?t:n(t),r=0;r0)continue;r=t.slice(0,1).join("")}return B(r),z+=r.length,(S=S.slice(r.length)).length}}function H(){return/[^a-fA-F0-9]/.test(e)?(B(S.join("")),T=l,M):(S.push(e),r=e,M+1)}function G(){return"."===e?(S.push(e),T=g,r=e,M+1):/[eE]/.test(e)?(S.push(e),T=g,r=e,M+1):"x"===e&&1===S.length&&"0"===S[0]?(T=_,S.push(e),r=e,M+1):/[^\d]/.test(e)?(B(S.join("")),T=l,M):(S.push(e),r=e,M+1)}function W(){return"f"===e&&(S.push(e),r=e,M+=1),/[eE]/.test(e)?(S.push(e),r=e,M+1):"-"===e&&/[eE]/.test(r)?(S.push(e),r=e,M+1):/[^\d]/.test(e)?(B(S.join("")),T=l,M):(S.push(e),r=e,M+1)}function Y(){if(/[^\d\w_]/.test(e)){var t=S.join("");return T=R.indexOf(t)>-1?y:I.indexOf(t)>-1?v:m,B(S.join("")),T=l,M}return S.push(e),r=e,M+1}};var n=t("./lib/literals"),i=t("./lib/operators"),a=t("./lib/builtins"),o=t("./lib/literals-300es"),s=t("./lib/builtins-300es"),l=999,c=9999,u=0,f=1,h=2,p=3,d=4,g=5,m=6,v=7,y=8,x=9,b=10,_=11,w=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":348,"./lib/builtins-300es":347,"./lib/literals":350,"./lib/literals-300es":349,"./lib/operators":351}],347:[function(t,e,r){var n=t("./builtins");n=n.slice().filter(function(t){return!/^(gl\_|texture)/.test(t)}),e.exports=n.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},{"./builtins":348}],348:[function(t,e,r){e.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]},{}],349:[function(t,e,r){var n=t("./literals");e.exports=n.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"])},{"./literals":350}],350:[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"]},{}],351:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],352:[function(t,e,r){var n=t("./index");e.exports=function(t,e){var r=n(e),i=[];return i=(i=i.concat(r(t))).concat(r(null))}},{"./index":346}],353:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n>1,u=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=256*a+t[e+f],f+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+t[e+f],f+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=c}return(p?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,c=8*a-i-1,u=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+f>=1?h/l:h*Math.pow(2,1-f))*l>=2&&(o++,l/=2),o+f>=u?(s=0,o=u):o+f>=1?(s=(e*l-1)*Math.pow(2,i),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,c-=8);t[r+p-d]|=128*g}},{}],357:[function(t,e,r){"use strict";e.exports=function(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(r<=i)throw new Error("Must input at least d+1 points");var o=t.slice(0,i+1),s=n.apply(void 0,o);if(0===s)throw new Error("Input not in general position");for(var l=new Array(i+1),u=0;u<=i;++u)l[u]=u;s<0&&(l[0]=1,l[1]=0);for(var f=new a(l,new Array(i+1),!1),h=f.adjacent,p=new Array(i+2),u=0;u<=i;++u){for(var d=l.slice(),g=0;g<=i;++g)g===u&&(d[g]=-1);var m=d[0];d[0]=d[1],d[1]=m;var v=new a(d,new Array(i+1),!0);h[u]=v,p[u]=v}p[i+1]=f;for(var u=0;u<=i;++u)for(var d=h[u].vertices,y=h[u].adjacent,g=0;g<=i;++g){var x=d[g];if(x<0)y[g]=f;else for(var b=0;b<=i;++b)h[b].vertices.indexOf(x)<0&&(y[g]=h[b])}for(var _=new c(i,o,p),w=!!e,u=i+1;u0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var i=new Function("test",e.join("")),a=n[t+1];return a||(a=n),i(a)}(t)),this.orient=a}var u=c.prototype;u.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,a=this.vertices,o=[t];for(t.lastVisited=-n;o.length>0;){(t=o.pop()).vertices;for(var s=t.adjacent,l=0;l<=r;++l){var c=s[l];if(c.boundary&&!(c.lastVisited<=-n)){for(var u=c.vertices,f=0;f<=r;++f){var h=u[f];i[f]=h<0?e:a[h]}var p=this.orient();if(p>0)return c;c.lastVisited=-n,0===p&&o.push(c)}}}return null},u.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,a=this.tuple,o=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[o];t:for(;!s.boundary;){for(var l=s.vertices,c=s.adjacent,u=0;u<=n;++u)a[u]=i[l[u]];s.lastVisited=r;for(u=0;u<=n;++u){var f=c[u];if(!(f.lastVisited>=r)){var h=a[u];a[u]=t;var p=this.orient();if(a[u]=h,p<0){s=f;continue t}f.boundary?f.lastVisited=-r:f.lastVisited=r}}return}return s},u.addPeaks=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,l=this.tuple,c=this.interior,u=this.simplices,f=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,c.push(e);for(var h=[];f.length>0;){var p=(e=f.pop()).vertices,d=e.adjacent,g=p.indexOf(r);if(!(g<0))for(var m=0;m<=n;++m)if(m!==g){var v=d[m];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.lastVisited!==-r){for(var x=0,b=0;b<=n;++b)y[b]<0?(x=b,l[b]=t):l[b]=i[y[b]];if(this.orient()>0){y[x]=r,v.boundary=!1,c.push(v),f.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var _=v.adjacent,w=p.slice(),k=d.slice(),M=new a(w,k,!0);u.push(M);var A=_.indexOf(e);if(!(A<0)){_[A]=M,k[g]=v,w[m]=-1,k[m]=e,d[m]=M,M.flip();for(b=0;b<=n;++b){var T=w[b];if(!(T<0||T===r)){for(var S=new Array(n-1),C=0,E=0;E<=n;++E){var L=w[E];L<0||E===b||(S[C++]=L)}h.push(new o(S,M,b))}}}}}}h.sort(s);for(m=0;m+1=0?o[l++]=s[u]:c=1&u;if(c===(1&t)){var f=o[0];o[0]=o[1],o[1]=f}e.push(o)}}return e}},{"robust-orientation":446,"simplicial-complex":456}],358:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),i=0,a=1;function o(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}e.exports=function(t){if(!t||0===t.length)return new x(null);return new x(y(t))};var s=o.prototype;function l(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 c(t,e){var r=y(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 u(t,e){var r=t.intervals([]);r.push(e),c(t,r)}function f(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?i:(r.splice(n,1),c(t,r),a)}function h(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function d(t,e){for(var r=0;r>1],i=[],a=[],s=[];for(r=0;r3*(e+1)?u(this,t):this.left.insert(t):this.left=y([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?u(this,t):this.right.insert(t):this.right=y([t]);else{var r=n.ge(this.leftPoints,t,m),i=n.ge(this.rightPoints,t,v);this.leftPoints.splice(r,0,t),this.rightPoints.splice(i,0,t)}},s.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?f(this,t):2===(c=this.left.remove(t))?(this.left=null,this.count-=1,a):(c===a&&(this.count-=1),c):i}else{if(!(t[0]>this.mid)){if(1===this.count)return this.leftPoints[0]===t?2:i;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,o=this.left;o.right;)r=o,o=o.right;if(r===this)o.right=this.right;else{var s=this.left;c=this.right;r.count-=o.count,r.right=o.left,o.left=s,o.right=c}l(this,o),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?l(this,this.left):l(this,this.right);return a}for(s=n.ge(this.leftPoints,t,m);s3*(e-1)?f(this,t):2===(c=this.right.remove(t))?(this.right=null,this.count-=1,a):(c===a&&(this.count-=1),c):i;var c}},s.queryPoint=function(t,e){if(tthis.mid){var r;if(this.right)if(r=this.right.queryPoint(t,e))return r;return p(this.rightPoints,t,e)}return d(this.leftPoints,e)},s.queryInterval=function(t,e,r){var n;if(tthis.mid&&this.right&&(n=this.right.queryInterval(t,e,r)))return n;return ethis.mid?p(this.rightPoints,t,r):d(this.leftPoints,r)};var b=x.prototype;b.insert=function(t){this.root?this.root.insert(t):this.root=new o(t[0],null,null,[t],[t])},b.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==i}return!1},b.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},b.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(b,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(b,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":73}],359:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;r4))}},{}],368:[function(t,e,r){e.exports=function(t,e,r){return t*(1-r)+e*r}},{}],369:[function(t,e,r){(function(n){"use strict";!function(t){"object"==typeof r&&void 0!==e?e.exports=t():("undefined"!=typeof window?window:void 0!==n?n:"undefined"!=typeof self?self:this).mapboxgl=t()}(function(){return function e(r,n,i){function a(s,l){if(!n[s]){if(!r[s]){var c="function"==typeof t&&t;if(!l&&c)return c(s,!0);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[s]={exports:{}};r[s][0].call(f.exports,function(t){var e=r[s][1][t];return a(e||t)},f,f.exports,e,r,n,i)}return n[s].exports}for(var o="function"==typeof t&&t,s=0;s0){e+=Math.abs(i(t[0]));for(var r=1;r2){for(l=0;li.maxh||t>i.maxw||r<=i.maxh&&t<=i.maxw&&(o=i.maxw*i.maxh-t*r)a.free)){if(r===a.h)return this.allocShelf(s,t,r,n);r>a.h||ru)&&(f=2*Math.max(t,u)),(ll)&&(c=2*Math.max(r,l)),this.resize(f,c),this.packOne(t,r,n)):null},t.prototype.allocFreebin=function(t,e,r,n){var i=this.freebins.splice(t,1)[0];return i.id=n,i.w=e,i.h=r,i.refcount=0,this.bins[n]=i,this.ref(i),i},t.prototype.allocShelf=function(t,e,r,n){var i=this.shelves[t].alloc(e,r,n);return this.bins[n]=i,this.ref(i),i},t.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,e=0,r=0;rthis.free||e>this.h)return null;var n=this.x;return this.x+=t,this.free-=t,new function(t,e,r,n,i,a,o){this.id=t,this.x=e,this.y=r,this.w=n,this.h=i,this.maxw=a||n,this.maxh=o||i,this.refcount=0}(r,n,this.y,t,e,t,this.h)},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t},"object"==typeof r&&void 0!==e?e.exports=i():n.ShelfPack=i()},{}],6:[function(t,e,r){function n(t,e,r,n,i,a){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=a||"normal",this.radius=r||8;var o=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=o,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(o*o),this.gridInner=new Float64Array(o*o),this.f=new Float64Array(o),this.d=new Float64Array(o),this.z=new Float64Array(o+1),this.v=new Int16Array(o),this.middle=Math.round(o/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function i(t,e,r,n,i,o,s){for(var l=0;ln)return n;for(;ra?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],8:[function(t,e,r){e.exports.VectorTile=t("./lib/vectortile.js"),e.exports.VectorTileFeature=t("./lib/vectortilefeature.js"),e.exports.VectorTileLayer=t("./lib/vectortilelayer.js")},{"./lib/vectortile.js":9,"./lib/vectortilefeature.js":10,"./lib/vectortilelayer.js":11}],9:[function(t,e,r){function n(t,e,r){if(3===t){var n=new i(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}var i=t("./vectortilelayer");e.exports=function(t,e){this.layers=t.readFields(n,{},e)}},{"./vectortilelayer":11}],10:[function(t,e,r){function n(t,e,r,n,a){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=a,t.readFields(i,this,e)}function i(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){for(var r=t.readVarint()+t.pos;t.pos>3}if(i--,1===n||2===n)a+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&l.push(e),e=[]),e.push(new o(a,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&l.push(e),l},n.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,a=0,o=1/0,s=-1/0,l=1/0,c=-1/0;t.pos>3}if(n--,1===r||2===r)i+=t.readSVarint(),a+=t.readSVarint(),is&&(s=i),ac&&(c=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,c]},n.prototype.toGeoJSON=function(t,e,r){function i(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}var a=t("./vectortilefeature.js");e.exports=n,n.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new a(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":10}],12:[function(t,e,r){var n;n=this,function(t){function e(t,e,n){var i=r(256*t,256*(e=Math.pow(2,n)-e-1),n),a=r(256*(t+1),256*(e+1),n);return i[0]+","+i[1]+","+a[0]+","+a[1]}function r(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}t.getURL=function(t,r,n,i,a,o){return o=o||{},t+"?"+["bbox="+e(n,i,a),"format="+(o.format||"image/png"),"service="+(o.service||"WMS"),"version="+(o.version||"1.1.1"),"request="+(o.request||"GetMap"),"srs="+(o.srs||"EPSG:3857"),"width="+(o.width||256),"height="+(o.height||256),"layers="+r].join("&")},t.getTileBBox=e,t.getMercCoords=r,Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof r&&void 0!==e?r:n.WhooTS=n.WhooTS||{})},{}],13:[function(t,e,r){function n(t){return(t=Math.round(t))<0?0:t>255?255:t}function i(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function a(t){return function(t){return t<0?0:t>1?1:t}("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function o(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}var s={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{r.parseCSSColor=function(t){var e,r=t.replace(/ /g,"").toLowerCase();if(r in s)return s[r].slice();if("#"===r[0])return 4===r.length?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===r.length&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=r.indexOf("("),c=r.indexOf(")");if(-1!==l&&c+1===r.length){var u=r.substr(0,l),f=r.substr(l+1,c-(l+1)).split(","),h=1;switch(u){case"rgba":if(4!==f.length)return null;h=a(f.pop());case"rgb":return 3!==f.length?null:[i(f[0]),i(f[1]),i(f[2]),h];case"hsla":if(4!==f.length)return null;h=a(f.pop());case"hsl":if(3!==f.length)return null;var p=(parseFloat(f[0])%360+360)%360/360,d=a(f[1]),g=a(f[2]),m=g<=.5?g*(d+1):g+d-g*d,v=2*g-m;return[n(255*o(v,m,p+1/3)),n(255*o(v,m,p)),n(255*o(v,m,p-1/3)),h];default:return null}}return null}}catch(t){}},{}],14:[function(t,e,r){function n(t,e,r){r=r||2;var n,s,l,c,u,p,g,m=e&&e.length,v=m?e[0]*r:t.length,y=i(t,0,v,r,!0),x=[];if(!y)return x;if(m&&(y=function(t,e,r,n){var o,s,l,c,u,p=[];for(o=0,s=e.length;o80*r){n=l=t[0],s=c=t[1];for(var b=r;bl&&(l=u),p>c&&(c=p);g=0!==(g=Math.max(l-n,c-s))?1/g:0}return o(y,x,r,n,s,g),x}function i(t,e,r,n,i){var a,o;if(i===A(t,e,r,n)>0)for(a=e;a=e;a-=n)o=w(a,t[a],t[a+1],o);return o&&y(o,o.next)&&(k(o),o=o.next),o}function a(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!y(n,n.next)&&0!==v(n.prev,n,n.next))n=n.next;else{if(k(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,i,f,h){if(t){!h&&f&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=p(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,l,c=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,c*=2}while(o>1)}(i)}(t,n,i,f);for(var d,g,m=t;t.prev!==t.next;)if(d=t.prev,g=t.next,f?l(t,n,i,f):s(t))e.push(d.i/r),e.push(t.i/r),e.push(g.i/r),k(t),t=g.next,m=g.next;else if((t=g)===m){h?1===h?o(t=c(t,e,r),e,r,n,i,f,2):2===h&&u(t,e,r,n,i,f):o(a(t),e,r,n,i,f,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(v(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(g(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&v(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function l(t,e,r,n){var i=t.prev,a=t,o=t.next;if(v(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,f=p(s,l,e,r,n),h=p(c,u,e,r,n),d=t.prevZ,m=t.nextZ;d&&d.z>=f&&m&&m.z<=h;){if(d!==t.prev&&d!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,m!==t.prev&&m!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&v(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;d&&d.z>=f;){if(d!==t.prev&&d!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=h;){if(m!==t.prev&&m!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&v(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function c(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!y(i,a)&&x(i,n,n.next,a)&&b(i,a)&&b(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),k(n),k(n.next),n=t=a),n=n.next}while(n!==t);return n}function u(t,e,r,n,i,s){var l=t;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&m(l,c)){var u=_(l,c);return l=a(l,l.next),u=a(u,u.next),o(l,e,r,n,i,s),void o(u,e,r,n,i,s)}c=c.next}l=l.next}while(l!==t)}function f(t,e){return t.x-e.x}function h(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=u&&i!==n.x&&g(ar.x)&&b(n,t)&&(r=n,h=l),n=n.next;return r}(t,e)){var r=_(e,t);a(r,r.next)}}function p(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function d(t){var e=t,r=t;do{e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function m(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&x(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&b(t,e)&&b(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)}function v(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function y(t,e){return t.x===e.x&&t.y===e.y}function x(t,e,r,n){return!!(y(t,e)&&y(r,n)||y(t,n)&&y(r,e))||v(t,e,r)>0!=v(t,e,n)>0&&v(r,n,t)>0!=v(r,n,e)>0}function b(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function _(t,e){var r=new M(t.i,t.x,t.y),n=new M(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function w(t,e,r,n){var i=new M(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function k(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function M(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function A(t,e,r,n){for(var i=0,a=e,o=r-n;a0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],15:[function(t,e,r){function n(t,e){return function(r){return t(r,e)}}function i(t,e){e=!!e,t[0]=a(t[0],e);for(var r=1;r=0}(t)===e?t:t.reverse()}var o=t("@mapbox/geojson-area");e.exports=function t(e,r){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.map(n(t,r)),e;case"Feature":return e.geometry=t(e.geometry,r),e;case"Polygon":case"MultiPolygon":return function(t,e){return"Polygon"===t.type?t.coordinates=i(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(n(i,e))),t}(e,r);default:return e}}},{"@mapbox/geojson-area":1}],16:[function(t,e,r){function n(t,e,r,n,i){for(var a=0;a=r&&o<=n&&(e.push(t[a]),e.push(t[a+1]),e.push(t[a+2]))}}function i(t,e,r,n,i,a){for(var c=[],u=0===i?s:l,f=0;f=r&&u(c,h,p,g,m,r):v>n?y<=n&&u(c,h,p,g,m,n):o(c,h,p,d),y=r&&(u(c,h,p,g,m,r),x=!0),y>n&&v<=n&&(u(c,h,p,g,m,n),x=!0),!a&&x&&(c.size=t.size,e.push(c),c=[])}var b=t.length-3;h=t[b],p=t[b+1],d=t[b+2],(v=0===i?h:p)>=r&&v<=n&&o(c,h,p,d),b=c.length-3,a&&b>=3&&(c[b]!==c[0]||c[b+1]!==c[1])&&o(c,c[0],c[1],c[2]),c.length&&(c.size=t.size,e.push(c))}function a(t,e,r,n,a,o){for(var s=0;s=(r/=e)&&u<=o)return t;if(l>o||u=r&&v<=o)f.push(p);else if(!(m>o||v0&&(o+=n?(i*h-f*a)/2:Math.sqrt(Math.pow(f-i,2)+Math.pow(h-a,2))),i=f,a=h}var p=e.length-3;e[2]=1,c(e,0,p,r),e[p+2]=1,e.size=Math.abs(o)}function o(t,e,r,n){for(var i=0;i1?1:r}e.exports=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var i=0;i24)throw new Error("maxZoom should be in the 0-24 range");var n=1<1&&console.time("creation"),g=this.tiles[d]=c(t,p,r,n,m,e===f.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),h)){h>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,g.numFeatures,g.numPoints,g.numSimplified),console.timeEnd("creation"));var v="z"+e;this.stats[v]=(this.stats[v]||0)+1,this.total++}if(g.source=t,a){if(e===f.maxZoom||e===a)continue;var y=1<1&&console.time("clipping");var x,b,_,w,k,M,A=.5*f.buffer/f.extent,T=.5-A,S=.5+A,C=1+A;x=b=_=w=null,k=s(t,p,r-A,r+S,0,g.minX,g.maxX),M=s(t,p,r+T,r+C,0,g.minX,g.maxX),t=null,k&&(x=s(k,p,n-A,n+S,1,g.minY,g.maxY),b=s(k,p,n+T,n+C,1,g.minY,g.maxY),k=null),M&&(_=s(M,p,n-A,n+S,1,g.minY,g.maxY),w=s(M,p,n+T,n+C,1,g.minY,g.maxY),M=null),h>1&&console.timeEnd("clipping"),u.push(x||[],e+1,2*r,2*n),u.push(b||[],e+1,2*r,2*n+1),u.push(_||[],e+1,2*r+1,2*n),u.push(w||[],e+1,2*r+1,2*n+1)}}},n.prototype.getTile=function(t,e,r){var n=this.options,a=n.extent,s=n.debug;if(t<0||t>24)return null;var l=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var u,f=t,h=e,p=r;!u&&f>0;)f--,h=Math.floor(h/2),p=Math.floor(p/2),u=this.tiles[i(f,h,p)];return u&&u.source?(s>1&&console.log("found parent tile z%d-%d-%d",f,h,p),s>1&&console.time("drilling down"),this.splitTile(u.source,f,h,p,t,e,r),s>1&&console.timeEnd("drilling down"),this.tiles[c]?o.tile(this.tiles[c],a):null):null}},{"./clip":16,"./convert":17,"./tile":21,"./transform":22,"./wrap":23}],20:[function(t,e,r){function n(t,e,r,n,i,a){var o=i-r,s=a-n;if(0!==o||0!==s){var l=((t-r)*o+(e-n)*s)/(o*o+s*s);l>1?(r=i,n=a):l>0&&(r+=o*l,n+=s*l)}return(o=t-r)*o+(s=e-n)*s}e.exports=function t(e,r,i,a){for(var o,s=a,l=e[r],c=e[r+1],u=e[i],f=e[i+1],h=r+3;hs&&(o=h,s=p)}s>a&&(o-r>3&&t(e,r,o,a),e[o+2]=s,i-o>3&&t(e,o,i,a))}},{}],21:[function(t,e,r){function n(t,e,r,n){var a=e.geometry,o=e.type,s=[];if("Point"===o||"MultiPoint"===o)for(var l=0;ls)&&(r.numSimplified++,l.push(e[c]),l.push(e[c+1])),r.numPoints++;a&&function(t,e){for(var r=0,n=0,i=t.length,a=i-2;n0===e)for(n=0,i=t.length;ns.maxX&&(s.maxX=f),h>s.maxY&&(s.maxY=h)}return s}},{}],22:[function(t,e,r){function n(t,e,r,n,i,a){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-a))]}r.tile=function(t,e){if(t.transformed)return t;var r,i,a,o=t.z2,s=t.x,l=t.y;for(r=0;r=c[h+0]&&n>=c[h+1]?(o[f]=!0,a.push(l[f])):o[f]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,a,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),c=this._convertToCellCoord(r),u=this._convertToCellCoord(n),f=s;f<=c;f++)for(var h=l;h<=u;h++){var p=this.d*h+f;if(i.call(this,t,e,r,n,p,a,o))return}},n.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},n.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,r=0,n=0;n>1,u=-7,f=r?i-1:0,h=r?-1:1,p=t[e+f];for(f+=h,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=256*a+t[e+f],f+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+t[e+f],f+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=c}return(p?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,c=8*a-i-1,u=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+f>=1?h/l:h*Math.pow(2,1-f))*l>=2&&(o++,l/=2),o+f>=u?(s=0,o=u):o+f>=1?(s=(e*l-1)*Math.pow(2,i),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,c-=8);t[r+p-d]|=128*g}},{}],26:[function(t,e,r){function n(t,e,r,n,s){e=e||i,r=r||a,s=s||Array,this.nodeSize=n||64,this.points=t,this.ids=new s(t.length),this.coords=new s(2*t.length);for(var l=0;l=r&&s<=i&&l>=n&&l<=a&&u.push(t[d]);else{var g=Math.floor((p+h)/2);s=e[2*g],l=e[2*g+1],s>=r&&s<=i&&l>=n&&l<=a&&u.push(t[g]);var m=(f+1)%2;(0===f?r<=s:n<=l)&&(c.push(p),c.push(g-1),c.push(m)),(0===f?i>=s:a>=l)&&(c.push(g+1),c.push(h),c.push(m))}}return u}},{}],28:[function(t,e,r){function n(t,e,r,n){i(t,r,n),i(e,2*r,2*n),i(e,2*r+1,2*n+1)}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=function t(e,r,i,a,o,s){if(!(o-a<=i)){var l=Math.floor((a+o)/2);(function t(e,r,i,a,o,s){for(;o>a;){if(o-a>600){var l=o-a+1,c=i-a+1,u=Math.log(l),f=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1);t(e,r,i,Math.max(a,Math.floor(i-c*f/l+h)),Math.min(o,Math.floor(i+(l-c)*f/l+h)),s)}var p=r[2*i+s],d=a,g=o;for(n(e,r,a,i),r[2*o+s]>p&&n(e,r,a,o);dp;)g--}r[2*a+s]===p?n(e,r,a,g):n(e,r,++g,o),g<=i&&(a=g+1),i<=g&&(o=g-1)}})(e,r,l,a,o,s%2),t(e,r,i,a,l-1,s+1),t(e,r,i,l+1,o,s+1)}}},{}],29:[function(t,e,r){function n(t,e,r,n){var i=t-r,a=e-n;return i*i+a*a}e.exports=function(t,e,r,i,a,o){for(var s=[0,t.length-1,0],l=[],c=a*a;s.length;){var u=s.pop(),f=s.pop(),h=s.pop();if(f-h<=o)for(var p=h;p<=f;p++)n(e[2*p],e[2*p+1],r,i)<=c&&l.push(t[p]);else{var d=Math.floor((h+f)/2),g=e[2*d],m=e[2*d+1];n(g,m,r,i)<=c&&l.push(t[d]);var v=(u+1)%2;(0===u?r-a<=g:i-a<=m)&&(s.push(h),s.push(d-1),s.push(v)),(0===u?r+a>=g:i+a>=m)&&(s.push(d+1),s.push(f),s.push(v))}}return l}},{}],30:[function(t,e,r){function n(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}function i(t){return t.type===n.Bytes?t.readVarint()+t.pos:t.pos+1}function a(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function o(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function s(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function y(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}e.exports=n;var x=t("ieee754");n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;n.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,a=this.pos;this.type=7&n,t(i,e,this),this.pos===a&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=m(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=y(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=m(this.buf,this.pos)+4294967296*m(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=m(this.buf,this.pos)+4294967296*y(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=x.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=x.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(n=(112&(i=o[r.pos++]))>>4,i<128)return a(t,n,e);if(n|=(127&(i=o[r.pos++]))<<3,i<128)return a(t,n,e);if(n|=(127&(i=o[r.pos++]))<<10,i<128)return a(t,n,e);if(n|=(127&(i=o[r.pos++]))<<17,i<128)return a(t,n,e);if(n|=(127&(i=o[r.pos++]))<<24,i<128)return a(t,n,e);if(n|=(1&(i=o[r.pos++]))<<31,i<128)return a(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,r){for(var n="",i=e;i239?4:l>223?3:l>191?2:1;if(i+u>r)break;1===u?l<128&&(c=l):2===u?128==(192&(a=t[i+1]))&&(c=(31&l)<<6|63&a)<=127&&(c=null):3===u?(a=t[i+1],o=t[i+2],128==(192&a)&&128==(192&o)&&((c=(15&l)<<12|(63&a)<<6|63&o)<=2047||c>=55296&&c<=57343)&&(c=null)):4===u&&(a=t[i+1],o=t[i+2],s=t[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&((c=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||c>=1114112)&&(c=null)),null===c?(c=65533,u=1):c>65535&&(c-=65536,n+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),n+=String.fromCharCode(c),i+=u}return n}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var r=i(this);for(t=t||[];this.pos127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,a=0;a55295&&n<57344){if(!i){n>56319||a+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&o(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),x.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),x.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&o(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,n.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,s,e)},writePackedSVarint:function(t,e){this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){this.writeMessage(t,f,e)},writePackedFloat:function(t,e){this.writeMessage(t,c,e)},writePackedDouble:function(t,e){this.writeMessage(t,u,e)},writePackedFixed32:function(t,e){this.writeMessage(t,h,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,p,e)},writePackedFixed64:function(t,e){this.writeMessage(t,d,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,g,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},{ieee754:25}],31:[function(t,e,r){function n(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function i(t,e){return te?1:0}e.exports=function t(e,r,a,o,s){for(a=a||0,o=o||e.length-1,s=s||i;o>a;){if(o-a>600){var l=o-a+1,c=r-a+1,u=Math.log(l),f=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1);t(e,r,Math.max(a,Math.floor(r-c*f/l+h)),Math.min(o,Math.floor(r+(l-c)*f/l+h)),s)}var p=e[r],d=a,g=o;for(n(e,a,r),s(e[o],p)>0&&n(e,a,o);d0;)g--}0===s(e[a],p)?n(e,a,g):n(e,++g,o),g<=r&&(a=g+1),r<=g&&(o=g-1)}}},{}],32:[function(t,e,r){function n(t){this.options=u(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function i(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:n,properties:i,parentId:-1,numPoints:r}}function a(t,e){var r=t.geometry.coordinates;return{x:l(r[0]),y:c(r[1]),zoom:1/0,id:e,parentId:-1}}function o(t){return{type:"Feature",properties:s(t),geometry:{type:"Point",coordinates:[function(t){return 360*(t-.5)}(t.x),function(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}(t.y)]}}}function s(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return u(u({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function l(t){return t/360+.5}function c(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function u(t,e){for(var r in e)t[r]=e[r];return t}function f(t){return t.x}function h(t){return t.y}var p=t("kdbush");e.exports=function(t){return new n(t)},n.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,reduce:null,initial:function(){return{}},map:function(t){return t}},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(a);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var o=+Date.now();this.trees[i+1]=p(n,f,h,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-o)}return this.trees[this.options.minZoom]=p(n,f,h,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(l(t[0]),c(t[3]),l(t[2]),c(t[1])),i=[],a=0;a0)for(var r=this.length>>1;r>=0;r--)this._down(r)}function i(t,e){return te?1:0}e.exports=n,n.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,a=e[i];if(r(n,a)>=0)break;e[t]=a,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length,i=n>>1,a=e[t];t=0)break;e[t]=l,t=o}e[t]=a}}},{}],34:[function(t,e,r){function n(t){var e=new f;return function(t,e){for(var r in t.layers)e.writeMessage(3,i,t.layers[r])}(t,e),e.finish()}function i(t,e){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r,n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r>31}function c(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,a=0,o=r.length,c=0;c=u||f<0||f>=u)){var h=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),p=h.vertexLength;n(r.layoutVertexArray,c,f,-1,-1),n(r.layoutVertexArray,c,f,1,-1),n(r.layoutVertexArray,c,f,1,1),n(r.layoutVertexArray,c,f,-1,1),r.indexArray.emplaceBack(p,p+1,p+2),r.indexArray.emplaceBack(p,p+3,p+2),h.vertexLength+=4,h.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t)},f("CircleBucket",h,{omit:["layers"]}),e.exports=h},{"../../util/web_worker_transfer":278,"../array_types":39,"../extent":53,"../index_array_type":55,"../load_geometry":56,"../program_configuration":58,"../segment":60,"./circle_attributes":41}],43:[function(t,e,r){arguments[4][41][0].apply(r,arguments)},{"../../util/struct_array":271,dup:41}],44:[function(t,e,r){var n=t("../array_types").FillLayoutArray,i=t("./fill_attributes").members,a=t("../segment").SegmentVector,o=t("../program_configuration").ProgramConfigurationSet,s=t("../index_array_type"),l=s.LineIndexArray,c=s.TriangleIndexArray,u=t("../load_geometry"),f=t("earcut"),h=t("../../util/classify_rings"),p=t("../../util/web_worker_transfer").register,d=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new n,this.indexArray=new c,this.indexArray2=new l,this.programConfigurations=new o(i,t.layers,t.zoom),this.segments=new a,this.segments2=new a};d.prototype.populate=function(t,e){for(var r=this,n=0,i=t;nd)||t.y===e.y&&(t.y<0||t.y>d)}function a(t){return t.every(function(t){return t.x<0})||t.every(function(t){return t.x>d})||t.every(function(t){return t.y<0})||t.every(function(t){return t.y>d})}var o=t("../array_types").FillExtrusionLayoutArray,s=t("./fill_extrusion_attributes").members,l=t("../segment"),c=l.SegmentVector,u=l.MAX_VERTEX_ARRAY_LENGTH,f=t("../program_configuration").ProgramConfigurationSet,h=t("../index_array_type").TriangleIndexArray,p=t("../load_geometry"),d=t("../extent"),g=t("earcut"),m=t("../../util/classify_rings"),v=t("../../util/web_worker_transfer").register,y=Math.pow(2,13),x=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new o,this.indexArray=new h,this.programConfigurations=new f(s,t.layers,t.zoom),this.segments=new c};x.prototype.populate=function(t,e){for(var r=this,n=0,i=t;n=1){var w=y[b-1];if(!i(_,w)){p.vertexLength+4>u&&(p=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray));var k=_.sub(w)._perp()._unit(),M=w.dist(_);x+M>32768&&(x=0),n(r.layoutVertexArray,_.x,_.y,k.x,k.y,0,0,x),n(r.layoutVertexArray,_.x,_.y,k.x,k.y,0,1,x),x+=M,n(r.layoutVertexArray,w.x,w.y,k.x,k.y,0,0,x),n(r.layoutVertexArray,w.x,w.y,k.x,k.y,0,1,x);var A=p.vertexLength;r.indexArray.emplaceBack(A,A+1,A+2),r.indexArray.emplaceBack(A+1,A+2,A+3),p.vertexLength+=4,p.primitiveLength+=2}}}}p.vertexLength+c>u&&(p=r.segments.prepareSegment(c,r.layoutVertexArray,r.indexArray));for(var T=[],S=[],C=p.vertexLength,E=0,L=l;E>6)}var i=t("../array_types").LineLayoutArray,a=t("./line_attributes").members,o=t("../segment").SegmentVector,s=t("../program_configuration").ProgramConfigurationSet,l=t("../index_array_type").TriangleIndexArray,c=t("../load_geometry"),u=t("../extent"),f=t("@mapbox/vector-tile").VectorTileFeature.types,h=t("../../util/web_worker_transfer").register,p=63,d=Math.cos(Math.PI/180*37.5),g=.5,m=Math.pow(2,14)/g,v=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new i,this.indexArray=new l,this.programConfigurations=new s(a,t.layers,t.zoom),this.segments=new o};v.prototype.populate=function(t,e){for(var r=this,n=0,i=t;n=2&&t[l-1].equals(t[l-2]);)l--;for(var c=0;cc){var z=m.dist(w);if(z>2*h){var P=m.sub(m.sub(w)._mult(h/z)._round());o.distance+=P.dist(w),o.addCurrentVertex(P,o.distance,M.mult(1),0,0,!1,g),w=P}}var D=w&&k,O=D?r:k?x:b;if(D&&"round"===O&&(Ei&&(O="bevel"),"bevel"===O&&(E>2&&(O="flipbevel"),E100)S=A.clone().mult(-1);else{var I=M.x*A.y-M.y*A.x>0?-1:1,R=E*M.add(A).mag()/M.sub(A).mag();S._perp()._mult(R*I)}o.addCurrentVertex(m,o.distance,S,0,0,!1,g),o.addCurrentVertex(m,o.distance,S.mult(-1),0,0,!1,g)}else if("bevel"===O||"fakeround"===O){var B=M.x*A.y-M.y*A.x>0,F=-Math.sqrt(E*E-1);if(B?(y=0,v=F):(v=0,y=F),_||o.addCurrentVertex(m,o.distance,M,v,y,!1,g),"fakeround"===O){for(var N=Math.floor(8*(.5-(C-.5))),j=void 0,V=0;V=0;U--)j=M.mult((U+1)/(N+1))._add(A)._unit(),o.addPieSliceVertex(m,o.distance,j,B,g)}k&&o.addCurrentVertex(m,o.distance,A,-v,-y,!1,g)}else"butt"===O?(_||o.addCurrentVertex(m,o.distance,M,0,0,!1,g),k&&o.addCurrentVertex(m,o.distance,A,0,0,!1,g)):"square"===O?(_||(o.addCurrentVertex(m,o.distance,M,1,1,!1,g),o.e1=o.e2=-1),k&&o.addCurrentVertex(m,o.distance,A,-1,-1,!1,g)):"round"===O&&(_||(o.addCurrentVertex(m,o.distance,M,0,0,!1,g),o.addCurrentVertex(m,o.distance,M,1,1,!0,g),o.e1=o.e2=-1),k&&(o.addCurrentVertex(m,o.distance,A,-1,-1,!0,g),o.addCurrentVertex(m,o.distance,A,0,0,!1,g)));if(L&&T2*h){var H=m.add(k.sub(m)._mult(h/q)._round());o.distance+=H.dist(m),o.addCurrentVertex(H,o.distance,A.mult(1),0,0,!1,g),m=H}}_=!1}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e)}},v.prototype.addCurrentVertex=function(t,e,r,i,a,o,s){var l,c=this.layoutVertexArray,u=this.indexArray;l=r.clone(),i&&l._sub(r.perp()._mult(i)),n(c,t,l,o,!1,i,e),this.e3=s.vertexLength++,this.e1>=0&&this.e2>=0&&(u.emplaceBack(this.e1,this.e2,this.e3),s.primitiveLength++),this.e1=this.e2,this.e2=this.e3,l=r.mult(-1),a&&l._sub(r.perp()._mult(a)),n(c,t,l,o,!0,-a,e),this.e3=s.vertexLength++,this.e1>=0&&this.e2>=0&&(u.emplaceBack(this.e1,this.e2,this.e3),s.primitiveLength++),this.e1=this.e2,this.e2=this.e3,e>m/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,i,a,o,s))},v.prototype.addPieSliceVertex=function(t,e,r,i,a){r=r.mult(i?-1:1);var o=this.layoutVertexArray,s=this.indexArray;n(o,t,r,!1,i,0,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(s.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),i?this.e2=this.e3:this.e1=this.e3},h("LineBucket",v,{omit:["layers"]}),e.exports=v},{"../../util/web_worker_transfer":278,"../array_types":39,"../extent":53,"../index_array_type":55,"../load_geometry":56,"../program_configuration":58,"../segment":60,"./line_attributes":48,"@mapbox/vector-tile":8}],50:[function(t,e,r){var n=t("../../util/struct_array").createLayout,i={symbolLayoutAttributes:n([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}]),dynamicLayoutAttributes:n([{name:"a_projected_pos",components:3,type:"Float32"}],4),placementOpacityAttributes:n([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),collisionVertexAttributes:n([{name:"a_placed",components:2,type:"Uint8"}],4),collisionBox:n([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"radius"},{type:"Int16",name:"signedDistanceFromAnchor"}]),collisionBoxLayout:n([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),collisionCircleLayout:n([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),placement:n([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"hidden"}]),glyphOffset:n([{type:"Float32",name:"offsetX"}]),lineVertex:n([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}])};e.exports=i},{"../../util/struct_array":271}],51:[function(t,e,r){function n(t,e,r,n,i,a,o,s){t.emplaceBack(e,r,Math.round(64*n),Math.round(64*i),a,o,s?s[0]:0,s?s[1]:0)}function i(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}var a=t("./symbol_attributes"),o=a.symbolLayoutAttributes,s=a.collisionVertexAttributes,l=a.collisionBoxLayout,c=a.collisionCircleLayout,u=a.dynamicLayoutAttributes,f=t("../array_types"),h=f.SymbolLayoutArray,p=f.SymbolDynamicLayoutArray,d=f.SymbolOpacityArray,g=f.CollisionBoxLayoutArray,m=f.CollisionCircleLayoutArray,v=f.CollisionVertexArray,y=f.PlacedSymbolArray,x=f.GlyphOffsetArray,b=f.SymbolLineVertexArray,_=t("@mapbox/point-geometry"),w=t("../segment").SegmentVector,k=t("../program_configuration").ProgramConfigurationSet,M=t("../index_array_type"),A=M.TriangleIndexArray,T=M.LineIndexArray,S=t("../../symbol/transform_text"),C=t("../../symbol/mergelines"),E=t("../../util/script_detection"),L=t("../load_geometry"),z=t("@mapbox/vector-tile").VectorTileFeature.types,P=t("../../util/verticalize_punctuation"),D=(t("../../symbol/anchor"),t("../../symbol/symbol_size").getSizeData),O=t("../../util/web_worker_transfer").register,I=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}],R=function(t){this.layoutVertexArray=new h,this.indexArray=new A,this.programConfigurations=t,this.segments=new w,this.dynamicLayoutVertexArray=new p,this.opacityVertexArray=new d,this.placedSymbolArray=new y};R.prototype.upload=function(t,e){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,o.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.programConfigurations.upload(t),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,u.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,I,!0),this.opacityVertexBuffer.itemSize=1},R.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},O("SymbolBuffers",R);var B=function(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new w,this.collisionVertexArray=new v};B.prototype.upload=function(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,s.members,!0)},B.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},O("CollisionBuffers",B);var F=function(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.pixelRatio=t.pixelRatio;var e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=D(this.zoom,e["text-size"]),this.iconSizeData=D(this.zoom,e["icon-size"]);var r=this.layers[0].layout;this.sortFeaturesByY=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement")};F.prototype.createArrays=function(){this.text=new R(new k(o.members,this.layers,this.zoom,function(t){return/^text/.test(t)})),this.icon=new R(new k(o.members,this.layers,this.zoom,function(t){return/^icon/.test(t)})),this.collisionBox=new B(g,l.members,T),this.collisionCircle=new B(m,c.members,A),this.glyphOffsetArray=new x,this.lineVertexArray=new b},F.prototype.populate=function(t,e){var r=this.layers[0],n=r.layout,i=n.get("text-font"),a=n.get("text-field"),o=n.get("icon-image"),s=("constant"!==a.value.kind||a.value.value.length>0)&&("constant"!==i.value.kind||i.value.value.length>0),l="constant"!==o.value.kind||o.value.value&&o.value.value.length>0;if(this.features=[],s||l){for(var c=e.iconDependencies,u=e.glyphDependencies,f={zoom:this.zoom},h=0,p=t;h=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var l=0;l0;t.addCollisionDebugVertices(l,c,u,f,h?t.collisionCircle:t.collisionBox,s.anchorPoint,n,h)}}}},F.prototype.deserializeCollisionBoxes=function(t,e,r,n,i){for(var a={},o=e;o0},F.prototype.hasIconData=function(){return this.icon.segments.get().length>0},F.prototype.hasCollisionBoxData=function(){return this.collisionBox.segments.get().length>0},F.prototype.hasCollisionCircleData=function(){return this.collisionCircle.segments.get().length>0},F.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&(this.sortedAngle=t,!(this.text.segments.get().length>1||this.icon.segments.get().length>1))){for(var r=[],n=0;n=this.dim+this.border||e<-this.border||e>=this.dim+this.border)throw new RangeError("out of range source coordinates for DEM data");return(e+this.border)*this.stride+(t+this.border)},a("Level",o);var s=function(t,e,r){this.uid=t,this.scale=e||1,this.level=r||new o(256,512),this.loaded=!!r};s.prototype.loadFromImage=function(t){if(t.height!==t.width)throw new RangeError("DEM tiles must be square");for(var e=this.level=new o(t.width,t.width/2),r=t.data,n=0;no.max||c.yo.max)&&i.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}},{"../util/util":275,"./extent":53}],57:[function(t,e,r){var n=t("../util/struct_array").createLayout;e.exports=n([{name:"a_pos",type:"Int16",components:2}])},{"../util/struct_array":271}],58:[function(t,e,r){function n(t){return[a(255*t.r,255*t.g),a(255*t.b,255*t.a)]}function i(t,e){return{"text-opacity":"opacity","icon-opacity":"opacity","text-color":"fill_color","icon-color":"fill_color","text-halo-color":"halo_color","icon-halo-color":"halo_color","text-halo-blur":"halo_blur","icon-halo-blur":"halo_blur","text-halo-width":"halo_width","icon-halo-width":"halo_width","line-gap-width":"gapwidth"}[t]||t.replace(e+"-","").replace(/-/g,"_")}var a=t("../shaders/encode_attribute").packUint8ToFloat,o=(t("../style-spec/util/color"),t("../util/web_worker_transfer").register),s=t("../style/properties").PossiblyEvaluatedPropertyValue,l=t("./array_types"),c=l.StructArrayLayout1f4,u=l.StructArrayLayout2f8,f=l.StructArrayLayout4f16,h=function(t,e,r){this.value=t,this.name=e,this.type=r,this.statistics={max:-1/0}};h.prototype.defines=function(){return["#define HAS_UNIFORM_u_"+this.name]},h.prototype.populatePaintArray=function(){},h.prototype.upload=function(){},h.prototype.destroy=function(){},h.prototype.setUniforms=function(t,e,r,n){var i=n.constantOr(this.value),a=t.gl;"color"===this.type?a.uniform4f(e.uniforms["u_"+this.name],i.r,i.g,i.b,i.a):a.uniform1f(e.uniforms["u_"+this.name],i)};var p=function(t,e,r){this.expression=t,this.name=e,this.type=r,this.statistics={max:-1/0};var n="color"===r?u:c;this.paintVertexAttributes=[{name:"a_"+e,type:"Float32",components:"color"===r?2:1,offset:0}],this.paintVertexArray=new n};p.prototype.defines=function(){return[]},p.prototype.populatePaintArray=function(t,e){var r=this.paintVertexArray,i=r.length;r.reserve(t);var a=this.expression.evaluate({zoom:0},e);if("color"===this.type)for(var o=n(a),s=i;sa&&n("Max vertices per segment is "+a+": bucket requested "+t),(!o||o.vertexLength+t>e.exports.MAX_VERTEX_ARRAY_LENGTH)&&(o={vertexOffset:r.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},this.segments.push(o)),o},o.prototype.get=function(){return this.segments},o.prototype.destroy=function(){for(var t=0,e=this.segments;t90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};i.prototype.wrap=function(){return new i(n(this.lng,-180,180),this.lat)},i.prototype.toArray=function(){return[this.lng,this.lat]},i.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},i.prototype.toBounds=function(e){var r=360*e/40075017,n=r/Math.cos(Math.PI/180*this.lat);return new(t("./lng_lat_bounds"))(new i(this.lng-n,this.lat-r),new i(this.lng+n,this.lat+r))},i.convert=function(t){if(t instanceof i)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new i(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new i(Number(t.lng),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, or an array of [, ]")},e.exports=i},{"../util/util":275,"./lng_lat_bounds":63}],63:[function(t,e,r){var n=t("./lng_lat"),i=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};i.prototype.setNorthEast=function(t){return this._ne=t instanceof n?new n(t.lng,t.lat):n.convert(t),this},i.prototype.setSouthWest=function(t){return this._sw=t instanceof n?new n(t.lng,t.lat):n.convert(t),this},i.prototype.extend=function(t){var e,r,a=this._sw,o=this._ne;if(t instanceof n)e=t,r=t;else{if(!(t instanceof i))return Array.isArray(t)?t.every(Array.isArray)?this.extend(i.convert(t)):this.extend(n.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return a||o?(a.lng=Math.min(e.lng,a.lng),a.lat=Math.min(e.lat,a.lat),o.lng=Math.max(r.lng,o.lng),o.lat=Math.max(r.lat,o.lat)):(this._sw=new n(e.lng,e.lat),this._ne=new n(r.lng,r.lat)),this},i.prototype.getCenter=function(){return new n((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},i.prototype.getSouthWest=function(){return this._sw},i.prototype.getNorthEast=function(){return this._ne},i.prototype.getNorthWest=function(){return new n(this.getWest(),this.getNorth())},i.prototype.getSouthEast=function(){return new n(this.getEast(),this.getSouth())},i.prototype.getWest=function(){return this._sw.lng},i.prototype.getSouth=function(){return this._sw.lat},i.prototype.getEast=function(){return this._ne.lng},i.prototype.getNorth=function(){return this._ne.lat},i.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},i.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},i.prototype.isEmpty=function(){return!(this._sw&&this._ne)},i.convert=function(t){return!t||t instanceof i?t:new i(t)},e.exports=i},{"./lng_lat":62}],64:[function(t,e,r){var n=t("./lng_lat"),i=t("@mapbox/point-geometry"),a=t("./coordinate"),o=t("../util/util"),s=t("../style-spec/util/interpolate").number,l=t("../util/tile_cover"),c=t("../source/tile_id"),u=(c.CanonicalTileID,c.UnwrappedTileID),f=t("../data/extent"),h=t("@mapbox/gl-matrix"),p=h.vec4,d=h.mat4,g=h.mat2,m=function(t,e,r){this.tileSize=512,this._renderWorldCopies=void 0===r||r,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new n(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._posMatrixCache={},this._alignedPosMatrixCache={}},v={minZoom:{},maxZoom:{},renderWorldCopies:{},worldSize:{},centerPoint:{},size:{},bearing:{},pitch:{},fov:{},zoom:{},center:{},unmodified:{},x:{},y:{},point:{}};m.prototype.clone=function(){var t=new m(this._minZoom,this._maxZoom,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._calcMatrices(),t},v.minZoom.get=function(){return this._minZoom},v.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},v.maxZoom.get=function(){return this._maxZoom},v.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},v.renderWorldCopies.get=function(){return this._renderWorldCopies},v.worldSize.get=function(){return this.tileSize*this.scale},v.centerPoint.get=function(){return this.size._div(2)},v.size.get=function(){return new i(this.width,this.height)},v.bearing.get=function(){return-this.angle/Math.PI*180},v.bearing.set=function(t){var e=-o.wrap(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=g.create(),g.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},v.pitch.get=function(){return this._pitch/Math.PI*180},v.pitch.set=function(t){var e=o.clamp(t,0,60)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())},v.fov.get=function(){return this._fov/Math.PI*180},v.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},v.zoom.get=function(){return this._zoom},v.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},v.center.get=function(){return this._center},v.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},m.prototype.coveringZoomLevel=function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},m.prototype.getVisibleUnwrappedCoordinates=function(t){var e=this.pointCoordinate(new i(0,0),0),r=this.pointCoordinate(new i(this.width,0),0),n=Math.floor(e.column),a=Math.floor(r.column),o=[new u(0,t)];if(this._renderWorldCopies)for(var s=n;s<=a;s++)0!==s&&o.push(new u(s,t));return o},m.prototype.coveringTiles=function(t){var e=this.coveringZoomLevel(t),r=e;if(void 0!==t.minzoom&&et.maxzoom&&(e=t.maxzoom);var n=this.pointCoordinate(this.centerPoint,e),a=new i(n.column-.5,n.row-.5),o=[this.pointCoordinate(new i(0,0),e),this.pointCoordinate(new i(this.width,0),e),this.pointCoordinate(new i(this.width,this.height),e),this.pointCoordinate(new i(0,this.height),e)];return l(e,o,t.reparseOverscaled?r:e,this._renderWorldCopies).sort(function(t,e){return a.dist(t.canonical)-a.dist(e.canonical)})},m.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},v.unmodified.get=function(){return this._unmodified},m.prototype.zoomScale=function(t){return Math.pow(2,t)},m.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},m.prototype.project=function(t){return new i(this.lngX(t.lng),this.latY(t.lat))},m.prototype.unproject=function(t){return new n(this.xLng(t.x),this.yLat(t.y))},v.x.get=function(){return this.lngX(this.center.lng)},v.y.get=function(){return this.latY(this.center.lat)},v.point.get=function(){return new i(this.x,this.y)},m.prototype.lngX=function(t){return(180+t)*this.worldSize/360},m.prototype.latY=function(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))*this.worldSize/360},m.prototype.xLng=function(t){return 360*t/this.worldSize-180},m.prototype.yLat=function(t){var e=180-360*t/this.worldSize;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90},m.prototype.setLocationAtPoint=function(t,e){var r=this.pointCoordinate(e)._sub(this.pointCoordinate(this.centerPoint));this.center=this.coordinateLocation(this.locationCoordinate(t)._sub(r)),this._renderWorldCopies&&(this.center=this.center.wrap())},m.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},m.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},m.prototype.locationCoordinate=function(t){return new a(this.lngX(t.lng)/this.tileSize,this.latY(t.lat)/this.tileSize,this.zoom).zoomTo(this.tileZoom)},m.prototype.coordinateLocation=function(t){var e=t.zoomTo(this.zoom);return new n(this.xLng(e.column*this.tileSize),this.yLat(e.row*this.tileSize))},m.prototype.pointCoordinate=function(t,e){void 0===e&&(e=this.tileZoom);var r=[t.x,t.y,0,1],n=[t.x,t.y,1,1];p.transformMat4(r,r,this.pixelMatrixInverse),p.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],o=n[3],l=r[1]/i,c=n[1]/o,u=r[2]/i,f=n[2]/o,h=u===f?0:(0-u)/(f-u);return new a(s(r[0]/i,n[0]/o,h)/this.tileSize,s(l,c,h)/this.tileSize,this.zoom)._zoomTo(e)},m.prototype.coordinatePoint=function(t){var e=t.zoomTo(this.zoom),r=[e.column*this.tileSize,e.row*this.tileSize,0,1];return p.transformMat4(r,r,this.pixelMatrix),new i(r[0]/r[3],r[1]/r[3])},m.prototype.calculatePosMatrix=function(t,e){void 0===e&&(e=!1);var r=t.key,n=e?this._alignedPosMatrixCache:this._posMatrixCache;if(n[r])return n[r];var i=t.canonical,a=this.worldSize/this.zoomScale(i.z),o=i.x+Math.pow(2,i.z)*t.wrap,s=d.identity(new Float64Array(16));return d.translate(s,s,[o*a,i.y*a,0]),d.scale(s,s,[a/f,a/f,1]),d.multiply(s,e?this.alignedProjMatrix:this.projMatrix,s),n[r]=new Float32Array(s),n[r]},m.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,r,n,a=-90,o=90,s=-180,l=180,c=this.size,u=this._unmodified;if(this.latRange){var f=this.latRange;a=this.latY(f[1]),t=(o=this.latY(f[0]))-ao&&(n=o-g)}if(this.lngRange){var m=this.x,v=c.x/2;m-vl&&(r=l-v)}void 0===r&&void 0===n||(this.center=this.unproject(new i(void 0!==r?r:this.x,void 0!==n?n:this.y))),this._unmodified=u,this._constraining=!1}},m.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var t=this._fov/2,e=Math.PI/2+this._pitch,r=Math.sin(t)*this.cameraToCenterDistance/Math.sin(Math.PI-e-t),n=this.x,i=this.y,a=1.01*(Math.cos(Math.PI/2-this._pitch)*r+this.cameraToCenterDistance),o=new Float64Array(16);d.perspective(o,this._fov,this.width/this.height,1,a),d.scale(o,o,[1,-1,1]),d.translate(o,o,[0,0,-this.cameraToCenterDistance]),d.rotateX(o,o,this._pitch),d.rotateZ(o,o,this.angle),d.translate(o,o,[-n,-i,0]);var s=this.worldSize/(2*Math.PI*6378137*Math.abs(Math.cos(this.center.lat*(Math.PI/180))));d.scale(o,o,[1,1,s,1]),this.projMatrix=o;var l=this.width%2/2,c=this.height%2/2,u=Math.cos(this.angle),f=Math.sin(this.angle),h=n-Math.round(n)+u*l+f*c,p=i-Math.round(i)+u*c+f*l,g=new Float64Array(o);if(d.translate(g,g,[h>.5?h-1:h,p>.5?p-1:p,0]),this.alignedProjMatrix=g,o=d.create(),d.scale(o,o,[this.width/2,-this.height/2,1]),d.translate(o,o,[1,-1,0]),this.pixelMatrix=d.multiply(new Float64Array(16),o,this.projMatrix),!(o=d.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={}}},Object.defineProperties(m.prototype,v),e.exports=m},{"../data/extent":53,"../source/tile_id":114,"../style-spec/util/interpolate":158,"../util/tile_cover":273,"../util/util":275,"./coordinate":61,"./lng_lat":62,"@mapbox/gl-matrix":2,"@mapbox/point-geometry":4}],65:[function(t,e,r){var n=t("../style-spec/util/color"),i=function(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r};i.disabled=new i(i.Replace=[1,0],n.transparent,[!1,!1,!1,!1]),i.unblended=new i(i.Replace,n.transparent,[!0,!0,!0,!0]),i.alphaBlended=new i([1,771],n.transparent,[!0,!0,!0,!0]),e.exports=i},{"../style-spec/util/color":153}],66:[function(t,e,r){var n=t("./index_buffer"),i=t("./vertex_buffer"),a=t("./framebuffer"),o=(t("./depth_mode"),t("./stencil_mode"),t("./color_mode")),s=t("../util/util"),l=t("./value"),c=l.ClearColor,u=l.ClearDepth,f=l.ClearStencil,h=l.ColorMask,p=l.DepthMask,d=l.StencilMask,g=l.StencilFunc,m=l.StencilOp,v=l.StencilTest,y=l.DepthRange,x=l.DepthTest,b=l.DepthFunc,_=l.Blend,w=l.BlendFunc,k=l.BlendColor,M=l.Program,A=l.LineWidth,T=l.ActiveTextureUnit,S=l.Viewport,C=l.BindFramebuffer,E=l.BindRenderbuffer,L=l.BindTexture,z=l.BindVertexBuffer,P=l.BindElementBuffer,D=l.BindVertexArrayOES,O=l.PixelStoreUnpack,I=l.PixelStoreUnpackPremultiplyAlpha,R=function(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.lineWidthRange=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE),this.clearColor=new c(this),this.clearDepth=new u(this),this.clearStencil=new f(this),this.colorMask=new h(this),this.depthMask=new p(this),this.stencilMask=new d(this),this.stencilFunc=new g(this),this.stencilOp=new m(this),this.stencilTest=new v(this),this.depthRange=new y(this),this.depthTest=new x(this),this.depthFunc=new b(this),this.blend=new _(this),this.blendFunc=new w(this),this.blendColor=new k(this),this.program=new M(this),this.lineWidth=new A(this),this.activeTexture=new T(this),this.viewport=new S(this),this.bindFramebuffer=new C(this),this.bindRenderbuffer=new E(this),this.bindTexture=new L(this),this.bindVertexBuffer=new z(this),this.bindElementBuffer=new P(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new D(this),this.pixelStoreUnpack=new O(this),this.pixelStoreUnpackPremultiplyAlpha=new I(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&t.getExtension("OES_texture_half_float_linear")};R.prototype.createIndexBuffer=function(t,e){return new n(this,t,e)},R.prototype.createVertexBuffer=function(t,e,r){return new i(this,t,e,r)},R.prototype.createRenderbuffer=function(t,e,r){var n=this.gl,i=n.createRenderbuffer();return this.bindRenderbuffer.set(i),n.renderbufferStorage(n.RENDERBUFFER,t,e,r),this.bindRenderbuffer.set(null),i},R.prototype.createFramebuffer=function(t,e){return new a(this,t,e)},R.prototype.clear=function(t){var e=t.color,r=t.depth,n=this.gl,i=0;e&&(i|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(i|=n.DEPTH_BUFFER_BIT,this.clearDepth.set(r),this.depthMask.set(!0)),n.clear(i)},R.prototype.setDepthMode=function(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)},R.prototype.setStencilMode=function(t){t.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)},R.prototype.setColorMode=function(t){s.deepEqual(t.blendFunction,o.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)},e.exports=R},{"../util/util":275,"./color_mode":65,"./depth_mode":67,"./framebuffer":68,"./index_buffer":69,"./stencil_mode":70,"./value":71,"./vertex_buffer":72}],67:[function(t,e,r){var n=function(t,e,r){this.func=t,this.mask=e,this.range=r};n.ReadOnly=!1,n.ReadWrite=!0,n.disabled=new n(519,n.ReadOnly,[0,1]),e.exports=n},{}],68:[function(t,e,r){var n=t("./value"),i=n.ColorAttachment,a=n.DepthAttachment,o=function(t,e,r){this.context=t,this.width=e,this.height=r;var n=t.gl,o=this.framebuffer=n.createFramebuffer();this.colorAttachment=new i(t,o),this.depthAttachment=new a(t,o)};o.prototype.destroy=function(){var t=this.context.gl,e=this.colorAttachment.get();e&&t.deleteTexture(e);var r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r),t.deleteFramebuffer(this.framebuffer)},e.exports=o},{"./value":71}],69:[function(t,e,r){var n=function(t,e,r){this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};n.prototype.unbindVAO=function(){this.context.extVertexArrayObject&&this.context.bindVertexArrayOES.set(null)},n.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},n.prototype.updateData=function(t){var e=this.context.gl;this.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},n.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)},e.exports=n},{}],70:[function(t,e,r){var n=function(t,e,r,n,i,a){this.test=t,this.ref=e,this.mask=r,this.fail=n,this.depthFail=i,this.pass=a};n.disabled=new n({func:519,mask:0},0,0,7680,7680,7680),e.exports=n},{}],71:[function(t,e,r){var n=t("../style-spec/util/color"),i=t("../util/util"),a=function(t){this.context=t,this.current=n.transparent};a.prototype.get=function(){return this.current},a.prototype.set=function(t){var e=this.current;t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a||(this.context.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t)};var o=function(t){this.context=t,this.current=1};o.prototype.get=function(){return this.current},o.prototype.set=function(t){this.current!==t&&(this.context.gl.clearDepth(t),this.current=t)};var s=function(t){this.context=t,this.current=0};s.prototype.get=function(){return this.current},s.prototype.set=function(t){this.current!==t&&(this.context.gl.clearStencil(t),this.current=t)};var l=function(t){this.context=t,this.current=[!0,!0,!0,!0]};l.prototype.get=function(){return this.current},l.prototype.set=function(t){var e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]||(this.context.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t)};var c=function(t){this.context=t,this.current=!0};c.prototype.get=function(){return this.current},c.prototype.set=function(t){this.current!==t&&(this.context.gl.depthMask(t),this.current=t)};var u=function(t){this.context=t,this.current=255};u.prototype.get=function(){return this.current},u.prototype.set=function(t){this.current!==t&&(this.context.gl.stencilMask(t),this.current=t)};var f=function(t){this.context=t,this.current={func:t.gl.ALWAYS,ref:0,mask:255}};f.prototype.get=function(){return this.current},f.prototype.set=function(t){var e=this.current;t.func===e.func&&t.ref===e.ref&&t.mask===e.mask||(this.context.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t)};var h=function(t){this.context=t;var e=this.context.gl;this.current=[e.KEEP,e.KEEP,e.KEEP]};h.prototype.get=function(){return this.current},h.prototype.set=function(t){var e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]||(this.context.gl.stencilOp(t[0],t[1],t[2]),this.current=t)};var p=function(t){this.context=t,this.current=!1};p.prototype.get=function(){return this.current},p.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t}};var d=function(t){this.context=t,this.current=[0,1]};d.prototype.get=function(){return this.current},d.prototype.set=function(t){var e=this.current;t[0]===e[0]&&t[1]===e[1]||(this.context.gl.depthRange(t[0],t[1]),this.current=t)};var g=function(t){this.context=t,this.current=!1};g.prototype.get=function(){return this.current},g.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t}};var m=function(t){this.context=t,this.current=t.gl.LESS};m.prototype.get=function(){return this.current},m.prototype.set=function(t){this.current!==t&&(this.context.gl.depthFunc(t),this.current=t)};var v=function(t){this.context=t,this.current=!1};v.prototype.get=function(){return this.current},v.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t}};var y=function(t){this.context=t;var e=this.context.gl;this.current=[e.ONE,e.ZERO]};y.prototype.get=function(){return this.current},y.prototype.set=function(t){var e=this.current;t[0]===e[0]&&t[1]===e[1]||(this.context.gl.blendFunc(t[0],t[1]),this.current=t)};var x=function(t){this.context=t,this.current=n.transparent};x.prototype.get=function(){return this.current},x.prototype.set=function(t){var e=this.current;t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a||(this.context.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t)};var b=function(t){this.context=t,this.current=null};b.prototype.get=function(){return this.current},b.prototype.set=function(t){this.current!==t&&(this.context.gl.useProgram(t),this.current=t)};var _=function(t){this.context=t,this.current=1};_.prototype.get=function(){return this.current},_.prototype.set=function(t){var e=this.context.lineWidthRange,r=i.clamp(t,e[0],e[1]);this.current!==r&&(this.context.gl.lineWidth(r),this.current=t)};var w=function(t){this.context=t,this.current=t.gl.TEXTURE0};w.prototype.get=function(){return this.current},w.prototype.set=function(t){this.current!==t&&(this.context.gl.activeTexture(t),this.current=t)};var k=function(t){this.context=t;var e=this.context.gl;this.current=[0,0,e.drawingBufferWidth,e.drawingBufferHeight]};k.prototype.get=function(){return this.current},k.prototype.set=function(t){var e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]||(this.context.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t)};var M=function(t){this.context=t,this.current=null};M.prototype.get=function(){return this.current},M.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t}};var A=function(t){this.context=t,this.current=null};A.prototype.get=function(){return this.current},A.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t}};var T=function(t){this.context=t,this.current=null};T.prototype.get=function(){return this.current},T.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t}};var S=function(t){this.context=t,this.current=null};S.prototype.get=function(){return this.current},S.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t}};var C=function(t){this.context=t,this.current=null};C.prototype.get=function(){return this.current},C.prototype.set=function(t){var e=this.context.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t};var E=function(t){this.context=t,this.current=null};E.prototype.get=function(){return this.current},E.prototype.set=function(t){this.current!==t&&this.context.extVertexArrayObject&&(this.context.extVertexArrayObject.bindVertexArrayOES(t),this.current=t)};var L=function(t){this.context=t,this.current=4};L.prototype.get=function(){return this.current},L.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t}};var z=function(t){this.context=t,this.current=!1};z.prototype.get=function(){return this.current},z.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t}};var P=function(t,e){this.context=t,this.current=null,this.parent=e};P.prototype.get=function(){return this.current};var D=function(t){function e(e,r){t.call(this,e,r),this.dirty=!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){if(this.dirty||this.current!==t){var e=this.context.gl;this.context.bindFramebuffer.set(this.parent),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},e.prototype.setDirty=function(){this.dirty=!0},e}(P),O=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;this.context.bindFramebuffer.set(this.parent),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t}},e}(P);e.exports={ClearColor:a,ClearDepth:o,ClearStencil:s,ColorMask:l,DepthMask:c,StencilMask:u,StencilFunc:f,StencilOp:h,StencilTest:p,DepthRange:d,DepthTest:g,DepthFunc:m,Blend:v,BlendFunc:y,BlendColor:x,Program:b,LineWidth:_,ActiveTextureUnit:w,Viewport:k,BindFramebuffer:M,BindRenderbuffer:A,BindTexture:T,BindVertexBuffer:S,BindElementBuffer:C,BindVertexArrayOES:E,PixelStoreUnpack:L,PixelStoreUnpackPremultiplyAlpha:z,ColorAttachment:D,DepthAttachment:O}},{"../style-spec/util/color":153,"../util/util":275}],72:[function(t,e,r){var n={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},i=function(t,e,r,n){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;var i=t.gl;this.buffer=i.createBuffer(),t.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};i.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},i.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},i.prototype.enableAttributes=function(t,e){for(var r=0;r":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]}},{"../data/array_types":39,"../data/extent":53,"../data/pos_attributes":57,"../gl/depth_mode":67,"../gl/stencil_mode":70,"../util/browser":252,"./vertex_array_object":95,"@mapbox/gl-matrix":2}],78:[function(t,e,r){function n(t,e,r,n,i){if(!s.isPatternMissing(r.paint.get("fill-pattern"),t))for(var a=!0,o=0,l=n;o0){var l=o.now(),c=(l-t.timeAdded)/s,u=e?(l-e.timeAdded)/s:-1,f=r.getSource(),h=a.coveringZoomLevel({tileSize:f.tileSize,roundZoom:f.roundZoom}),p=!e||Math.abs(e.tileID.overscaledZ-h)>Math.abs(t.tileID.overscaledZ-h),d=p&&t.refreshedUponExpiration?1:i.clamp(p?c:1-u,0,1);return t.refreshedUponExpiration&&c>=1&&(t.refreshedUponExpiration=!1),e?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}var i=t("../util/util"),a=t("../source/image_source"),o=t("../util/browser"),s=t("../gl/stencil_mode"),l=t("../gl/depth_mode");e.exports=function(t,e,r,i){if("translucent"===t.renderPass&&0!==r.paint.get("raster-opacity")){var o=t.context,c=o.gl,u=e.getSource(),f=t.useProgram("raster");o.setStencilMode(s.disabled),o.setColorMode(t.colorModeForRenderPass()),c.uniform1f(f.uniforms.u_brightness_low,r.paint.get("raster-brightness-min")),c.uniform1f(f.uniforms.u_brightness_high,r.paint.get("raster-brightness-max")),c.uniform1f(f.uniforms.u_saturation_factor,function(t){return t>0?1-1/(1.001-t):-t}(r.paint.get("raster-saturation"))),c.uniform1f(f.uniforms.u_contrast_factor,function(t){return t>0?1/(1-t):1+t}(r.paint.get("raster-contrast"))),c.uniform3fv(f.uniforms.u_spin_weights,function(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}(r.paint.get("raster-hue-rotate"))),c.uniform1f(f.uniforms.u_buffer_scale,1),c.uniform1i(f.uniforms.u_image0,0),c.uniform1i(f.uniforms.u_image1,1);for(var h=i.length&&i[0].overscaledZ,p=0,d=i;p65535)e(new Error("glyphs > 65535 not supported"));else{var c=o.requests[l];c||(c=o.requests[l]=[],n(i,l,r.url,r.requestTransform,function(t,e){if(e)for(var r in e)o.glyphs[+r]=e[+r];for(var n=0,i=c;nthis.height)return n.warnOnce("LineAtlas out of space"),null;for(var o=0,s=0;s=0;this.currentLayer--){var m=r.style._layers[o[r.currentLayer]];m.source!==(d&&d.id)&&(g=[],(d=r.style.sourceCaches[m.source])&&(r.clearStencil(),g=d.getVisibleCoordinates(),d.getSource().isTileClipped&&r._renderTileClippingMasks(g))),r.renderLayer(r,d,m,g)}this.renderPass="translucent";var v,y=[];for(this.currentLayer=0,this.currentLayer;this.currentLayer0?e.pop():null},T.prototype._createProgramCached=function(t,e){this.cache=this.cache||{};var r=""+t+(e.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new y(this.context,v[t],e,this._showOverdrawInspector)),this.cache[r]},T.prototype.useProgram=function(t,e){var r=this._createProgramCached(t,e||this.emptyProgramConfiguration);return this.context.program.set(r.program),r},e.exports=T},{"../data/array_types":39,"../data/extent":53,"../data/pos_attributes":57,"../data/program_configuration":58,"../data/raster_bounds_attributes":59,"../gl/color_mode":65,"../gl/context":66,"../gl/depth_mode":67,"../gl/stencil_mode":70,"../shaders":97,"../source/pixels_to_tile_units":104,"../source/source_cache":111,"../style-spec/util/color":153,"../symbol/cross_tile_symbol_index":218,"../util/browser":252,"../util/util":275,"./draw_background":74,"./draw_circle":75,"./draw_debug":77,"./draw_fill":78,"./draw_fill_extrusion":79,"./draw_heatmap":80,"./draw_hillshade":81,"./draw_line":82,"./draw_raster":83,"./draw_symbol":84,"./program":92,"./texture":93,"./tile_mask":94,"./vertex_array_object":95,"@mapbox/gl-matrix":2}],91:[function(t,e,r){var n=t("../source/pixels_to_tile_units");r.isPatternMissing=function(t,e){if(!t)return!1;var r=e.imageManager.getPattern(t.from),n=e.imageManager.getPattern(t.to);return!r||!n},r.prepare=function(t,e,r){var n=e.context,i=n.gl,a=e.imageManager.getPattern(t.from),o=e.imageManager.getPattern(t.to);i.uniform1i(r.uniforms.u_image,0),i.uniform2fv(r.uniforms.u_pattern_tl_a,a.tl),i.uniform2fv(r.uniforms.u_pattern_br_a,a.br),i.uniform2fv(r.uniforms.u_pattern_tl_b,o.tl),i.uniform2fv(r.uniforms.u_pattern_br_b,o.br);var s=e.imageManager.getPixelSize(),l=s.width,c=s.height;i.uniform2fv(r.uniforms.u_texsize,[l,c]),i.uniform1f(r.uniforms.u_mix,t.t),i.uniform2fv(r.uniforms.u_pattern_size_a,a.displaySize),i.uniform2fv(r.uniforms.u_pattern_size_b,o.displaySize),i.uniform1f(r.uniforms.u_scale_a,t.fromScale),i.uniform1f(r.uniforms.u_scale_b,t.toScale),n.activeTexture.set(i.TEXTURE0),e.imageManager.bind(e.context)},r.setTile=function(t,e,r){var i=e.context.gl;i.uniform1f(r.uniforms.u_tile_units_to_pixels,1/n(t,1,e.transform.tileZoom));var a=Math.pow(2,t.tileID.overscaledZ),o=t.tileSize*Math.pow(2,e.transform.tileZoom)/a,s=o*(t.tileID.canonical.x+t.tileID.wrap*a),l=o*t.tileID.canonical.y;i.uniform2f(r.uniforms.u_pixel_coord_upper,s>>16,l>>16),i.uniform2f(r.uniforms.u_pixel_coord_lower,65535&s,65535&l)}},{"../source/pixels_to_tile_units":104}],92:[function(t,e,r){var n=t("../util/browser"),i=t("../shaders"),a=(t("../data/program_configuration").ProgramConfiguration,t("./vertex_array_object")),o=(t("../gl/context"),function(t,e,r,a){var o=this,s=t.gl;this.program=s.createProgram();var l=r.defines().concat("#define DEVICE_PIXEL_RATIO "+n.devicePixelRatio.toFixed(1));a&&l.push("#define OVERDRAW_INSPECTOR;");var c=l.concat(i.prelude.fragmentSource,e.fragmentSource).join("\n"),u=l.concat(i.prelude.vertexSource,e.vertexSource).join("\n"),f=s.createShader(s.FRAGMENT_SHADER);s.shaderSource(f,c),s.compileShader(f),s.attachShader(this.program,f);var h=s.createShader(s.VERTEX_SHADER);s.shaderSource(h,u),s.compileShader(h),s.attachShader(this.program,h);for(var p=r.layoutAttributes||[],d=0;d 0.5) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n gl_FragColor *= .1;\n }\n}",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n gl_Position.xy += a_extrude * u_extrude_scale * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n}\n"},collisionCircle:{fragmentSource:"\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n float alpha = 0.5;\n\n // Red = collision, hide label\n vec4 color = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n\n // Blue = no collision, label is showing\n if (v_placed > 0.5) {\n color = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n color *= .2;\n }\n\n float extrude_scale_length = length(v_extrude_scale);\n float extrude_length = length(v_extrude) * extrude_scale_length;\n float stroke_width = 15.0 * extrude_scale_length;\n float radius = v_radius * extrude_scale_length;\n\n float distance_to_edge = abs(extrude_length - radius);\n float opacity_t = smoothstep(-stroke_width, 0.0, -distance_to_edge);\n\n gl_FragColor = opacity_t * color;\n}\n",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\n\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n\n highp float padding_factor = 1.2; // Pad the vertices slightly to make room for anti-alias blur\n gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n v_radius = abs(a_extrude.y); // We don't pitch the circles, so both units of the extrusion vector are equal in magnitude to the radius\n\n v_extrude = a_extrude * padding_factor;\n v_extrude_scale = u_extrude_scale * u_camera_to_center_distance * collision_perspective_ratio;\n}\n"},debug:{fragmentSource:"uniform highp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fill:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fillOutline:{fragmentSource:"#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillOutlinePattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n\n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n}\n"},fillExtrusion:{fragmentSource:"varying vec4 v_color;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n gl_FragColor = v_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec4 v_color;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n vec3 normal = a_normal_ed.xyz;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n\n gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? height : base, 1);\n\n // Relative luminance (how dark/bright is the surface color?)\n float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;\n\n v_color = vec4(0.0, 0.0, 0.0, 1.0);\n\n // Add slight ambient lighting so no extrusions are totally black\n vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0);\n color += ambientlight;\n\n // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray\n float directional = clamp(dot(normal / 16384.0, u_lightpos), 0.0, 1.0);\n\n // Adjust directional so that\n // the range of values for highlight/shading is narrower\n // with lower light intensity\n // and with lighter/brighter surface colors\n directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional);\n\n // Add gradient along z axis of side surfaces\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n // Assign final color based on surface + ambient light color, diffuse light directional, and light color\n // with lower bounds adjusted to hue of light\n // so that shading is tinted with the complementary (opposite) color to the light color\n v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0);\n v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0);\n v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0);\n}\n"},fillExtrusionPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 mixedColor = mix(color1, color2, u_mix);\n\n gl_FragColor = mixedColor * v_lighting;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\nuniform float u_height_factor;\n\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\nvarying float v_directional;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec3 normal = a_normal_ed.xyz;\n float edgedistance = a_normal_ed.w;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n float z = t > 0.0 ? height : base;\n\n gl_Position = u_matrix * vec4(a_pos, z, 1);\n\n vec2 pos = normal.x == 1.0 && normal.y == 0.0 && normal.z == 16384.0\n ? a_pos // extrusion top\n : vec2(edgedistance, z * u_height_factor); // extrusion side\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, pos);\n\n v_lighting = vec4(0.0, 0.0, 0.0, 1.0);\n float directional = clamp(dot(normal / 16383.0, u_lightpos), 0.0, 1.0);\n directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional);\n\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0));\n}\n"},extrusionTexture:{fragmentSource:"uniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(0.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);\n\n v_pos.x = a_pos.x;\n v_pos.y = 1.0 - a_pos.y;\n}\n"},hillshadePrepare:{fragmentSource:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nuniform vec2 u_dimension;\nuniform float u_zoom;\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture2D(u_image, coord) * 255.0;\n return (data.r + data.g * 256.0 + data.b * 256.0 * 256.0) / 4.0;\n}\n\nvoid main() {\n vec2 epsilon = 1.0 / u_dimension;\n\n // queried pixels:\n // +-----------+\n // | | | |\n // | a | b | c |\n // | | | |\n // +-----------+\n // | | | |\n // | d | e | f |\n // | | | |\n // +-----------+\n // | | | |\n // | g | h | i |\n // | | | |\n // +-----------+\n\n float a = getElevation(v_pos + vec2(-epsilon.x, -epsilon.y), 0.0);\n float b = getElevation(v_pos + vec2(0, -epsilon.y), 0.0);\n float c = getElevation(v_pos + vec2(epsilon.x, -epsilon.y), 0.0);\n float d = getElevation(v_pos + vec2(-epsilon.x, 0), 0.0);\n float e = getElevation(v_pos, 0.0);\n float f = getElevation(v_pos + vec2(epsilon.x, 0), 0.0);\n float g = getElevation(v_pos + vec2(-epsilon.x, epsilon.y), 0.0);\n float h = getElevation(v_pos + vec2(0, epsilon.y), 0.0);\n float i = getElevation(v_pos + vec2(epsilon.x, epsilon.y), 0.0);\n\n // here we divide the x and y slopes by 8 * pixel size\n // where pixel size (aka meters/pixel) is:\n // circumference of the world / (pixels per tile * number of tiles)\n // which is equivalent to: 8 * 40075016.6855785 / (512 * pow(2, u_zoom))\n // which can be reduced to: pow(2, 19.25619978527 - u_zoom)\n // we want to vertically exaggerate the hillshading though, because otherwise\n // it is barely noticeable at low zooms. to do this, we multiply this by some\n // scale factor pow(2, (u_zoom - 14) * a) where a is an arbitrary value and 14 is the\n // maxzoom of the tile source. here we use a=0.3 which works out to the\n // expression below. see nickidlugash's awesome breakdown for more info\n // https://github.com/mapbox/mapbox-gl-js/pull/5286#discussion_r148419556\n float exaggeration = u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;\n\n vec2 deriv = vec2(\n (c + f + f + i) - (a + d + d + g),\n (g + h + h + i) - (a + b + b + c)\n ) / pow(2.0, (u_zoom - 14.0) * exaggeration + 19.2562 - u_zoom);\n\n gl_FragColor = clamp(vec4(\n deriv.x / 2.0 + 0.5,\n deriv.y / 2.0 + 0.5,\n 1.0,\n 1.0), 0.0, 1.0);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (a_texture_pos / 8192.0) / 2.0 + 0.25;\n}\n"},hillshade:{fragmentSource:"uniform sampler2D u_image;\nvarying vec2 v_pos;\n\nuniform vec2 u_latrange;\nuniform vec2 u_light;\nuniform vec4 u_shadow;\nuniform vec4 u_highlight;\nuniform vec4 u_accent;\n\n#define PI 3.141592653589793\n\nvoid main() {\n vec4 pixel = texture2D(u_image, v_pos);\n\n vec2 deriv = ((pixel.rg * 2.0) - 1.0);\n\n // We divide the slope by a scale factor based on the cosin of the pixel's approximate latitude\n // to account for mercator projection distortion. see #4807 for details\n float scaleFactor = cos(radians((u_latrange[0] - u_latrange[1]) * (1.0 - v_pos.y) + u_latrange[1]));\n // We also multiply the slope by an arbitrary z-factor of 1.25\n float slope = atan(1.25 * length(deriv) / scaleFactor);\n float aspect = deriv.x != 0.0 ? atan(deriv.y, -deriv.x) : PI / 2.0 * (deriv.y > 0.0 ? 1.0 : -1.0);\n\n float intensity = u_light.x;\n // We add PI to make this property match the global light object, which adds PI/2 to the light's azimuthal\n // position property to account for 0deg corresponding to north/the top of the viewport in the style spec\n // and the original shader was written to accept (-illuminationDirection - 90) as the azimuthal.\n float azimuth = u_light.y + PI;\n\n // We scale the slope exponentially based on intensity, using a calculation similar to\n // the exponential interpolation function in the style spec:\n // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/expression/definitions/interpolate.js#L217-L228\n // so that higher intensity values create more opaque hillshading.\n float base = 1.875 - intensity * 1.75;\n float maxValue = 0.5 * PI;\n float scaledSlope = intensity != 0.5 ? ((pow(base, slope) - 1.0) / (pow(base, maxValue) - 1.0)) * maxValue : slope;\n\n // The accent color is calculated with the cosine of the slope while the shade color is calculated with the sine\n // so that the accent color's rate of change eases in while the shade color's eases out.\n float accent = cos(scaledSlope);\n // We multiply both the accent and shade color by a clamped intensity value\n // so that intensities >= 0.5 do not additionally affect the color values\n // while intensity values < 0.5 make the overall color more transparent.\n vec4 accent_color = (1.0 - accent) * u_accent * clamp(intensity * 2.0, 0.0, 1.0);\n float shade = abs(mod((aspect + azimuth) / PI + 0.5, 2.0) - 1.0);\n vec4 shade_color = mix(u_shadow, u_highlight, shade) * sin(scaledSlope) * clamp(intensity * 2.0, 0.0, 1.0);\n gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_texture_pos / 8192.0;\n}\n"},line:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},linePattern:{fragmentSource:"uniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_fade;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_width2.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_width2.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n gl_FragColor = color * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_linesofar = a_linesofar;\n v_width2 = vec2(outset, inset);\n}\n"},lineSDF:{fragmentSource:"\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist =outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x / floorwidth, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x / floorwidth, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n v_width2 = vec2(outset, inset);\n}\n"},raster:{fragmentSource:"uniform float u_fade_t;\nuniform float u_opacity;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n if (color0.a > 0.0) {\n color0.rgb = color0.rgb / color0.a;\n }\n if (color1.a > 0.0) {\n color1.rgb = color1.rgb / color1.a;\n }\n vec4 color = mix(color0, color1, u_fade_t);\n color.a *= u_opacity;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n // We are using Int16 for texture position coordinates to give us enough precision for\n // fractional coordinates. We use 8192 to scale the texture coordinates in the buffer\n // as an arbitrarily high number to preserve adequate precision when rendering.\n // This is also the same value as the EXTENT we are using for our tile buffer pos coordinates,\n // so math for modifying either is consistent.\n v_pos0 = (((a_texture_pos / 8192.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},symbolIcon:{fragmentSource:"uniform sampler2D u_texture;\n\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n lowp float alpha = opacity * v_fade_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\nuniform highp float u_camera_to_center_distance;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform float u_fade_change;\n\n#pragma mapbox: define lowp float opacity\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n\n float size;\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // See comments in symbol_sdf.vertex\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = 0.5 + 0.5 * distance_ratio;\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // See comments in symbol_sdf.vertex\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 64.0 * fontScale), 0.0, 1.0);\n\n v_tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n v_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n}\n"},symbolSDF:{fragmentSource:"#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO\n\nuniform bool u_is_halo;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform sampler2D u_texture;\nuniform highp float u_gamma_scale;\nuniform bool u_is_text;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 tex = v_data0.xy;\n float gamma_scale = v_data1.x;\n float size = v_data1.y;\n float fade_opacity = v_data1[2];\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n lowp vec4 color = fill_color;\n highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);\n lowp float buff = (256.0 - 64.0) / 256.0;\n if (u_is_halo) {\n color = halo_color;\n gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n }\n\n lowp float dist = texture2D(u_texture, tex).a;\n highp float gamma_scaled = gamma * gamma_scale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n gl_FragColor = color * (alpha * opacity * fade_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\n// contents of a_size vary based on the type of property value\n// used for {text,icon}-size.\n// For constants, a_size is disabled.\n// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature.\n// For composite functions:\n// [ text-size(lowerZoomStop, feature),\n// text-size(upperZoomStop, feature) ]\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\n\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform highp float u_camera_to_center_distance;\nuniform float u_fade_change;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n float size;\n\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // If the label is pitched with the map, layout is done in pitched space,\n // which makes labels in the distance smaller relative to viewport space.\n // We counteract part of that effect by multiplying by the perspective ratio.\n // If the label isn't pitched with the map, we do layout in viewport space,\n // which makes labels in the distance larger relative to the features around\n // them. We counteract part of that effect by dividing by the perspective ratio.\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = 0.5 + 0.5 * distance_ratio;\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // Point labels with 'rotation-alignment: map' are horizontal with respect to tile units\n // To figure out that angle in projected space, we draw a short horizontal line in tile\n // space, project it, and measure its angle in projected space.\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 64.0 * fontScale), 0.0, 1.0);\n float gamma_scale = gl_Position.w;\n\n vec2 tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n\n v_data0 = vec2(tex.x, tex.y);\n v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity);\n}\n"}},i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=function(t){var e=n[t],r={};e.fragmentSource=e.fragmentSource.replace(i,function(t,e,n,i,a){return r[a]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nvarying "+n+" "+i+" "+a+";\n#else\nuniform "+n+" "+i+" u_"+a+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+a+"\n "+n+" "+i+" "+a+" = u_"+a+";\n#endif\n"}),e.vertexSource=e.vertexSource.replace(i,function(t,e,n,i,a){var o="float"===i?"vec2":"vec4";return r[a]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nuniform lowp float a_"+a+"_t;\nattribute "+n+" "+o+" a_"+a+";\nvarying "+n+" "+i+" "+a+";\n#else\nuniform "+n+" "+i+" u_"+a+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+a+" = unpack_mix_"+o+"(a_"+a+", a_"+a+"_t);\n#else\n "+n+" "+i+" "+a+" = u_"+a+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nuniform lowp float a_"+a+"_t;\nattribute "+n+" "+o+" a_"+a+";\n#else\nuniform "+n+" "+i+" u_"+a+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+n+" "+i+" "+a+" = unpack_mix_"+o+"(a_"+a+", a_"+a+"_t);\n#else\n "+n+" "+i+" "+a+" = u_"+a+";\n#endif\n"})};for(var o in n)a(o);e.exports=n},{}],98:[function(t,e,r){var n=t("./image_source"),i=t("../util/window"),a=t("../data/raster_bounds_attributes"),o=t("../render/vertex_array_object"),s=t("../render/texture"),l=function(t){function e(e,r,n,i){t.call(this,e,r,n,i),this.options=r,this.animate=void 0===r.animate||r.animate}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){this.canvas=this.canvas||i.document.getElementById(this.options.canvas),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire("error",new Error("Canvas dimensions cannot be less than or equal to zero.")):(this.play=function(){this._playing=!0,this.map._rerender()},this.pause=function(){this._playing=!1},this._finishLoading())},e.prototype.getCanvas=function(){return this.canvas},e.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},e.prototype.onRemove=function(){this.pause()},e.prototype.prepare=function(){var t=this,e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var r=this.map.painter.context,n=r.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,a.members)),this.boundsVAO||(this.boundsVAO=new o),this.texture?e?this.texture.update(this.canvas):this._playing&&(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.canvas)):(this.texture=new s(r,this.canvas,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),t.tiles){var l=t.tiles[i];"loaded"!==l.state&&(l.state="loaded",l.texture=t.texture)}}},e.prototype.serialize=function(){return{type:"canvas",canvas:this.canvas,coordinates:this.coordinates}},e.prototype.hasTransition=function(){return this._playing},e.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];t0&&(r.resourceTiming=t._resourceTiming,t._resourceTiming=[]),t.fire("data",r)}})},e.prototype.onAdd=function(t){this.map=t,this.load()},e.prototype.setData=function(t){var e=this;return this._data=t,this.fire("dataloading",{dataType:"source"}),this._updateWorkerData(function(t){if(t)return e.fire("error",{error:t});var r={dataType:"source",sourceDataType:"content"};e._collectResourceTiming&&e._resourceTiming&&e._resourceTiming.length>0&&(r.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire("data",r)}),this},e.prototype._updateWorkerData=function(t){var e=this,r=i.extend({},this.workerOptions),n=this._data;"string"==typeof n?(r.request=this.map._transformRequest(function(t){var e=a.document.createElement("a");return e.href=t,e.href}(n),s.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(n),this.workerID=this.dispatcher.send(this.type+".loadData",r,function(r,n){e._loaded=!0,n&&n.resourceTiming&&n.resourceTiming[e.id]&&(e._resourceTiming=n.resourceTiming[e.id].slice(0)),t(r)},this.workerID)},e.prototype.loadTile=function(t,e){var r=this,n=void 0===t.workerID||"expired"===t.state?"loadTile":"reloadTile",i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:l.devicePixelRatio,overscaling:t.tileID.overscaleFactor(),showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send(n,i,function(i,a){return t.unloadVectorData(),t.aborted?e(null):i?e(i):(t.loadVectorData(a,r.map.painter,"reloadTile"===n),e(null))},this.workerID)},e.prototype.abortTile=function(t){t.aborted=!0},e.prototype.unloadTile=function(t){t.unloadVectorData(),this.dispatcher.send("removeTile",{uid:t.uid,type:this.type,source:this.id},null,t.workerID)},e.prototype.onRemove=function(){this.dispatcher.broadcast("removeSource",{type:this.type,source:this.id})},e.prototype.serialize=function(){return i.extend({},this._options,{type:this.type,data:this._data})},e.prototype.hasTransition=function(){return!1},e}(n);e.exports=c},{"../data/extent":53,"../util/ajax":251,"../util/browser":252,"../util/evented":260,"../util/util":275,"../util/window":254}],100:[function(t,e,r){function n(t,e){var r=t.source,n=t.tileID.canonical;if(!this._geoJSONIndexes[r])return e(null,null);var i=this._geoJSONIndexes[r].getTile(n.z,n.x,n.y);if(!i)return e(null,null);var a=new s(i.features),o=l(a);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:a,rawData:o.buffer})}var i=t("../util/ajax"),a=t("../util/performance"),o=t("geojson-rewind"),s=t("./geojson_wrapper"),l=t("vt-pbf"),c=t("supercluster"),u=t("geojson-vt"),f=function(t){function e(e,r,i){t.call(this,e,r,n),i&&(this.loadGeoJSON=i),this._geoJSONIndexes={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.loadData=function(t,e){var r=this;this.loadGeoJSON(t,function(n,i){if(n||!i)return e(n);if("object"!=typeof i)return e(new Error("Input data is not a valid GeoJSON object."));o(i,!0);try{r._geoJSONIndexes[t.source]=t.cluster?c(t.superclusterOptions).load(i.features):u(i,t.geojsonVtOptions)}catch(n){return e(n)}r.loaded[t.source]={};var s={};if(t.request&&t.request.collectResourceTiming){var l=a.getEntriesByName(t.request.url);l&&(s.resourceTiming={},s.resourceTiming[t.source]=JSON.parse(JSON.stringify(l)))}e(null,s)})},e.prototype.reloadTile=function(e,r){var n=this.loaded[e.source],i=e.uid;return n&&n[i]?t.prototype.reloadTile.call(this,e,r):this.loadTile(e,r)},e.prototype.loadGeoJSON=function(t,e){if(t.request)i.getJSON(t.request,e);else{if("string"!=typeof t.data)return e(new Error("Input data is not a valid GeoJSON object."));try{return e(null,JSON.parse(t.data))}catch(t){return e(new Error("Input data is not a valid GeoJSON object."))}}},e.prototype.removeSource=function(t,e){this._geoJSONIndexes[t.source]&&delete this._geoJSONIndexes[t.source],e()},e}(t("./vector_tile_worker_source"));e.exports=f},{"../util/ajax":251,"../util/performance":268,"./geojson_wrapper":101,"./vector_tile_worker_source":116,"geojson-rewind":15,"geojson-vt":19,supercluster:32,"vt-pbf":34}],101:[function(t,e,r){var n=t("@mapbox/point-geometry"),i=t("@mapbox/vector-tile").VectorTileFeature.prototype.toGeoJSON,a=t("../data/extent"),o=function(t){this._feature=t,this.extent=a,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))};o.prototype.loadGeometry=function(){if(1===this._feature.type){for(var t=[],e=0,r=this._feature.geometry;e0&&(l[new s(t.overscaledZ,i,e.z,n,e.y-1).key]={backfilled:!1},l[new s(t.overscaledZ,t.wrap,e.z,e.x,e.y-1).key]={backfilled:!1},l[new s(t.overscaledZ,o,e.z,a,e.y-1).key]={backfilled:!1}),e.y+11||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[a]&&(t.neighboringTiles[a].backfilled=!0)))}for(var r=this.getRenderableIds(),n=0;ne)){var s=Math.pow(2,o.tileID.canonical.z-t.canonical.z);if(Math.floor(o.tileID.canonical.x/s)===t.canonical.x&&Math.floor(o.tileID.canonical.y/s)===t.canonical.y)for(r[a]=o.tileID,i=!0;o&&o.tileID.overscaledZ-1>t.overscaledZ;){var l=o.tileID.scaledTo(o.tileID.overscaledZ-1);if(!l)break;(o=n._tiles[l.key])&&o.hasData()&&(delete r[a],r[l.key]=l)}}}return i},e.prototype.findLoadedParent=function(t,e,r){for(var n=this,i=t.overscaledZ-1;i>=e;i--){var a=t.scaledTo(i);if(!a)return;var o=String(a.key),s=n._tiles[o];if(s&&s.hasData())return r[o]=a,s;if(n._cache.has(o))return r[o]=a,n._cache.get(o)}},e.prototype.updateCacheSize=function(t){var e=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),r=Math.floor(5*e),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(n)},e.prototype.update=function(t){var r=this;if(this.transform=t,this._sourceLoaded&&!this._paused){var n;this.updateCacheSize(t),this._coveredTiles={},this.used?this._source.tileID?n=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(t){return new d(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)}):(n=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(n=n.filter(function(t){return r._source.hasTile(t)}))):n=[];var a,o=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(t)),s=Math.max(o-e.maxOverzooming,this._source.minzoom),l=Math.max(o+e.maxUnderzooming,this._source.minzoom),c=this._updateRetainedTiles(n,o),f={};if(i(this._source.type))for(var h=Object.keys(c),g=0;g=p.now())){r._findLoadedChildren(v,l,c)&&(c[m]=v);var x=r.findLoadedParent(v,s,f);x&&r._addTile(x.tileID)}}for(a in f)c[a]||(r._coveredTiles[a]=!0);for(a in f)c[a]=f[a];for(var b=u.keysDifference(this._tiles,c),_=0;_n._source.maxzoom){var p=c.children(n._source.maxzoom)[0],d=n.getTile(p);d&&d.hasData()?i[p.key]=p:h=!1}else{n._findLoadedChildren(c,s,i);for(var g=c.children(n._source.maxzoom),m=0;m=o;--v){var y=c.scaledTo(v);if(a[y.key])break;if(a[y.key]=!0,!(u=n.getTile(y))&&f&&(u=n._addTile(y)),u&&(i[y.key]=y,f=u.wasRequested(),u.hasData()))break}}}return i},e.prototype._addTile=function(t){var e=this._tiles[t.key];if(e)return e;(e=this._cache.getAndRemove(t.key))&&this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,e));var r=Boolean(e);return r||(e=new o(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(e,this._tileLoaded.bind(this,e,t.key,e.state))),e?(e.uses++,this._tiles[t.key]=e,r||this._source.fire("dataloading",{tile:e,coord:e.tileID,dataType:"source"}),e):null},e.prototype._setTileReloadTimer=function(t,e){var r=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout(function(){r._reloadTile(t,"expired"),delete r._timers[t]},n))},e.prototype._setCacheInvalidationTimer=function(t,e){var r=this;t in this._cacheTimers&&(clearTimeout(this._cacheTimers[t]),delete this._cacheTimers[t]);var n=e.getExpiryTimeout();n&&(this._cacheTimers[t]=setTimeout(function(){r._cache.remove(t),delete r._cacheTimers[t]},n))},e.prototype._removeTile=function(t){var e=this._tiles[t];if(e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),!(e.uses>0)))if(e.hasData()){e.tileID=e.tileID.wrapped();var r=e.tileID.key;this._cache.add(r,e),this._setCacheInvalidationTimer(r,e)}else e.aborted=!0,this._abortTile(e),this._unloadTile(e)},e.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._resetCache()},e.prototype._resetCache=function(){for(var t in this._cacheTimers)clearTimeout(this._cacheTimers[t]);this._cacheTimers={},this._cache.reset()},e.prototype.tilesIn=function(t){for(var e=[],r=this.getIds(),i=1/0,a=1/0,o=-1/0,s=-1/0,l=t[0].zoom,u=0;u=0&&m[1].y>=0){for(var v=[],y=0;y=p.now())return!0}return!1},e}(s);g.maxOverzooming=10,g.maxUnderzooming=3,e.exports=g},{"../data/extent":53,"../geo/coordinate":61,"../gl/context":66,"../util/browser":252,"../util/evented":260,"../util/lru_cache":266,"../util/util":275,"./source":110,"./tile":112,"./tile_id":114,"@mapbox/point-geometry":4}],112:[function(t,e,r){var n=t("../util/util"),i=t("../data/bucket").deserialize,a=(t("../data/feature_index"),t("@mapbox/vector-tile")),o=t("pbf"),s=t("../util/vectortile_to_geojson"),l=t("../style-spec/feature_filter"),c=(t("../symbol/collision_index"),t("../data/bucket/symbol_bucket")),u=t("../data/array_types"),f=u.RasterBoundsArray,h=u.CollisionBoxArray,p=t("../data/raster_bounds_attributes"),d=t("../data/extent"),g=t("@mapbox/point-geometry"),m=t("../render/texture"),v=t("../data/segment").SegmentVector,y=t("../data/index_array_type").TriangleIndexArray,x=t("../util/browser"),b=function(t,e){this.tileID=t,this.uid=n.uniqueId(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.expiredRequestCount=0,this.state="loading"};b.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e>s.z,c=new g(s.x*l,s.y*l),u=new g(c.x+l,c.y+l),h=this.segments.prepareSegment(4,r,i);r.emplaceBack(c.x,c.y,c.x,c.y),r.emplaceBack(u.x,c.y,u.x,c.y),r.emplaceBack(c.x,u.y,c.x,u.y),r.emplaceBack(u.x,u.y,u.x,u.y);var m=h.vertexLength;i.emplaceBack(m,m+1,m+2),i.emplaceBack(m+1,m+2,m+3),h.vertexLength+=4,h.primitiveLength+=2}this.maskedBoundsBuffer=e.createVertexBuffer(r,p.members),this.maskedIndexBuffer=e.createIndexBuffer(i)}},b.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},b.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var r=n.parseCacheControl(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var i=Date.now(),a=!1;if(this.expirationTime>i)a=!1;else if(e)if(this.expirationTime=e&&t.x=r&&t.y0;a--)i+=(e&(n=1<this.canonical.z?new c(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new c(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},c.prototype.isChildOf=function(t){var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},c.prototype.children=function(t){if(this.overscaledZ>=t)return[new c(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new c(e,this.wrap,e,r,n),new c(e,this.wrap,e,r+1,n),new c(e,this.wrap,e,r,n+1),new c(e,this.wrap,e,r+1,n+1)]},c.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=E.maxzoom||"none"===E.visibility||(n(C,d.zoom),(v[E.id]=E.createBucket({index:m.bucketLayerIDs.length,layers:C,zoom:d.zoom,pixelRatio:d.pixelRatio,overscaling:d.overscaling,collisionBoxArray:d.collisionBoxArray})).populate(k,y),m.bucketLayerIDs.push(C.map(function(t){return t.id})))}}}var L,z,P,D=c.mapObject(y.glyphDependencies,function(t){return Object.keys(t).map(Number)});Object.keys(D).length?r.send("getGlyphs",{uid:this.uid,stacks:D},function(t,e){L||(L=t,z=e,p.call(d))}):z={};var O=Object.keys(y.iconDependencies);O.length?r.send("getImages",{icons:O},function(t,e){L||(L=t,P=e,p.call(d))}):P={},p.call(this)},e.exports=d},{"../data/array_types":39,"../data/bucket/symbol_bucket":51,"../data/feature_index":54,"../render/glyph_atlas":85,"../render/image_atlas":87,"../style/evaluation_parameters":182,"../symbol/symbol_layout":227,"../util/dictionary_coder":257,"../util/util":275,"./tile_id":114}],120:[function(t,e,r){function n(t,e){var r={};for(var n in t)"ref"!==n&&(r[n]=t[n]);return i.forEach(function(t){t in e&&(r[t]=e[t])}),r}var i=t("./util/ref_properties");e.exports=function(t){t=t.slice();for(var e=Object.create(null),r=0;r4)return e.error("Expected 1, 2, or 3 arguments, but found "+(t.length-1)+" instead.");var r,n;if(t.length>2){var i=t[1];if("string"!=typeof i||!(i in p))return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=p[i]}else r=o;if(t.length>3){if("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2]))return e.error('The length argument to "array" must be a positive integer literal',2);n=t[2]}var s=a(r,n),l=e.parse(t[t.length-1],t.length-1,o);return l?new d(s,l):null},d.prototype.evaluate=function(t){var e=this.input.evaluate(t);if(u(this.type,f(e)))throw new h("Expected value to be of type "+i(this.type)+", but found "+i(f(e))+" instead.");return e},d.prototype.eachChild=function(t){t(this.input)},d.prototype.possibleOutputs=function(){return this.input.possibleOutputs()},e.exports=d},{"../runtime_error":143,"../types":146,"../values":147}],125:[function(t,e,r){var n=t("../types"),i=n.ObjectType,a=n.ValueType,o=n.StringType,s=n.NumberType,l=n.BooleanType,c=t("../runtime_error"),u=t("../types"),f=u.checkSubtype,h=u.toString,p=t("../values").typeOf,d={string:o,number:s,boolean:l,object:i},g=function(t,e){this.type=t,this.args=e};g.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");for(var r=t[0],n=d[r],i=[],o=1;o=r.length)throw new s("Array index out of bounds: "+e+" > "+r.length+".");if(e!==Math.floor(e))throw new s("Array index must be an integer, but found "+e+" instead.");return r[e]},l.prototype.eachChild=function(t){t(this.index),t(this.input)},l.prototype.possibleOutputs=function(){return[void 0]},e.exports=l},{"../runtime_error":143,"../types":146}],127:[function(t,e,r){var n=t("../types").BooleanType,i=function(t,e,r){this.type=t,this.branches=e,this.otherwise=r};i.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found only "+(t.length-1)+".");if(t.length%2!=0)return e.error("Expected an odd number of arguments.");var r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(var a=[],o=1;o4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":c(e[0],e[1],e[2],e[3])))return new l(e[0]/255,e[1]/255,e[2]/255,e[3]);throw new u(r||"Could not parse color from value '"+("string"==typeof e?e:JSON.stringify(e))+"'")}for(var o=null,s=0,f=this.args;sn.evaluate(t)}function c(t,e){var r=e[0],n=e[1];return r.evaluate(t)<=n.evaluate(t)}function u(t,e){var r=e[0],n=e[1];return r.evaluate(t)>=n.evaluate(t)}var f=t("../types"),h=f.NumberType,p=f.StringType,d=f.BooleanType,g=f.ColorType,m=f.ObjectType,v=f.ValueType,y=f.ErrorType,x=f.array,b=f.toString,_=t("../values"),w=_.typeOf,k=_.Color,M=_.validateRGBA,A=t("../compound_expression"),T=A.CompoundExpression,S=A.varargs,C=t("../runtime_error"),E=t("./let"),L=t("./var"),z=t("./literal"),P=t("./assertion"),D=t("./array"),O=t("./coercion"),I=t("./at"),R=t("./match"),B=t("./case"),F=t("./step"),N=t("./interpolate"),j=t("./coalesce"),V=t("./equals"),U={"==":V.Equals,"!=":V.NotEquals,array:D,at:I,boolean:P,case:B,coalesce:j,interpolate:N,let:E,literal:z,match:R,number:P,object:P,step:F,string:P,"to-color":O,"to-number":O,var:L};T.register(U,{error:[y,[p],function(t,e){var r=e[0];throw new C(r.evaluate(t))}],typeof:[p,[v],function(t,e){var r=e[0];return b(w(r.evaluate(t)))}],"to-string":[p,[v],function(t,e){var r=e[0],n=typeof(r=r.evaluate(t));return null===r||"string"===n||"number"===n||"boolean"===n?String(r):r instanceof k?r.toString():JSON.stringify(r)}],"to-boolean":[d,[v],function(t,e){var r=e[0];return Boolean(r.evaluate(t))}],"to-rgba":[x(h,4),[g],function(t,e){var r=e[0].evaluate(t),n=r.r,i=r.g,a=r.b,o=r.a;return[255*n/o,255*i/o,255*a/o,o]}],rgb:[g,[h,h,h],n],rgba:[g,[h,h,h,h],n],length:{type:h,overloads:[[[p],o],[[x(v)],o]]},has:{type:d,overloads:[[[p],function(t,e){return i(e[0].evaluate(t),t.properties())}],[[p,m],function(t,e){var r=e[0],n=e[1];return i(r.evaluate(t),n.evaluate(t))}]]},get:{type:v,overloads:[[[p],function(t,e){return a(e[0].evaluate(t),t.properties())}],[[p,m],function(t,e){var r=e[0],n=e[1];return a(r.evaluate(t),n.evaluate(t))}]]},properties:[m,[],function(t){return t.properties()}],"geometry-type":[p,[],function(t){return t.geometryType()}],id:[v,[],function(t){return t.id()}],zoom:[h,[],function(t){return t.globals.zoom}],"heatmap-density":[h,[],function(t){return t.globals.heatmapDensity||0}],"+":[h,S(h),function(t,e){for(var r=0,n=0,i=e;n":[d,[p,v],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>a}],"filter-id->":[d,[v],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[d,[p,v],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i<=a}],"filter-id-<=":[d,[v],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[d,[p,v],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>=a}],"filter-id->=":[d,[v],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[d,[v],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[d,[],function(t){return null!==t.id()}],"filter-type-in":[d,[x(p)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[d,[x(v)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[d,[p,x(v)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[d,[p,x(v)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],">":{type:d,overloads:[[[h,h],l],[[p,p],l]]},"<":{type:d,overloads:[[[h,h],s],[[p,p],s]]},">=":{type:d,overloads:[[[h,h],u],[[p,p],u]]},"<=":{type:d,overloads:[[[h,h],c],[[p,p],c]]},all:{type:d,overloads:[[[d,d],function(t,e){var r=e[0],n=e[1];return r.evaluate(t)&&n.evaluate(t)}],[S(d),function(t,e){for(var r=0,n=e;r1}))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:o}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(n=e.parse(n,2,l)))return null;var c=[],f=null;e.expectedType&&"value"!==e.expectedType.kind&&(f=e.expectedType);for(var h=0;h=p)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',g);var v=e.parse(d,m,f);if(!v)return null;f=f||v.type,c.push([p,v])}return"number"===f.kind||"color"===f.kind||"array"===f.kind&&"number"===f.itemType.kind&&"number"==typeof f.N?new u(f,r,n,c):e.error("Type "+s(f)+" is not interpolatable.")},u.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var o=c(e,n),s=e[o],l=e[o+1],f=u.interpolationFactor(this.interpolation,n,s,l),h=r[o].evaluate(t),p=r[o+1].evaluate(t);return a[this.type.kind.toLowerCase()](h,p,f)},u.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;eNumber.MAX_SAFE_INTEGER)return f.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof d&&Math.floor(d)!==d)return f.error("Numeric branch labels must be integer values.");if(r){if(f.checkSubtype(r,n(d)))return null}else r=n(d);if(void 0!==o[String(d)])return f.error("Branch labels must be unique.");o[String(d)]=s.length}var g=e.parse(u,l,a);if(!g)return null;a=a||g.type,s.push(g)}var m=e.parse(t[1],1,r);if(!m)return null;var v=e.parse(t[t.length-1],t.length-1,a);return v?new i(r,a,m,o,s,v):null},i.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},i.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},i.prototype.possibleOutputs=function(){return(t=[]).concat.apply(t,this.outputs.map(function(t){return t.possibleOutputs()})).concat(this.otherwise.possibleOutputs());var t},e.exports=i},{"../values":147}],136:[function(t,e,r){var n=t("../types").NumberType,i=t("../stops").findStopLessThanOrEqualTo,a=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n=c)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',f);var p=e.parse(u,h,s);if(!p)return null;s=s||p.type,o.push([c,p])}return new a(s,r,o)},a.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var a=e.length;return n>=e[a-1]?r[a-1].evaluate(t):r[i(e,n)].evaluate(t)},a.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&"string"==typeof t[0]&&t[0]in g}function i(t,e,r){void 0===r&&(r={});var n=new l(g,[],function(t){var e={color:z,string:P,number:D,enum:P,boolean:O};return"array"===t.type?R(e[t.value]||I,t.length):e[t.type]||null}(e)),i=n.parse(t);return i?x(!1===r.handleErrors?new _(i):new w(i,e)):b(n.errors)}function a(t,e,r){if(void 0===r&&(r={}),"error"===(t=i(t,e,r)).result)return t;var n=t.value.expression,a=m.isFeatureConstant(n);if(!a&&!e["property-function"])return b([new s("","property expressions not supported")]);var o=m.isGlobalPropertyConstant(n,["zoom"]);if(!o&&!1===e["zoom-function"])return b([new s("","zoom expressions not supported")]);var l=function t(e){var r=null;if(e instanceof d)r=t(e.result);else if(e instanceof p)for(var n=0,i=e.args;n=0)return!1;var i=!0;return e.eachChild(function(e){i&&!t(e,r)&&(i=!1)}),i}}},{"./compound_expression":123}],141:[function(t,e,r){var n=t("./scope"),i=t("./types").checkSubtype,a=t("./parsing_error"),o=t("./definitions/literal"),s=t("./definitions/assertion"),l=t("./definitions/array"),c=t("./definitions/coercion"),u=function(t,e,r,i,a){void 0===e&&(e=[]),void 0===i&&(i=new n),void 0===a&&(a=[]),this.registry=t,this.path=e,this.key=e.map(function(t){return"["+t+"]"}).join(""),this.scope=i,this.errors=a,this.expectedType=r};u.prototype.parse=function(e,r,n,i,a){void 0===a&&(a={});var u=this;if(r&&(u=u.concat(r,n,i)),null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return u.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var f=e[0];if("string"!=typeof f)return u.error("Expression name must be a string, but found "+typeof f+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var h=u.registry[f];if(h){var p=h.parse(e,u);if(!p)return null;if(u.expectedType){var d=u.expectedType,g=p.type;if("string"!==d.kind&&"number"!==d.kind&&"boolean"!==d.kind||"value"!==g.kind)if("array"===d.kind&&"value"===g.kind)a.omitTypeAnnotations||(p=new l(d,p));else if("color"!==d.kind||"value"!==g.kind&&"string"!==g.kind){if(u.checkSubtype(u.expectedType,p.type))return null}else a.omitTypeAnnotations||(p=new c(d,[p]));else a.omitTypeAnnotations||(p=new s(d,[p]))}if(!(p instanceof o)&&function(e){var r=t("./compound_expression").CompoundExpression,n=t("./is_constant"),i=n.isGlobalPropertyConstant,a=n.isFeatureConstant;if(e instanceof t("./definitions/var"))return!1;if(e instanceof r&&"error"===e.name)return!1;var s=!0;return e.eachChild(function(t){t instanceof o||(s=!1)}),!!s&&a(e)&&i(e,["zoom","heatmap-density"])}(p)){var m=new(t("./evaluation_context"));try{p=new o(p.type,p.evaluate(m))}catch(e){return u.error(e.message),null}}return p}return u.error('Unknown expression "'+f+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===e?u.error("'undefined' value invalid. Use null instead."):"object"==typeof e?u.error('Bare objects invalid. Use ["literal", {...}] instead.'):u.error("Expected an array, but found "+typeof e+" instead.")},u.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new u(this.registry,n,e||null,i,this.errors)},u.prototype.error=function(t){for(var e=arguments,r=[],n=arguments.length-1;n-- >0;)r[n]=e[n+1];var i=""+this.key+r.map(function(t){return"["+t+"]"}).join("");this.errors.push(new a(i,t))},u.prototype.checkSubtype=function(t,e){var r=i(t,e);return r&&this.error(r),r},e.exports=u},{"./compound_expression":123,"./definitions/array":124,"./definitions/assertion":125,"./definitions/coercion":129,"./definitions/literal":134,"./definitions/var":137,"./evaluation_context":138,"./is_constant":140,"./parsing_error":142,"./scope":144,"./types":146}],142:[function(t,e,r){var n=function(t){function e(e,r){t.call(this,r),this.message=r,this.key=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error);e.exports=n},{}],143:[function(t,e,r){var n=function(t){this.name="ExpressionEvaluationError",this.message=t};n.prototype.toJSON=function(){return this.message},e.exports=n},{}],144:[function(t,e,r){var n=function(t,e){void 0===e&&(e=[]),this.parent=t,this.bindings={};for(var r=0,n=e;rr&&ee))throw new n("Input is not a number.");o=s-1}}return Math.max(s-1,0)}}},{"./runtime_error":143}],146:[function(t,e,r){function n(t,e){return{kind:"array",itemType:t,N:e}}function i(t){if("array"===t.kind){var e=i(t.itemType);return"number"==typeof t.N?"array<"+e+", "+t.N+">":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var a={kind:"null"},o={kind:"number"},s={kind:"string"},l={kind:"boolean"},c={kind:"color"},u={kind:"object"},f={kind:"value"},h=[a,o,s,l,c,u,n(f)];e.exports={NullType:a,NumberType:o,StringType:s,BooleanType:l,ColorType:c,ObjectType:u,ValueType:f,array:n,ErrorType:{kind:"error"},toString:i,checkSubtype:function t(e,r){if("error"===r.kind)return null;if("array"===e.kind){if("array"===r.kind&&!t(e.itemType,r.itemType)&&("number"!=typeof e.N||e.N===r.N))return null}else{if(e.kind===r.kind)return null;if("value"===e.kind)for(var n=0,a=h;n=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."},isValue:function t(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof n)return!0;if(Array.isArray(e)){for(var r=0,i=e;r=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3===t.length&&(Array.isArray(t[1])||Array.isArray(t[2]));case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function a(t){if(!t)return!0;var e=t[0];return t.length<=1?"any"!==e:"=="===e?o(t[1],t[2],"=="):"!="===e?c(o(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?o(t[1],t[2],e):"any"===e?function(t){return["any"].concat(t.map(a))}(t.slice(1)):"all"===e?["all"].concat(t.slice(1).map(a)):"none"===e?["all"].concat(t.slice(1).map(a).map(c)):"in"===e?s(t[1],t.slice(2)):"!in"===e?c(s(t[1],t.slice(2))):"has"===e?l(t[1]):"!has"!==e||c(l(t[1]))}function o(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function s(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(function(t){return typeof t!=typeof e[0]})?["filter-in-large",t,["literal",e.sort(i)]]:["filter-in-small",t,["literal",e]]}}function l(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function c(t){return["!",t]}var u=t("../expression").createExpression;e.exports=function(t){if(!t)return function(){return!0};n(t)||(t=a(t));var e=u(t,f);if("error"===e.result)throw new Error(e.value.map(function(t){return t.key+": "+t.message}).join(", "));return function(t,r){return e.value.evaluate(t,r)}},e.exports.isExpressionFilter=n;var f={type:"boolean",default:!1,function:!0,"property-function":!0,"zoom-function":!0}},{"../expression":139}],149:[function(t,e,r){function n(t){return t}function i(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function a(t,e,r,n,a){return i(typeof r===a?n[r]:void 0,t.default,e.default)}function o(t,e,r){if("number"!==p(r))return i(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var a=c(t.stops,r);return t.stops[a][1]}function s(t,e,r){var a=void 0!==t.base?t.base:1;if("number"!==p(r))return i(t.default,e.default);var o=t.stops.length;if(1===o)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[o-1][0])return t.stops[o-1][1];var s=c(t.stops,r),l=function(t,e,r,n){var i=n-r,a=t-r;return 0===i?0:1===e?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}(r,a,t.stops[s][0],t.stops[s+1][0]),f=t.stops[s][1],h=t.stops[s+1][1],g=d[e.type]||n;if(t.colorSpace&&"rgb"!==t.colorSpace){var m=u[t.colorSpace];g=function(t,e){return m.reverse(m.interpolate(m.forward(t),m.forward(e),l))}}return"function"==typeof f.evaluate?{evaluate:function(){for(var t=arguments,e=[],r=arguments.length;r--;)e[r]=t[r];var n=f.evaluate.apply(void 0,e),i=h.evaluate.apply(void 0,e);if(void 0!==n&&void 0!==i)return g(n,i,l)}}:g(f,h,l)}function l(t,e,r){return"color"===e.type?r=f.parse(r):p(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),i(r,t.default,e.default)}function c(t,e){for(var r,n,i=0,a=t.length-1,o=0;i<=a;){if(r=t[o=Math.floor((i+a)/2)][0],n=t[o+1][0],e===r||e>r&&ee&&(a=o-1)}return Math.max(o-1,0)}var u=t("../util/color_spaces"),f=t("../util/color"),h=t("../util/extend"),p=t("../util/get_type"),d=t("../util/interpolate"),g=t("../expression/definitions/interpolate");e.exports={createFunction:function t(e,r){var n,c,p,d="color"===r.type,m=e.stops&&"object"==typeof e.stops[0][0],v=m||void 0!==e.property,y=m||!v,x=e.type||("interpolated"===r.function?"exponential":"interval");if(d&&((e=h({},e)).stops&&(e.stops=e.stops.map(function(t){return[t[0],f.parse(t[1])]})),e.default?e.default=f.parse(e.default):e.default=f.parse(r.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!u[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);if("exponential"===x)n=s;else if("interval"===x)n=o;else if("categorical"===x){n=a,c=Object.create(null);for(var b=0,_=e.stops;b<_.length;b+=1){var w=_[b];c[w[0]]=w[1]}p=typeof e.stops[0][0]}else{if("identity"!==x)throw new Error('Unknown function type "'+x+'"');n=l}if(m){for(var k={},M=[],A=0;A":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},transition:!1,"zoom-function":!0,"property-function":!1,function:"piecewise-constant"},position:{type:"array",default:[1.15,210,30],length:3,value:"number",transition:!0,function:"interpolated","zoom-function":!0,"property-function":!1},color:{type:"color",default:"#ffffff",function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0},intensity:{type:"number",default:.5,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!0},"fill-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:1,minimum:0,maximum:1,transition:!0},"fill-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["fill-translate"]},"fill-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!1,default:1,minimum:0,maximum:1,transition:!0},"fill-extrusion-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-extrusion-pattern"}]},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"fill-extrusion-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"]},"fill-extrusion-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0},"fill-extrusion-height":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:0,minimum:0,units:"meters",transition:!0},"fill-extrusion-base":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"]}},paint_line:{"line-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["line-translate"]},"line-width":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-gap-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-offset":{type:"number",default:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-dasharray":{type:"array",value:"number",function:"piecewise-constant","zoom-function":!0,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-blur":{type:"number",default:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map"},"circle-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"viewport"},"circle-stroke-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-stroke-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"heatmap-weight":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!1},"heatmap-intensity":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],function:"interpolated","zoom-function":!1,"property-function":!1,transition:!1},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-halo-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-halo-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-hue-rotate":{type:"number",default:0,period:360,function:"interpolated","zoom-function":!0,transition:!0,units:"degrees"},"raster-brightness-min":{type:"number",function:"interpolated","zoom-function":!0,default:0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number",function:"interpolated","zoom-function":!0,default:1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-fade-duration":{type:"number",default:300,minimum:0,function:"interpolated","zoom-function":!0,transition:!1,units:"milliseconds"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,function:"interpolated","zoom-function":!0,transition:!1},"hillshade-illumination-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"viewport"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"hillshade-shadow-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",function:"interpolated","zoom-function":!0,transition:!0},"hillshade-accent-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0}},paint_background:{"background-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}}}},{}],153:[function(t,e,r){var n=t("csscolorparser").parseCSSColor,i=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};i.parse=function(t){if(t){if(t instanceof i)return t;if("string"==typeof t){var e=n(t);if(e)return new i(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},i.prototype.toString=function(){var t=this;return"rgba("+[this.r,this.g,this.b].map(function(e){return Math.round(255*e/t.a)}).concat(this.a).join(",")+")"},i.black=new i(0,0,0,1),i.white=new i(1,1,1,1),i.transparent=new i(0,0,0,0),e.exports=i},{csscolorparser:13}],154:[function(t,e,r){function n(t){return t>v?Math.pow(t,1/3):t/m+d}function i(t){return t>g?t*t*t:m*(t-d)}function a(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function o(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function s(t){var e=o(t.r),r=o(t.g),i=o(t.b),a=n((.4124564*e+.3575761*r+.1804375*i)/f),s=n((.2126729*e+.7151522*r+.072175*i)/h);return{l:116*s-16,a:500*(a-s),b:200*(s-n((.0193339*e+.119192*r+.9503041*i)/p)),alpha:t.a}}function l(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=h*i(e),r=f*i(r),n=p*i(n),new c(a(3.2404542*r-1.5371385*e-.4985314*n),a(-.969266*r+1.8760108*e+.041556*n),a(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}var c=t("./color"),u=t("./interpolate").number,f=.95047,h=1,p=1.08883,d=4/29,g=6/29,m=3*g*g,v=g*g*g,y=Math.PI/180,x=180/Math.PI;e.exports={lab:{forward:s,reverse:l,interpolate:function(t,e,r){return{l:u(t.l,e.l,r),a:u(t.a,e.a,r),b:u(t.b,e.b,r),alpha:u(t.alpha,e.alpha,r)}}},hcl:{forward:function(t){var e=s(t),r=e.l,n=e.a,i=e.b,a=Math.atan2(i,n)*x;return{h:a<0?a+360:a,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*y,r=t.c;return l({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:function(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}(t.h,e.h,r),c:u(t.c,e.c,r),l:u(t.l,e.l,r),alpha:u(t.alpha,e.alpha,r)}}}}},{"./color":153,"./interpolate":158}],155:[function(t,e,r){e.exports=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var n=0;n0;)r[n]=e[n+1];for(var i=0,a=r;i":case">=":r.length>=2&&"$type"===s(r[1])&&u.push(new n(i,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&u.push(new n(i,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(l=o(r[1]))&&u.push(new n(i+"[1]",r[1],"string expected, "+l+" found"));for(var f=2;fc(s[0].zoom))return[new n(u,s[0].zoom,"stop zoom values must appear in ascending order")];c(s[0].zoom)!==h&&(h=c(s[0].zoom),f=void 0,g={}),e=e.concat(o({key:u+"[0]",value:s[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:l,value:r}}))}else e=e.concat(r({key:u+"[0]",value:s[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},s));return e.concat(a({key:u+"[1]",value:s[1],valueSpec:p,style:t.style,styleSpec:t.styleSpec}))}function r(t,e){var r=i(t.value),a=c(t.value),o=null!==t.value?t.value:e;if(u){if(r!==u)return[new n(t.key,o,r+" stop domain type must match previous stop domain type "+u)]}else u=r;if("number"!==r&&"string"!==r&&"boolean"!==r)return[new n(t.key,o,"stop domain value must be a number, string, or boolean")];if("number"!==r&&"categorical"!==d){var s="number expected, "+r+" found";return p["property-function"]&&void 0===d&&(s+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new n(t.key,o,s)]}return"categorical"!==d||"number"!==r||isFinite(a)&&Math.floor(a)===a?"categorical"!==d&&"number"===r&&void 0!==f&&a=8&&(v&&!t.valueSpec["property-function"]?x.push(new n(t.key,t.value,"property functions not supported")):m&&!t.valueSpec["zoom-function"]&&"heatmap-color"!==t.objectKey&&x.push(new n(t.key,t.value,"zoom functions not supported"))),"categorical"!==d&&!y||void 0!==t.value.property||x.push(new n(t.key,t.value,'"property" property is required')),x}},{"../error/validation_error":122,"../util/get_type":157,"../util/unbundle_jsonlint":161,"./validate":162,"./validate_array":163,"./validate_number":175,"./validate_object":176}],171:[function(t,e,r){var n=t("../error/validation_error"),i=t("./validate_string");e.exports=function(t){var e=t.value,r=t.key,a=i(t);return a.length?a:(-1===e.indexOf("{fontstack}")&&a.push(new n(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&a.push(new n(r,e,'"glyphs" url must include a "{range}" token')),a)}},{"../error/validation_error":122,"./validate_string":180}],172:[function(t,e,r){var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),a=t("./validate_object"),o=t("./validate_filter"),s=t("./validate_paint_property"),l=t("./validate_layout_property"),c=t("./validate"),u=t("../util/extend");e.exports=function(t){var e=[],r=t.value,f=t.key,h=t.style,p=t.styleSpec;r.type||r.ref||e.push(new n(f,r,'either "type" or "ref" is required'));var d,g=i(r.type),m=i(r.ref);if(r.id)for(var v=i(r.id),y=0;ya.maximum?[new i(e,r,r+" is greater than the maximum value "+a.maximum)]:[]}},{"../error/validation_error":122,"../util/get_type":157}],176:[function(t,e,r){var n=t("../error/validation_error"),i=t("../util/get_type"),a=t("./validate");e.exports=function(t){var e=t.key,r=t.value,o=t.valueSpec||{},s=t.objectElementValidators||{},l=t.style,c=t.styleSpec,u=[],f=i(r);if("object"!==f)return[new n(e,r,"object expected, "+f+" found")];for(var h in r){var p=h.split(".")[0],d=o[p]||o["*"],g=void 0;if(s[p])g=s[p];else if(o[p])g=a;else if(s["*"])g=s["*"];else{if(!o["*"]){u.push(new n(e,r[h],'unknown property "'+h+'"'));continue}g=a}u=u.concat(g({key:(e?e+".":e)+h,value:r[h],valueSpec:d,style:l,styleSpec:c,object:r,objectKey:h},r))}for(var m in o)s[m]||o[m].required&&void 0===o[m].default&&void 0===r[m]&&u.push(new n(e,r,'missing required property "'+m+'"'));return u}},{"../error/validation_error":122,"../util/get_type":157,"./validate":162}],177:[function(t,e,r){var n=t("./validate_property");e.exports=function(t){return n(t,"paint")}},{"./validate_property":178}],178:[function(t,e,r){var n=t("./validate"),i=t("../error/validation_error"),a=t("../util/get_type"),o=t("../function").isFunction,s=t("../util/unbundle_jsonlint");e.exports=function(t,e){var r=t.key,l=t.style,c=t.styleSpec,u=t.value,f=t.objectKey,h=c[e+"_"+t.layerType];if(!h)return[];var p=f.match(/^(.*)-transition$/);if("paint"===e&&p&&h[p[1]]&&h[p[1]].transition)return n({key:r,value:u,valueSpec:c.transition,style:l,styleSpec:c});var d,g=t.valueSpec||h[f];if(!g)return[new i(r,u,'unknown property "'+f+'"')];if("string"===a(u)&&g["property-function"]&&!g.tokens&&(d=/^{([^}]+)}$/.exec(u)))return[new i(r,u,'"'+f+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(d[1])+" }`.")];var m=[];return"symbol"===t.layerType&&("text-field"===f&&l&&!l.glyphs&&m.push(new i(r,u,'use of "text-field" requires a style "glyphs" property')),"text-font"===f&&o(s.deep(u))&&"identity"===s(u.type)&&m.push(new i(r,u,'"text-font" does not support identity functions'))),m.concat(n({key:t.key,value:u,valueSpec:g,style:l,styleSpec:c,expressionContext:"property",propertyKey:f}))}},{"../error/validation_error":122,"../function":149,"../util/get_type":157,"../util/unbundle_jsonlint":161,"./validate":162}],179:[function(t,e,r){var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),a=t("./validate_object"),o=t("./validate_enum");e.exports=function(t){var e=t.value,r=t.key,s=t.styleSpec,l=t.style;if(!e.type)return[new n(r,e,'"type" is required')];var c=i(e.type),u=[];switch(c){case"vector":case"raster":case"raster-dem":if(u=u.concat(a({key:r,value:e,valueSpec:s["source_"+c.replace("-","_")],style:t.style,styleSpec:s})),"url"in e)for(var f in e)["type","url","tileSize"].indexOf(f)<0&&u.push(new n(r+"."+f,e[f],'a source with a "url" property may not include a "'+f+'" property'));return u;case"geojson":return a({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return a({key:r,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return a({key:r,value:e,valueSpec:s.source_image,style:l,styleSpec:s});case"canvas":return a({key:r,value:e,valueSpec:s.source_canvas,style:l,styleSpec:s});default:return o({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image","canvas"]},style:l,styleSpec:s})}}},{"../error/validation_error":122,"../util/unbundle_jsonlint":161,"./validate_enum":167,"./validate_object":176}],180:[function(t,e,r){var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.key,a=n(e);return"string"!==a?[new i(r,e,"string expected, "+a+" found")]:[]}},{"../error/validation_error":122,"../util/get_type":157}],181:[function(t,e,r){function n(t,e){e=e||l;var r=[];return r=r.concat(s({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:c,"*":function(){return[]}}})),t.constants&&(r=r.concat(o({key:"constants",value:t.constants,style:t,styleSpec:e}))),i(r)}function i(t){return[].concat(t).sort(function(t,e){return t.line-e.line})}function a(t){return function(){return i(t.apply(this,arguments))}}var o=t("./validate/validate_constants"),s=t("./validate/validate"),l=t("./reference/latest"),c=t("./validate/validate_glyphs_url");n.source=a(t("./validate/validate_source")),n.light=a(t("./validate/validate_light")),n.layer=a(t("./validate/validate_layer")),n.filter=a(t("./validate/validate_filter")),n.paintProperty=a(t("./validate/validate_paint_property")),n.layoutProperty=a(t("./validate/validate_layout_property")),e.exports=n},{"./reference/latest":151,"./validate/validate":162,"./validate/validate_constants":166,"./validate/validate_filter":169,"./validate/validate_glyphs_url":171,"./validate/validate_layer":172,"./validate/validate_layout_property":173,"./validate/validate_light":174,"./validate/validate_paint_property":177,"./validate/validate_source":179}],182:[function(t,e,r){var n=t("./zoom_history"),i=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new n,this.transition={})};i.prototype.crossFadingFactor=function(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},e.exports=i},{"./zoom_history":212}],183:[function(t,e,r){var n=t("../style-spec/reference/latest"),i=t("../util/util"),a=t("../util/evented"),o=t("./validate_style"),s=t("../util/util").sphericalToCartesian,l=(t("../style-spec/util/color"),t("../style-spec/util/interpolate")),c=t("./properties"),u=c.Properties,f=c.Transitionable,h=(c.Transitioning,c.PossiblyEvaluated,c.DataConstantProperty),p=function(){this.specification=n.light.position};p.prototype.possiblyEvaluate=function(t,e){return s(t.expression.evaluate(e))},p.prototype.interpolate=function(t,e,r){return{x:l.number(t.x,e.x,r),y:l.number(t.y,e.y,r),z:l.number(t.z,e.z,r)}};var d=new u({anchor:new h(n.light.anchor),position:new p,color:new h(n.light.color),intensity:new h(n.light.intensity)}),g=function(t){function e(e){t.call(this),this._transitionable=new f(d),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getLight=function(){return this._transitionable.serialize()},e.prototype.setLight=function(t){if(!this._validate(o.light,t))for(var e in t){var r=t[e];i.endsWith(e,"-transition")?this._transitionable.setTransition(e.slice(0,-"-transition".length),r):this._transitionable.setValue(e,r)}},e.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},e.prototype.hasTransition=function(){return this._transitioning.hasTransition()},e.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},e.prototype._validate=function(t,e){return o.emitErrors(this,t.call(o,i.extend({value:e,style:{glyphs:!0,sprite:!0},styleSpec:n})))},e}(a);e.exports=g},{"../style-spec/reference/latest":151,"../style-spec/util/color":153,"../style-spec/util/interpolate":158,"../util/evented":260,"../util/util":275,"./properties":188,"./validate_style":211}],184:[function(t,e,r){var n=t("../util/mapbox").normalizeGlyphsURL,i=t("../util/ajax"),a=t("./parse_glyph_pbf");e.exports=function(t,e,r,o,s){var l=256*e,c=l+255,u=o(n(r).replace("{fontstack}",t).replace("{range}",l+"-"+c),i.ResourceType.Glyphs);i.getArrayBuffer(u,function(t,e){if(t)s(t);else if(e){for(var r={},n=0,i=a(e.data);n1?"@2x":"";n.getJSON(e(a(t,f,".json"),n.ResourceType.SpriteJSON),function(t,e){u||(u=t,l=e,s())}),n.getImage(e(a(t,f,".png"),n.ResourceType.SpriteImage),function(t,e){u||(u=t,c=e,s())})}},{"../util/ajax":251,"../util/browser":252,"../util/image":263,"../util/mapbox":267}],186:[function(t,e,r){function n(t,e,r){1===t&&r.readMessage(i,e)}function i(t,e,r){if(3===t){var n=r.readMessage(a,{}),i=n.id,s=n.bitmap,c=n.width,u=n.height,f=n.left,h=n.top,p=n.advance;e.push({id:i,bitmap:new o({width:c+2*l,height:u+2*l},s),metrics:{width:c,height:u,left:f,top:h,advance:p}})}}function a(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}var o=t("../util/image").AlphaImage,s=t("pbf"),l=3;e.exports=function(t){return new s(t).readFields(n,[])},e.exports.GLYPH_PBF_BORDER=l},{"../util/image":263,pbf:30}],187:[function(t,e,r){var n=t("../util/browser"),i=t("../symbol/placement"),a=function(){this._currentTileIndex=0,this._seenCrossTileIDs={}};a.prototype.continuePlacement=function(t,e,r,n,i){for(var a=this;this._currentTileIndex2};this._currentPlacementIndex>=0;){var l=e[t[i._currentPlacementIndex]],c=i.placement.collisionIndex.transform.zoom;if("symbol"===l.type&&(!l.minzoom||l.minzoom<=c)&&(!l.maxzoom||l.maxzoom>c)){if(i._inProgressLayer||(i._inProgressLayer=new a),i._inProgressLayer.continuePlacement(r[l.source],i.placement,i._showCollisionBoxes,l,s))return;delete i._inProgressLayer}i._currentPlacementIndex--}this._done=!0},o.prototype.commit=function(t,e){return this.placement.commit(t,e),this.placement},e.exports=o},{"../symbol/placement":223,"../util/browser":252}],188:[function(t,e,r){var n=t("../util/util"),i=n.clone,a=n.extend,o=n.easeCubicInOut,s=t("../style-spec/util/interpolate"),l=t("../style-spec/expression").normalizePropertyExpression,c=(t("../style-spec/util/color"),t("../util/web_worker_transfer").register),u=function(t,e){this.property=t,this.value=e,this.expression=l(void 0===e?t.specification.default:e,t.specification)};u.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},u.prototype.possiblyEvaluate=function(t){return this.property.possiblyEvaluate(this,t)};var f=function(t){this.property=t,this.value=new u(t,void 0)};f.prototype.transitioned=function(t,e){return new p(this.property,this.value,e,a({},t.transition,this.transition),t.now)},f.prototype.untransitioned=function(){return new p(this.property,this.value,null,{},0)};var h=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};h.prototype.getValue=function(t){return i(this._values[t].value.value)},h.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new f(this._values[t].property)),this._values[t].value=new u(this._values[t].property,null===e?void 0:i(e))},h.prototype.getTransition=function(t){return i(this._values[t].transition)},h.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new f(this._values[t].property)),this._values[t].transition=i(e)||void 0},h.prototype.serialize=function(){for(var t=this,e={},r=0,n=Object.keys(t._values);rthis.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(en.zoomHistory.lastIntegerZoom?{from:t,to:e,fromScale:2,toScale:1,t:a+(1-a)*o}:{from:r,to:e,fromScale:.5,toScale:1,t:1-(1-o)*a}},b.prototype.interpolate=function(t){return t};var _=function(t){this.specification=t};_.prototype.possiblyEvaluate=function(){},_.prototype.interpolate=function(){};c("DataDrivenProperty",x),c("DataConstantProperty",y),c("CrossFadedProperty",b),c("HeatmapColorProperty",_),e.exports={PropertyValue:u,Transitionable:h,Transitioning:d,Layout:g,PossiblyEvaluatedPropertyValue:m,PossiblyEvaluated:v,DataConstantProperty:y,DataDrivenProperty:x,CrossFadedProperty:b,HeatmapColorProperty:_,Properties:function(t){var e=this;for(var r in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},t){var n=t[r],i=e.defaultPropertyValues[r]=new u(n,void 0),a=e.defaultTransitionablePropertyValues[r]=new f(n);e.defaultTransitioningPropertyValues[r]=a.untransitioned(),e.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}}},{"../style-spec/expression":139,"../style-spec/util/color":153,"../style-spec/util/interpolate":158,"../util/util":275,"../util/web_worker_transfer":278}],189:[function(t,e,r){var n=t("@mapbox/point-geometry");e.exports={getMaximumPaintValue:function(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).binders[t].statistics.max},translateDistance:function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])},translate:function(t,e,r,i,a){if(!e[0]&&!e[1])return t;var o=n.convert(e);"viewport"===r&&o._rotate(-i);for(var s=[],l=0;l0)throw new Error("Unimplemented: "+n.map(function(t){return t.command}).join(", ")+".");return r.forEach(function(t){"setTransition"!==t.command&&e[t.command].apply(e,t.args)}),this.stylesheet=t,!0},e.prototype.addImage=function(t,e){if(this.getImage(t))return this.fire("error",{error:new Error("An image with this name already exists.")});this.imageManager.addImage(t,e),this.fire("data",{dataType:"style"})},e.prototype.getImage=function(t){return this.imageManager.getImage(t)},e.prototype.removeImage=function(t){if(!this.getImage(t))return this.fire("error",{error:new Error("No image with this name exists.")});this.imageManager.removeImage(t),this.fire("data",{dataType:"style"})},e.prototype.addSource=function(t,e,r){var n=this;if(this._checkLoaded(),void 0!==this.sourceCaches[t])throw new Error("There is already a source with this ID");if(!e.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(e).join(", ")+".");if(!(["vector","raster","geojson","video","image","canvas"].indexOf(e.type)>=0&&this._validate(g.source,"sources."+t,e,null,r))){this.map&&this.map._collectResourceTiming&&(e.collectResourceTiming=!0);var i=this.sourceCaches[t]=new x(t,e,this.dispatcher);i.style=this,i.setEventedParent(this,function(){return{isSourceLoaded:n.loaded(),source:i.serialize(),sourceId:t}}),i.onAdd(this.map),this._changed=!0}},e.prototype.removeSource=function(t){var e=this;if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error("There is no source with this ID");for(var r in e._layers)if(e._layers[r].source===t)return e.fire("error",{error:new Error('Source "'+t+'" cannot be removed while layer "'+r+'" is using it.')});var n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire("data",{sourceDataType:"metadata",dataType:"source",sourceId:t}),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},e.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},e.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},e.prototype.addLayer=function(t,e,r){this._checkLoaded();var n=t.id;if("object"==typeof t.source&&(this.addSource(n,t.source),t=u.clone(t),t=u.extend(t,{source:n})),!this._validate(g.layer,"layers."+n,t,{arrayIndex:-1},r)){var a=i.create(t);this._validateLayer(a),a.setEventedParent(this,{layer:{id:n}});var o=e?this._order.indexOf(e):this._order.length;if(e&&-1===o)return void this.fire("error",{error:new Error('Layer with id "'+e+'" does not exist on this map.')});if(this._order.splice(o,0,n),this._layerOrderChanged=!0,this._layers[n]=a,this._removedLayers[n]&&a.source){var s=this._removedLayers[n];delete this._removedLayers[n],s.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a)}},e.prototype.moveLayer=function(t,e){if(this._checkLoaded(),this._changed=!0,this._layers[t]){var r=this._order.indexOf(t);this._order.splice(r,1);var n=e?this._order.indexOf(e):this._order.length;e&&-1===n?this.fire("error",{error:new Error('Layer with id "'+e+'" does not exist on this map.')}):(this._order.splice(n,0,t),this._layerOrderChanged=!0)}else this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot be moved.")})},e.prototype.removeLayer=function(t){this._checkLoaded();var e=this._layers[t];if(e){e.setEventedParent(null);var r=this._order.indexOf(t);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=e,delete this._layers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t]}else this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot be removed.")})},e.prototype.getLayer=function(t){return this._layers[t]},e.prototype.setLayerZoomRange=function(t,e,r){this._checkLoaded();var n=this.getLayer(t);n?n.minzoom===e&&n.maxzoom===r||(null!=e&&(n.minzoom=e),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot have zoom extent.")})},e.prototype.setFilter=function(t,e){this._checkLoaded();var r=this.getLayer(t);if(r)return u.deepEqual(r.filter,e)?void 0:null===e||void 0===e?(r.filter=void 0,void this._updateLayer(r)):void(this._validate(g.filter,"layers."+r.id+".filter",e)||(r.filter=u.clone(e),this._updateLayer(r)));this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot be filtered.")})},e.prototype.getFilter=function(t){return u.clone(this.getLayer(t).filter)},e.prototype.setLayoutProperty=function(t,e,r){this._checkLoaded();var n=this.getLayer(t);n?u.deepEqual(n.getLayoutProperty(e),r)||(n.setLayoutProperty(e,r),this._updateLayer(n)):this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot be styled.")})},e.prototype.getLayoutProperty=function(t,e){return this.getLayer(t).getLayoutProperty(e)},e.prototype.setPaintProperty=function(t,e,r){this._checkLoaded();var n=this.getLayer(t);if(n){if(!u.deepEqual(n.getPaintProperty(e),r)){var i=n._transitionablePaint._values[e].value.isDataDriven();n.setPaintProperty(e,r),(n._transitionablePaint._values[e].value.isDataDriven()||i)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[t]=!0}}else this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot be styled.")})},e.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},e.prototype.getTransition=function(){return u.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},e.prototype.serialize=function(){var t=this;return u.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:u.mapObject(this.sourceCaches,function(t){return t.serialize()}),layers:this._order.map(function(e){return t._layers[e].serialize()})},function(t){return void 0!==t})},e.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},e.prototype._flattenRenderedFeatures=function(t){for(var e=[],r=this._order.length-1;r>=0;r--)for(var n=this._order[r],i=0,a=t;i=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t)),this.paint=this._transitioningPaint.possiblyEvaluate(t)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return"none"===this.visibility&&(t.layout=t.layout||{},t.layout.visibility="none"),n.filterObject(t,function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)})},e.prototype._validate=function(t,e,r,n,o){return(!o||!1!==o.validate)&&a.emitErrors(this,t.call(a,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:i,style:{glyphs:!0,sprite:!0}}))},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e}(o));e.exports=u;var f={circle:t("./style_layer/circle_style_layer"),heatmap:t("./style_layer/heatmap_style_layer"),hillshade:t("./style_layer/hillshade_style_layer"),fill:t("./style_layer/fill_style_layer"),"fill-extrusion":t("./style_layer/fill_extrusion_style_layer"),line:t("./style_layer/line_style_layer"),symbol:t("./style_layer/symbol_style_layer"),background:t("./style_layer/background_style_layer"),raster:t("./style_layer/raster_style_layer")};u.create=function(t){return new f[t.type](t)}},{"../style-spec/reference/latest":151,"../util/evented":260,"../util/util":275,"./properties":188,"./style_layer/background_style_layer":192,"./style_layer/circle_style_layer":194,"./style_layer/fill_extrusion_style_layer":196,"./style_layer/fill_style_layer":198,"./style_layer/heatmap_style_layer":200,"./style_layer/hillshade_style_layer":202,"./style_layer/line_style_layer":204,"./style_layer/raster_style_layer":206,"./style_layer/symbol_style_layer":208,"./validate_style":211}],192:[function(t,e,r){var n=t("../style_layer"),i=t("./background_style_layer_properties"),a=t("../properties"),o=(a.Transitionable,a.Transitioning,a.PossiblyEvaluated,function(t){function e(e){t.call(this,e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(n));e.exports=o},{"../properties":188,"../style_layer":191,"./background_style_layer_properties":193}],193:[function(t,e,r){var n=t("../../style-spec/reference/latest"),i=t("../properties"),a=i.Properties,o=i.DataConstantProperty,s=(i.DataDrivenProperty,i.CrossFadedProperty),l=(i.HeatmapColorProperty,new a({"background-color":new o(n.paint_background["background-color"]),"background-pattern":new s(n.paint_background["background-pattern"]),"background-opacity":new o(n.paint_background["background-opacity"])}));e.exports={paint:l}},{"../../style-spec/reference/latest":151,"../properties":188}],194:[function(t,e,r){var n=t("../style_layer"),i=t("../../data/bucket/circle_bucket"),a=t("../../util/intersection_tests").multiPolygonIntersectsBufferedMultiPoint,o=t("../query_utils"),s=o.getMaximumPaintValue,l=o.translateDistance,c=o.translate,u=t("./circle_style_layer_properties"),f=t("../properties"),h=(f.Transitionable,f.Transitioning,f.PossiblyEvaluated,function(t){function e(e){t.call(this,e,u)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new i(t)},e.prototype.queryRadius=function(t){var e=t;return s("circle-radius",this,e)+s("circle-stroke-width",this,e)+l(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o){var s=c(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),i,o),l=this.paint.get("circle-radius").evaluate(e)*o,u=this.paint.get("circle-stroke-width").evaluate(e)*o;return a(s,r,l+u)},e}(n));e.exports=h},{"../../data/bucket/circle_bucket":42,"../../util/intersection_tests":264,"../properties":188,"../query_utils":189,"../style_layer":191,"./circle_style_layer_properties":195}],195:[function(t,e,r){var n=t("../../style-spec/reference/latest"),i=t("../properties"),a=i.Properties,o=i.DataConstantProperty,s=i.DataDrivenProperty,l=(i.CrossFadedProperty,i.HeatmapColorProperty,new a({"circle-radius":new s(n.paint_circle["circle-radius"]),"circle-color":new s(n.paint_circle["circle-color"]),"circle-blur":new s(n.paint_circle["circle-blur"]),"circle-opacity":new s(n.paint_circle["circle-opacity"]),"circle-translate":new o(n.paint_circle["circle-translate"]),"circle-translate-anchor":new o(n.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new o(n.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new o(n.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new s(n.paint_circle["circle-stroke-width"]),"circle-stroke-color":new s(n.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new s(n.paint_circle["circle-stroke-opacity"])}));e.exports={paint:l}},{"../../style-spec/reference/latest":151,"../properties":188}],196:[function(t,e,r){var n=t("../style_layer"),i=t("../../data/bucket/fill_extrusion_bucket"),a=t("../../util/intersection_tests").multiPolygonIntersectsMultiPolygon,o=t("../query_utils"),s=o.translateDistance,l=o.translate,c=t("./fill_extrusion_style_layer_properties"),u=t("../properties"),f=(u.Transitionable,u.Transitioning,u.PossiblyEvaluated,function(t){function e(e){t.call(this,e,c)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new i(t)},e.prototype.queryRadius=function(){return s(this.paint.get("fill-extrusion-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o){var s=l(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),i,o);return a(s,r)},e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("fill-extrusion-opacity")&&"none"!==this.visibility},e.prototype.resize=function(){this.viewportFrame&&(this.viewportFrame.destroy(),this.viewportFrame=null)},e}(n));e.exports=f},{"../../data/bucket/fill_extrusion_bucket":46,"../../util/intersection_tests":264,"../properties":188,"../query_utils":189,"../style_layer":191,"./fill_extrusion_style_layer_properties":197}],197:[function(t,e,r){var n=t("../../style-spec/reference/latest"),i=t("../properties"),a=i.Properties,o=i.DataConstantProperty,s=i.DataDrivenProperty,l=i.CrossFadedProperty,c=(i.HeatmapColorProperty,new a({"fill-extrusion-opacity":new o(n["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new s(n["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new o(n["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new o(n["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new l(n["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new s(n["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new s(n["paint_fill-extrusion"]["fill-extrusion-base"])}));e.exports={paint:c}},{"../../style-spec/reference/latest":151,"../properties":188}],198:[function(t,e,r){var n=t("../style_layer"),i=t("../../data/bucket/fill_bucket"),a=t("../../util/intersection_tests").multiPolygonIntersectsMultiPolygon,o=t("../query_utils"),s=o.translateDistance,l=o.translate,c=t("./fill_style_layer_properties"),u=t("../properties"),f=(u.Transitionable,u.Transitioning,u.PossiblyEvaluated,function(t){function e(e){t.call(this,e,c)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.recalculate=function(t){this.paint=this._transitioningPaint.possiblyEvaluate(t),void 0===this._transitionablePaint.getValue("fill-outline-color")&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},e.prototype.createBucket=function(t){return new i(t)},e.prototype.queryRadius=function(){return s(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o){var s=l(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),i,o);return a(s,r)},e}(n));e.exports=f},{"../../data/bucket/fill_bucket":44,"../../util/intersection_tests":264,"../properties":188,"../query_utils":189,"../style_layer":191,"./fill_style_layer_properties":199}],199:[function(t,e,r){var n=t("../../style-spec/reference/latest"),i=t("../properties"),a=i.Properties,o=i.DataConstantProperty,s=i.DataDrivenProperty,l=i.CrossFadedProperty,c=(i.HeatmapColorProperty,new a({"fill-antialias":new o(n.paint_fill["fill-antialias"]),"fill-opacity":new s(n.paint_fill["fill-opacity"]),"fill-color":new s(n.paint_fill["fill-color"]),"fill-outline-color":new s(n.paint_fill["fill-outline-color"]),"fill-translate":new o(n.paint_fill["fill-translate"]),"fill-translate-anchor":new o(n.paint_fill["fill-translate-anchor"]),"fill-pattern":new l(n.paint_fill["fill-pattern"])}));e.exports={paint:c}},{"../../style-spec/reference/latest":151,"../properties":188}],200:[function(t,e,r){var n=t("../style_layer"),i=t("../../data/bucket/heatmap_bucket"),a=t("../../util/image").RGBAImage,o=t("./heatmap_style_layer_properties"),s=t("../properties"),l=(s.Transitionable,s.Transitioning,s.PossiblyEvaluated,function(t){function e(e){t.call(this,e,o),this._updateColorRamp()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new i(t)},e.prototype.setPaintProperty=function(e,r,n){t.prototype.setPaintProperty.call(this,e,r,n),"heatmap-color"===e&&this._updateColorRamp()},e.prototype._updateColorRamp=function(){for(var t=this._transitionablePaint._values["heatmap-color"].value.expression,e=new Uint8Array(1024),r=e.length,n=4;n0?e+2*t:t}var i=t("@mapbox/point-geometry"),a=t("../style_layer"),o=t("../../data/bucket/line_bucket"),s=t("../../util/intersection_tests").multiPolygonIntersectsBufferedMultiLine,l=t("../query_utils"),c=l.getMaximumPaintValue,u=l.translateDistance,f=l.translate,h=t("./line_style_layer_properties"),p=t("../../util/util").extend,d=t("../evaluation_parameters"),g=t("../properties"),m=(g.Transitionable,g.Transitioning,g.Layout,g.PossiblyEvaluated,new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new d(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n){return r=p({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n)},e}(g.DataDrivenProperty))(h.paint.properties["line-width"].specification));m.useIntegerZoom=!0;var v=function(t){function e(e){t.call(this,e,h)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.recalculate=function(e){t.prototype.recalculate.call(this,e),this.paint._values["line-floorwidth"]=m.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new o(t)},e.prototype.queryRadius=function(t){var e=t,r=n(c("line-width",this,e),c("line-gap-width",this,e)),i=c("line-offset",this,e);return r/2+Math.abs(i)+u(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,a,o,l){var c=f(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o,l),u=l/2*n(this.paint.get("line-width").evaluate(e),this.paint.get("line-gap-width").evaluate(e)),h=this.paint.get("line-offset").evaluate(e);return h&&(r=function(t,e){for(var r=[],n=new i(0,0),a=0;ar?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom-r/2;){if(--o<0)return!1;s-=t[o].dist(a),a=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],c=0;sn;)c-=l.shift().angleDelta;if(c>i)return!1;o++,s+=f.dist(h)}return!0}},{}],215:[function(t,e,r){var n=t("@mapbox/point-geometry");e.exports=function(t,e,r,i,a){for(var o=[],s=0;s=i&&h.x>=i||(f.x>=i?f=new n(i,f.y+(h.y-f.y)*((i-f.x)/(h.x-f.x)))._round():h.x>=i&&(h=new n(i,f.y+(h.y-f.y)*((i-f.x)/(h.x-f.x)))._round()),f.y>=a&&h.y>=a||(f.y>=a?f=new n(f.x+(h.x-f.x)*((a-f.y)/(h.y-f.y)),a)._round():h.y>=a&&(h=new n(f.x+(h.x-f.x)*((a-f.y)/(h.y-f.y)),a)._round()),c&&f.equals(c[c.length-1])||(c=[f],o.push(c)),c.push(h)))))}return o}},{"@mapbox/point-geometry":4}],216:[function(t,e,r){var n=function(t,e,r,n,i,a,o,s,l,c,u){var f=o.top*s-l,h=o.bottom*s+l,p=o.left*s-l,d=o.right*s+l;if(this.boxStartIndex=t.length,c){var g=h-f,m=d-p;g>0&&(g=Math.max(10*s,g),this._addLineCollisionCircles(t,e,r,r.segment,m,g,n,i,a,u))}else t.emplaceBack(r.x,r.y,p,f,d,h,n,i,a,0,0);this.boxEndIndex=t.length};n.prototype._addLineCollisionCircles=function(t,e,r,n,i,a,o,s,l,c){var u=a/2,f=Math.floor(i/u),h=1+.4*Math.log(c)/Math.LN2,p=Math.floor(f*h/2),d=-a/2,g=r,m=n+1,v=d,y=-i/2,x=y-i/4;do{if(--m<0){if(v>y)return;m=0;break}v-=e[m].dist(g),g=e[m]}while(v>x);for(var b=e[m].dist(e[m+1]),_=-p;_i&&(k+=w-i),!(k=e.length)return;b=e[m].dist(e[m+1])}var M=k-v,A=e[m],T=e[m+1].sub(A)._unit()._mult(M)._add(A)._round(),S=Math.abs(k-d)L)n(t,z,!1);else{var R=m.projectPoint(h,P,D),B=O*S;if(v.length>0){var F=R.x-v[v.length-4],N=R.y-v[v.length-3];if(B*B*2>F*F+N*N&&z+8-E&&j=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},e.exports=l},{"../symbol/projection":224,"../util/intersection_tests":264,"./grid_index":220,"@mapbox/gl-matrix":2,"@mapbox/point-geometry":4}],218:[function(t,e,r){var n=t("../data/extent"),i=512/n/2,a=function(t,e,r){var n=this;this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var i=0,a=e;it.overscaledZ)for(var c in l){var u=l[c];u.tileID.isChildOf(t)&&u.findMatches(e.symbolInstances,t,o)}else{var f=l[t.scaledTo(Number(s)).key];f&&f.findMatches(e.symbolInstances,t,o)}}for(var h=0,p=e.symbolInstances;h=0&&A=0&&T=0&&v+p<=d){var S=new i(A,T,k,x);S._round(),s&&!a(e,S,c,s,l)||y.push(S)}}m+=w}return f||y.length||u||(y=t(e,m/2,o,s,l,c,u,!0,h)),y}(t,d?e/2*u%e:(p/2+2*l)*c*u%e,e,h,r,p*c,d,!1,f)}},{"../style-spec/util/interpolate":158,"../symbol/anchor":213,"./check_max_angle":214}],220:[function(t,e,r){var n=function(t,e,r){var n=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(var a=0;athis.width||n<0||e>this.height)return!i&&[];var a=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n)a=Array.prototype.slice.call(this.boxKeys).concat(this.circleKeys);else{var o={hitTest:i,seenUids:{box:{},circle:{}}};this._forEachCell(t,e,r,n,this._queryCell,a,o)}return i?a.length>0:a},n.prototype._queryCircle=function(t,e,r,n){var i=t-r,a=t+r,o=e-r,s=e+r;if(a<0||i>this.width||s<0||o>this.height)return!n&&[];var l=[],c={hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(i,o,a,s,this._queryCellCircle,l,c),n?l.length>0:l},n.prototype.query=function(t,e,r,n){return this._query(t,e,r,n,!1)},n.prototype.hitTest=function(t,e,r,n){return this._query(t,e,r,n,!0)},n.prototype.hitTestCircle=function(t,e,r){return this._queryCircle(t,e,r,!0)},n.prototype._queryCell=function(t,e,r,n,i,a,o){var s=this,l=o.seenUids,c=this.boxCells[i];if(null!==c)for(var u=this.bboxes,f=0,h=c;f=u[d+0]&&n>=u[d+1]){if(o.hitTest)return a.push(!0),!0;a.push(s.boxKeys[p])}}}var g=this.circleCells[i];if(null!==g)for(var m=this.circles,v=0,y=g;vo*o+s*s},n.prototype._circleAndRectCollide=function(t,e,r,n,i,a,o){var s=(a-n)/2,l=Math.abs(t-(n+s));if(l>s+r)return!1;var c=(o-i)/2,u=Math.abs(e-(i+c));if(u>c+r)return!1;if(l<=s||u<=c)return!0;var f=l-s,h=u-c;return f*f+h*h<=r*r},e.exports=n},{}],221:[function(t,e,r){e.exports=function(t){function e(e){s.push(t[e]),l++}function r(t,e,r){var n=o[t];return delete o[t],o[e]=n,s[n].geometry[0].pop(),s[n].geometry[0]=s[n].geometry[0].concat(r[0]),n}function n(t,e,r){var n=a[e];return delete a[e],a[t]=n,s[n].geometry[0].shift(),s[n].geometry[0]=r[0].concat(s[n].geometry[0]),n}function i(t,e,r){var n=r?e[0][e[0].length-1]:e[0][0];return t+":"+n.x+":"+n.y}for(var a={},o={},s=[],l=0,c=0;c0,M=M&&A.offscreen);var C=_.collisionArrays.textCircles;if(C){var E=t.text.placedSymbolArray.get(_.placedTextSymbolIndices[0]),L=s.evaluateSizeForFeature(t.textSizeData,m,E);T=d.collisionIndex.placeCollisionCircles(C,g.get("text-allow-overlap"),i,a,_.key,E,t.lineVertexArray,t.glyphOffsetArray,L,e,r,o,"map"===g.get("text-pitch-alignment")),w=g.get("text-allow-overlap")||T.circles.length>0,M=M&&T.offscreen}_.collisionArrays.iconBox&&(k=(S=d.collisionIndex.placeCollisionBox(_.collisionArrays.iconBox,g.get("icon-allow-overlap"),a,e)).box.length>0,M=M&&S.offscreen),v||y?y?v||(k=k&&w):w=k&&w:k=w=k&&w,w&&A&&d.collisionIndex.insertCollisionBox(A.box,g.get("text-ignore-placement"),f,h,t.bucketInstanceId,_.textBoxStartIndex),k&&S&&d.collisionIndex.insertCollisionBox(S.box,g.get("icon-ignore-placement"),f,h,t.bucketInstanceId,_.iconBoxStartIndex),w&&T&&d.collisionIndex.insertCollisionCircles(T.circles,g.get("text-ignore-placement"),f,h,t.bucketInstanceId,_.textBoxStartIndex),d.placements[_.crossTileID]=new p(w,k,M||t.justReloaded),l[_.crossTileID]=!0}}t.justReloaded=!1},d.prototype.commit=function(t,e){var r=this;this.commitTime=e;var n=!1,i=t&&0!==this.fadeDuration?(this.commitTime-t.commitTime)/this.fadeDuration:1,a=t?t.opacities:{};for(var o in r.placements){var s=r.placements[o],l=a[o];l?(r.opacities[o]=new h(l,i,s.text,s.icon),n=n||s.text!==l.text.placed||s.icon!==l.icon.placed):(r.opacities[o]=new h(null,i,s.text,s.icon,s.skipFade),n=n||s.text||s.icon)}for(var c in a){var u=a[c];if(!r.opacities[c]){var f=new h(u,i,!1,!1);f.isHidden()||(r.opacities[c]=f,n=n||u.text.placed||u.icon.placed)}}n?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)},d.prototype.updateLayerOpacities=function(t,e){for(var r={},n=0,i=e;n0||l.numVerticalGlyphVertices>0,p=l.numIconVertices>0;if(f){for(var d=i(u.text),g=(l.numGlyphVertices+l.numVerticalGlyphVertices)/4,m=0;mt},d.prototype.setStale=function(){this.stale=!0};var g=Math.pow(2,25),m=Math.pow(2,24),v=Math.pow(2,17),y=Math.pow(2,16),x=Math.pow(2,9),b=Math.pow(2,8),_=Math.pow(2,1);e.exports=d},{"../data/extent":53,"../source/pixels_to_tile_units":104,"../style/style_layer/symbol_style_layer_properties":209,"./collision_index":217,"./projection":224,"./symbol_size":228}],224:[function(t,e,r){function n(t,e){var r=[t.x,t.y,0,1];f(r,r,e);var n=r[3];return{point:new h(r[0]/n,r[1]/n),signedDistanceFromCamera:n}}function i(t,e){var r=t[0]/t[3],n=t[1]/t[3];return r>=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function a(t,e,r,n,i,a,o,s,l,u,f,h){var p=s.glyphStartIndex+s.numGlyphs,d=s.lineStartIndex,g=s.lineStartIndex+s.lineLength,m=e.getoffsetX(s.glyphStartIndex),v=e.getoffsetX(p-1),y=c(t*m,r,n,i,a,o,s.segment,d,g,l,u,f,h);if(!y)return null;var x=c(t*v,r,n,i,a,o,s.segment,d,g,l,u,f,h);return x?{first:y,last:x}:null}function o(t,e,r,n){return t===x.horizontal&&Math.abs(r.y-e.y)>Math.abs(r.x-e.x)*n?{useVertical:!0}:(t===x.vertical?e.yr.x)?{needsFlipping:!0}:null}function s(t,e,r,i,s,u,f,p,d,g,m,y,x,b){var _,w=e/24,k=t.lineOffsetX*e,M=t.lineOffsetY*e;if(t.numGlyphs>1){var A=t.glyphStartIndex+t.numGlyphs,T=t.lineStartIndex,S=t.lineStartIndex+t.lineLength,C=a(w,p,k,M,r,m,y,t,d,u,x,!1);if(!C)return{notEnoughRoom:!0};var E=n(C.first.point,f).point,L=n(C.last.point,f).point;if(i&&!r){var z=o(t.writingMode,E,L,b);if(z)return z}_=[C.first];for(var P=t.glyphStartIndex+1;P0?R.point:l(y,I,D,1,s),F=o(t.writingMode,D,B,b);if(F)return F}var N=c(w*p.getoffsetX(t.glyphStartIndex),k,M,r,m,y,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,d,u,x,!1);if(!N)return{notEnoughRoom:!0};_=[N]}for(var j=0,V=_;j0?1:-1,y=0;i&&(v*=-1,y=Math.PI),v<0&&(y+=Math.PI);for(var x=v>0?c+s:c+s+1,b=x,_=a,w=a,k=0,M=0,A=Math.abs(m);k+M<=A;){if((x+=v)=u)return null;if(w=_,void 0===(_=d[x])){var T=new h(f.getx(x),f.gety(x)),S=n(T,p);if(S.signedDistanceFromCamera>0)_=d[x]=S.point;else{var C=x-v;_=l(0===k?o:new h(f.getx(C),f.gety(C)),T,w,A-k+1,p)}}k+=M,M=w.dist(_)}var E=(A-k)/M,L=_.sub(w),z=L.mult(E)._add(w);return z._add(L._unit()._perp()._mult(r*v)),{point:z,angle:y+Math.atan2(_.y-w.y,_.x-w.x),tileDistance:g?{prevTileDistance:x-v===b?0:f.gettileUnitDistanceFromAnchor(x-v),lastSegmentViewportDistance:A-k}:null}}function u(t,e){for(var r=0;r=w||o.y<0||o.y>=w||t.symbolInstances.push(function(t,e,r,n,a,o,s,l,u,f,h,d,g,x,b,_,w,M,A,T,S,C){var E,L,z=t.addToLineVertexArray(e,r),P=0,D=0,O=0,I=n.horizontal?n.horizontal.text:"",R=[];n.horizontal&&(E=new v(s,r,e,l,u,f,n.horizontal,h,d,g,t.overscaling),D+=i(t,e,n.horizontal,o,g,A,T,x,z,n.vertical?p.horizontal:p.horizontalOnly,R,S,C),n.vertical&&(O+=i(t,e,n.vertical,o,g,A,T,x,z,p.vertical,R,S,C)));var B=E?E.boxStartIndex:t.collisionBoxArray.length,F=E?E.boxEndIndex:t.collisionBoxArray.length;if(a){var N=m(e,a,o,w,n.horizontal,A,T);L=new v(s,r,e,l,u,f,a,b,_,!1,t.overscaling),P=4*N.length;var j=t.iconSizeData,V=null;"source"===j.functionType?V=[10*o.layout.get("icon-size").evaluate(T)]:"composite"===j.functionType&&(V=[10*C.compositeIconSizes[0].evaluate(T),10*C.compositeIconSizes[1].evaluate(T)]),t.addSymbols(t.icon,N,V,M,w,T,!1,e,z.lineStartIndex,z.lineLength)}var U=L?L.boxStartIndex:t.collisionBoxArray.length,q=L?L.boxEndIndex:t.collisionBoxArray.length;return t.glyphOffsetArray.length>=k.MAX_GLYPHS&&y.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),{key:I,textBoxStartIndex:B,textBoxEndIndex:F,iconBoxStartIndex:U,iconBoxEndIndex:q,textOffset:x,iconOffset:M,anchor:e,line:r,featureIndex:l,feature:T,numGlyphVertices:D,numVerticalGlyphVertices:O,numIconVertices:P,textOpacityState:new c,iconOpacityState:new c,isDuplicate:!1,placedTextSymbolIndices:R,crossTileID:0}}(t,o,a,r,n,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,S,z,O,M,E,P,I,A,{zoom:t.zoom},e,u,f))};if("line"===x.get("symbol-placement"))for(var F=0,N=l(e.geometry,0,0,w,w);F=0;o--)if(n.dist(a[o])1||(h?(clearTimeout(h),h=null,o("dblclick",e)):h=setTimeout(r,300))},!1),l.addEventListener("touchend",function(t){s("touchend",t)},!1),l.addEventListener("touchmove",function(t){s("touchmove",t)},!1),l.addEventListener("touchcancel",function(t){s("touchcancel",t)},!1),l.addEventListener("click",function(t){n.mousePos(l,t).equals(f)&&o("click",t)},!1),l.addEventListener("dblclick",function(t){o("dblclick",t),t.preventDefault()},!1),l.addEventListener("contextmenu",function(e){var r=t.dragRotate&&t.dragRotate.isActive();u||r?u&&(c=e):o("contextmenu",e),e.preventDefault()},!1)}},{"../util/dom":259,"./handler/box_zoom":239,"./handler/dblclick_zoom":240,"./handler/drag_pan":241,"./handler/drag_rotate":242,"./handler/keyboard":243,"./handler/scroll_zoom":244,"./handler/touch_zoom_rotate":245,"@mapbox/point-geometry":4}],231:[function(t,e,r){var n=t("../util/util"),i=t("../style-spec/util/interpolate").number,a=t("../util/browser"),o=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("@mapbox/point-geometry"),c=function(t){function e(e,r){t.call(this),this.moving=!1,this.transform=e,this._bearingSnap=r.bearingSnap}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCenter=function(){return this.transform.center},e.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},e.prototype.panBy=function(t,e,r){return t=l.convert(t).mult(-1),this.panTo(this.transform.center,n.extend({offset:t},e),r)},e.prototype.panTo=function(t,e,r){return this.easeTo(n.extend({center:t},e),r)},e.prototype.getZoom=function(){return this.transform.zoom},e.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},e.prototype.zoomTo=function(t,e,r){return this.easeTo(n.extend({zoom:t},e),r)},e.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},e.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},e.prototype.getBearing=function(){return this.transform.bearing},e.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},e.prototype.rotateTo=function(t,e,r){return this.easeTo(n.extend({bearing:t},e),r)},e.prototype.resetNorth=function(t,e){return this.rotateTo(0,n.extend({duration:1e3},t),e),this},e.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())e?1:0}),["bottom","left","right","top"]))return n.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'"),this;t=s.convert(t);var a=[(e.padding.left-e.padding.right)/2,(e.padding.top-e.padding.bottom)/2],o=Math.min(e.padding.right,e.padding.left),c=Math.min(e.padding.top,e.padding.bottom);e.offset=[e.offset[0]+a[0],e.offset[1]+a[1]];var u=l.convert(e.offset),f=this.transform,h=f.project(t.getNorthWest()),p=f.project(t.getSouthEast()),d=p.sub(h),g=(f.width-2*o-2*Math.abs(u.x))/d.x,m=(f.height-2*c-2*Math.abs(u.y))/d.y;return m<0||g<0?(n.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset."),this):(e.center=f.unproject(h.add(p).div(2)),e.zoom=Math.min(f.scaleZoom(f.scale*Math.min(g,m)),e.maxZoom),e.bearing=0,e.linear?this.easeTo(e,r):this.flyTo(e,r))},e.prototype.jumpTo=function(t,e){this.stop();var r=this.transform,n=!1,i=!1,a=!1;return"zoom"in t&&r.zoom!==+t.zoom&&(n=!0,r.zoom=+t.zoom),void 0!==t.center&&(r.center=o.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(i=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(a=!0,r.pitch=+t.pitch),this.fire("movestart",e).fire("move",e),n&&this.fire("zoomstart",e).fire("zoom",e).fire("zoomend",e),i&&this.fire("rotate",e),a&&this.fire("pitchstart",e).fire("pitch",e).fire("pitchend",e),this.fire("moveend",e)},e.prototype.easeTo=function(t,e){var r=this;this.stop(),!1===(t=n.extend({offset:[0,0],duration:500,easing:n.ease},t)).animate&&(t.duration=0);var a=this.transform,s=this.getZoom(),c=this.getBearing(),u=this.getPitch(),f="zoom"in t?+t.zoom:s,h="bearing"in t?this._normalizeBearing(t.bearing,c):c,p="pitch"in t?+t.pitch:u,d=a.centerPoint.add(l.convert(t.offset)),g=a.pointLocation(d),m=o.convert(t.center||g);this._normalizeCenter(m);var v,y,x=a.project(g),b=a.project(m).sub(x),_=a.zoomScale(f-s);return t.around&&(v=o.convert(t.around),y=a.locationPoint(v)),this.zooming=f!==s,this.rotating=c!==h,this.pitching=p!==u,this._prepareEase(e,t.noMoveStart),clearTimeout(this._onEaseEnd),this._ease(function(t){if(r.zooming&&(a.zoom=i(s,f,t)),r.rotating&&(a.bearing=i(c,h,t)),r.pitching&&(a.pitch=i(u,p,t)),v)a.setLocationAtPoint(v,y);else{var n=a.zoomScale(a.zoom-s),o=f>s?Math.min(2,_):Math.max(.5,_),l=Math.pow(o,1-t),g=a.unproject(x.add(b.mult(t*l)).mult(n));a.setLocationAtPoint(a.renderWorldCopies?g.wrap():g,d)}r._fireMoveEvents(e)},function(){t.delayEndEvents?r._onEaseEnd=setTimeout(function(){return r._afterEase(e)},t.delayEndEvents):r._afterEase(e)},t),this},e.prototype._prepareEase=function(t,e){this.moving=!0,e||this.fire("movestart",t),this.zooming&&this.fire("zoomstart",t),this.pitching&&this.fire("pitchstart",t)},e.prototype._fireMoveEvents=function(t){this.fire("move",t),this.zooming&&this.fire("zoom",t),this.rotating&&this.fire("rotate",t),this.pitching&&this.fire("pitch",t)},e.prototype._afterEase=function(t){var e=this.zooming,r=this.pitching;this.moving=!1,this.zooming=!1,this.rotating=!1,this.pitching=!1,e&&this.fire("zoomend",t),r&&this.fire("pitchend",t),this.fire("moveend",t)},e.prototype.flyTo=function(t,e){function r(t){var e=(A*A-M*M+(t?-1:1)*E*E*T*T)/(2*(t?A:M)*E*T);return Math.log(Math.sqrt(e*e+1)-e)}function a(t){return(Math.exp(t)-Math.exp(-t))/2}function s(t){return(Math.exp(t)+Math.exp(-t))/2}var c=this;this.stop(),t=n.extend({offset:[0,0],speed:1.2,curve:1.42,easing:n.ease},t);var u=this.transform,f=this.getZoom(),h=this.getBearing(),p=this.getPitch(),d="zoom"in t?n.clamp(+t.zoom,u.minZoom,u.maxZoom):f,g="bearing"in t?this._normalizeBearing(t.bearing,h):h,m="pitch"in t?+t.pitch:p,v=u.zoomScale(d-f),y=u.centerPoint.add(l.convert(t.offset)),x=u.pointLocation(y),b=o.convert(t.center||x);this._normalizeCenter(b);var _=u.project(x),w=u.project(b).sub(_),k=t.curve,M=Math.max(u.width,u.height),A=M/v,T=w.mag();if("minZoom"in t){var S=n.clamp(Math.min(t.minZoom,f,d),u.minZoom,u.maxZoom),C=M/u.zoomScale(S-f);k=Math.sqrt(C/T*2)}var E=k*k,L=r(0),z=function(t){return s(L)/s(L+k*t)},P=function(t){return M*((s(L)*function(t){return a(t)/s(t)}(L+k*t)-a(L))/E)/T},D=(r(1)-L)/k;if(Math.abs(T)<1e-6||!isFinite(D)){if(Math.abs(M-A)<1e-6)return this.easeTo(t,e);var O=At.maxDuration&&(t.duration=0),this.zooming=!0,this.rotating=h!==g,this.pitching=m!==p,this._prepareEase(e,!1),this._ease(function(t){var r=t*D,n=1/z(r);u.zoom=f+u.scaleZoom(n),c.rotating&&(u.bearing=i(h,g,t)),c.pitching&&(u.pitch=i(p,m,t));var a=u.unproject(_.add(w.mult(P(r))).mult(n));u.setLocationAtPoint(u.renderWorldCopies?a.wrap():a,y),c._fireMoveEvents(e)},function(){return c._afterEase(e)},t),this},e.prototype.isEasing=function(){return!!this._isEasing},e.prototype.isMoving=function(){return this.moving},e.prototype.stop=function(){return this._onFrame&&this._finishAnimation(),this},e.prototype._ease=function(t,e,r){var n=this;!1===r.animate||0===r.duration?(t(1),e()):(this._easeStart=a.now(),this._isEasing=!0,this._easeOptions=r,this._startAnimation(function(e){var r=Math.min((a.now()-n._easeStart)/n._easeOptions.duration,1);t(n._easeOptions.easing(r)),1===r&&n.stop()},function(){n._isEasing=!1,e()}))},e.prototype._updateCamera=function(){this._onFrame&&this._onFrame(this.transform)},e.prototype._startAnimation=function(t,e){return void 0===e&&(e=function(){}),this.stop(),this._onFrame=t,this._finishFn=e,this._update(),this},e.prototype._finishAnimation=function(){delete this._onFrame;var t=this._finishFn;delete this._finishFn,t.call(this)},e.prototype._normalizeBearing=function(t,e){t=n.wrap(t,-180,180);var r=Math.abs(t-e);return Math.abs(t-360-e)180?-360:r<-180?360:0}},e}(t("../util/evented"));e.exports=c},{"../geo/lng_lat":62,"../geo/lng_lat_bounds":63,"../style-spec/util/interpolate":158,"../util/browser":252,"../util/evented":260,"../util/util":275,"@mapbox/point-geometry":4}],232:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/config"),o=function(t){this.options=t,i.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};o.prototype.getDefaultPosition=function(){return"bottom-right"},o.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=n.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},o.prototype.onRemove=function(){n.remove(this._container),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0},o.prototype._updateEditLink=function(){var t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));var e=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:a.ACCESS_TOKEN}];if(t){var r=e.reduce(function(t,r,n){return r.value&&(t+=r.key+"="+r.value+(n=0)return!1;return!0})).length?(this._container.innerHTML=t.join(" | "),this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null}},o.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")},e.exports=o},{"../../util/config":256,"../../util/dom":259,"../../util/util":275}],233:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/window"),o=function(){this._fullscreen=!1,i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in a.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in a.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in a.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in a.document&&(this._fullscreenchange="MSFullscreenChange"),this._className="mapboxgl-ctrl"};o.prototype.onAdd=function(t){return this._map=t,this._mapContainer=this._map.getContainer(),this._container=n.create("div",this._className+" mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._container.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._container},o.prototype.onRemove=function(){n.remove(this._container),this._map=null,a.document.removeEventListener(this._fullscreenchange,this._changeIcon)},o.prototype._checkFullscreenSupport=function(){return!!(a.document.fullscreenEnabled||a.document.mozFullScreenEnabled||a.document.msFullscreenEnabled||a.document.webkitFullscreenEnabled)},o.prototype._setupUI=function(){var t=this._fullscreenButton=n.create("button",this._className+"-icon "+this._className+"-fullscreen",this._container);t.setAttribute("aria-label","Toggle fullscreen"),t.type="button",this._fullscreenButton.addEventListener("click",this._onClickFullscreen),a.document.addEventListener(this._fullscreenchange,this._changeIcon)},o.prototype._isFullscreen=function(){return this._fullscreen},o.prototype._changeIcon=function(){(a.document.fullscreenElement||a.document.mozFullScreenElement||a.document.webkitFullscreenElement||a.document.msFullscreenElement)===this._mapContainer!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(this._className+"-shrink"),this._fullscreenButton.classList.toggle(this._className+"-fullscreen"))},o.prototype._onClickFullscreen=function(){this._isFullscreen()?a.document.exitFullscreen?a.document.exitFullscreen():a.document.mozCancelFullScreen?a.document.mozCancelFullScreen():a.document.msExitFullscreen?a.document.msExitFullscreen():a.document.webkitCancelFullScreen&&a.document.webkitCancelFullScreen():this._mapContainer.requestFullscreen?this._mapContainer.requestFullscreen():this._mapContainer.mozRequestFullScreen?this._mapContainer.mozRequestFullScreen():this._mapContainer.msRequestFullscreen?this._mapContainer.msRequestFullscreen():this._mapContainer.webkitRequestFullscreen&&this._mapContainer.webkitRequestFullscreen()},e.exports=o},{"../../util/dom":259,"../../util/util":275,"../../util/window":254}],234:[function(t,e,r){var n,i=t("../../util/evented"),a=t("../../util/dom"),o=t("../../util/window"),s=t("../../util/util"),l=t("../../geo/lng_lat"),c=t("../marker"),u={positionOptions:{enableHighAccuracy:!1,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showUserLocation:!0},f=function(t){function e(e){t.call(this),this.options=s.extend({},u,e),s.bindAll(["_onSuccess","_onError","_finish","_setupUI","_updateCamera","_updateMarker","_onClickGeolocate"],this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onAdd=function(t){return this._map=t,this._container=a.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),function(t){void 0!==n?t(n):void 0!==o.navigator.permissions?o.navigator.permissions.query({name:"geolocation"}).then(function(e){n="denied"!==e.state,t(n)}):(n=!!o.navigator.geolocation,t(n))}(this._setupUI),this._container},e.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(o.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker.remove(),a.remove(this._container),this._map=void 0},e.prototype._onSuccess=function(t){if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire("geolocate",t),this._finish()},e.prototype._updateCamera=function(t){var e=new l(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy;this._map.fitBounds(e.toBounds(r),this.options.fitBoundsOptions,{geolocateSource:!0})},e.prototype._updateMarker=function(t){t?this._userLocationDotMarker.setLngLat([t.coords.longitude,t.coords.latitude]).addTo(this._map):this._userLocationDotMarker.remove()},e.prototype._onError=function(t){if(this.options.trackUserLocation)if(1===t.code)this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),void 0!==this._geolocationWatchID&&this._clearWatch();else switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire("error",t),this._finish()},e.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},e.prototype._setupUI=function(t){var e=this;!1!==t&&(this._container.addEventListener("contextmenu",function(t){return t.preventDefault()}),this._geolocateButton=a.create("button","mapboxgl-ctrl-icon mapboxgl-ctrl-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.setAttribute("aria-label","Geolocate"),this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=a.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new c(this._dotElement),this.options.trackUserLocation&&(this._watchState="OFF")),this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),this.options.trackUserLocation&&this._map.on("movestart",function(t){t.geolocateSource||"ACTIVE_LOCK"!==e._watchState||(e._watchState="BACKGROUND",e._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),e._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),e.fire("trackuserlocationend"))}))},e.prototype._onClickGeolocate=function(){if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire("trackuserlocationstart");break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire("trackuserlocationend");break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire("trackuserlocationstart")}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}"OFF"===this._watchState&&void 0!==this._geolocationWatchID?this._clearWatch():void 0===this._geolocationWatchID&&(this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._geolocationWatchID=o.navigator.geolocation.watchPosition(this._onSuccess,this._onError,this.options.positionOptions))}else o.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4)},e.prototype._clearWatch=function(){o.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},e}(i);e.exports=f},{"../../geo/lng_lat":62,"../../util/dom":259,"../../util/evented":260,"../../util/util":275,"../../util/window":254,"../marker":248}],235:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=function(){i.bindAll(["_updateLogo"],this)};a.prototype.onAdd=function(t){this._map=t,this._container=n.create("div","mapboxgl-ctrl");var e=n.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.href="https://www.mapbox.com/",e.setAttribute("aria-label","Mapbox logo"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._container},a.prototype.onRemove=function(){n.remove(this._container),this._map.off("sourcedata",this._updateLogo)},a.prototype.getDefaultPosition=function(){return"bottom-left"},a.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},a.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},e.exports=a},{"../../util/dom":259,"../../util/util":275}],236:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../handler/drag_rotate"),o={showCompass:!0,showZoom:!0},s=function(t){var e=this;this.options=i.extend({},o,t),this._container=n.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",function(t){return t.preventDefault()}),this.options.showZoom&&(this._zoomInButton=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-in","Zoom In",function(){return e._map.zoomIn()}),this._zoomOutButton=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-out","Zoom Out",function(){return e._map.zoomOut()})),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-compass","Reset North",function(){return e._map.resetNorth()}),this._compassArrow=n.create("span","mapboxgl-ctrl-compass-arrow",this._compass))};s.prototype._rotateCompassArrow=function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t},s.prototype.onAdd=function(t){return this._map=t,this.options.showCompass&&(this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new a(t,{button:"left",element:this._compass}),this._handler.enable()),this._container},s.prototype.onRemove=function(){n.remove(this._container),this.options.showCompass&&(this._map.off("rotate",this._rotateCompassArrow),this._handler.disable(),delete this._handler),delete this._map},s.prototype._createButton=function(t,e,r){var i=n.create("button",t,this._container);return i.type="button",i.setAttribute("aria-label",e),i.addEventListener("click",r),i},e.exports=s},{"../../util/dom":259,"../../util/util":275,"../handler/drag_rotate":242}],237:[function(t,e,r){function n(t,e,r){var n=r&&r.maxWidth||100,a=t._container.clientHeight/2,o=function(t,e){var r=Math.PI/180,n=t.lat*r,i=e.lat*r,a=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-t.lng)*r);return 6371e3*Math.acos(Math.min(a,1))}(t.unproject([0,a]),t.unproject([n,a]));if(r&&"imperial"===r.unit){var s=3.2808*o;s>5280?i(e,n,s/5280,"mi"):i(e,n,s,"ft")}else if(r&&"nautical"===r.unit){i(e,n,o/1852,"nm")}else i(e,n,o,"m")}function i(t,e,r,n){var i=function(t){var e=Math.pow(10,(""+Math.floor(t)).length-1),r=t/e;return e*(r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:1)}(r),a=i/r;"m"===n&&i>=1e3&&(i/=1e3,n="km"),t.style.width=e*a+"px",t.innerHTML=i+n}var a=t("../../util/dom"),o=t("../../util/util"),s=function(t){this.options=t,o.bindAll(["_onMove"],this)};s.prototype.getDefaultPosition=function(){return"bottom-left"},s.prototype._onMove=function(){n(this._map,this._container,this.options)},s.prototype.onAdd=function(t){return this._map=t,this._container=a.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},s.prototype.onRemove=function(){a.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},e.exports=s},{"../../util/dom":259,"../../util/util":275}],238:[function(t,e,r){},{}],239:[function(t,e,r){var n=t("../../util/dom"),i=t("../../geo/lng_lat_bounds"),a=t("../../util/util"),o=t("../../util/window"),s=function(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),a.bindAll(["_onMouseDown","_onMouseMove","_onMouseUp","_onKeyDown"],this)};s.prototype.isEnabled=function(){return!!this._enabled},s.prototype.isActive=function(){return!!this._active},s.prototype.enable=function(){this.isEnabled()||(this._map.dragPan&&this._map.dragPan.disable(),this._el.addEventListener("mousedown",this._onMouseDown,!1),this._map.dragPan&&this._map.dragPan.enable(),this._enabled=!0)},s.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},s.prototype._onMouseDown=function(t){t.shiftKey&&0===t.button&&(o.document.addEventListener("mousemove",this._onMouseMove,!1),o.document.addEventListener("keydown",this._onKeyDown,!1),o.document.addEventListener("mouseup",this._onMouseUp,!1),n.disableDrag(),this._startPos=n.mousePos(this._el,t),this._active=!0)},s.prototype._onMouseMove=function(t){var e=this._startPos,r=n.mousePos(this._el,t);this._box||(this._box=n.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var i=Math.min(e.x,r.x),a=Math.max(e.x,r.x),o=Math.min(e.y,r.y),s=Math.max(e.y,r.y);n.setTransform(this._box,"translate("+i+"px,"+o+"px)"),this._box.style.width=a-i+"px",this._box.style.height=s-o+"px"},s.prototype._onMouseUp=function(t){if(0===t.button){var e=this._startPos,r=n.mousePos(this._el,t),a=(new i).extend(this._map.unproject(e)).extend(this._map.unproject(r));this._finish(),e.x===r.x&&e.y===r.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(a,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:a})}},s.prototype._onKeyDown=function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},s.prototype._finish=function(){this._active=!1,o.document.removeEventListener("mousemove",this._onMouseMove,!1),o.document.removeEventListener("keydown",this._onKeyDown,!1),o.document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(n.remove(this._box),this._box=null),n.enableDrag()},s.prototype._fireEvent=function(t,e){return this._map.fire(t,{originalEvent:e})},e.exports=s},{"../../geo/lng_lat_bounds":63,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],240:[function(t,e,r){var n=t("../../util/util"),i=function(t){this._map=t,n.bindAll(["_onDblClick","_onZoomEnd"],this)};i.prototype.isEnabled=function(){return!!this._enabled},i.prototype.isActive=function(){return!!this._active},i.prototype.enable=function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},i.prototype.disable=function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},i.prototype._onDblClick=function(t){this._active=!0,this._map.on("zoomend",this._onZoomEnd),this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)},i.prototype._onZoomEnd=function(){this._active=!1,this._map.off("zoomend",this._onZoomEnd)},e.exports=i},{"../../util/util":275}],241:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/window"),o=t("../../util/browser"),s=i.bezier(0,0,.3,1),l=function(t){this._map=t,this._el=t.getCanvasContainer(),i.bindAll(["_onDown","_onMove","_onUp","_onTouchEnd","_onMouseUp","_onDragFrame","_onDragFinished"],this)};l.prototype.isEnabled=function(){return!!this._enabled},l.prototype.isActive=function(){return!!this._active},l.prototype.enable=function(){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},l.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},l.prototype._onDown=function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(a.document.addEventListener("touchmove",this._onMove),a.document.addEventListener("touchend",this._onTouchEnd)):(a.document.addEventListener("mousemove",this._onMove),a.document.addEventListener("mouseup",this._onMouseUp)),a.addEventListener("blur",this._onMouseUp),this._active=!1,this._previousPos=n.mousePos(this._el,t),this._inertia=[[o.now(),this._previousPos]])},l.prototype._onMove=function(t){if(!this._ignoreEvent(t)){this._lastMoveEvent=t,t.preventDefault();var e=n.mousePos(this._el,t);if(this._drainInertiaBuffer(),this._inertia.push([o.now(),e]),!this._previousPos)return void(this._previousPos=e);this._pos=e,this.isActive()||(this._active=!0,this._map.moving=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t),this._map._startAnimation(this._onDragFrame,this._onDragFinished)),this._map._update()}},l.prototype._onDragFrame=function(t){var e=this._lastMoveEvent;e&&(t.setLocationAtPoint(t.pointLocation(this._previousPos),this._pos),this._fireEvent("drag",e),this._fireEvent("move",e),this._previousPos=this._pos,delete this._lastMoveEvent)},l.prototype._onDragFinished=function(t){var e=this;if(this.isActive()){this._active=!1,delete this._lastMoveEvent,delete this._previousPos,delete this._pos,this._fireEvent("dragend",t),this._drainInertiaBuffer();var r=function(){e._map.moving=!1,e._fireEvent("moveend",t)},n=this._inertia;if(n.length<2)return void r();var i=n[n.length-1],a=n[0],o=i[1].sub(a[1]),l=(i[0]-a[0])/1e3;if(0===l||i[1].equals(a[1]))return void r();var c=o.mult(.3/l),u=c.mag();u>1400&&(u=1400,c._unit()._mult(u));var f=u/750,h=c.mult(-f/2);this._map.panBy(h,{duration:1e3*f,easing:s,noMoveStart:!0},{originalEvent:t})}},l.prototype._onUp=function(t){this._onDragFinished(t)},l.prototype._onMouseUp=function(t){this._ignoreEvent(t)||(this._onUp(t),a.document.removeEventListener("mousemove",this._onMove),a.document.removeEventListener("mouseup",this._onMouseUp),a.removeEventListener("blur",this._onMouseUp))},l.prototype._onTouchEnd=function(t){this._ignoreEvent(t)||(this._onUp(t),a.document.removeEventListener("touchmove",this._onMove),a.document.removeEventListener("touchend",this._onTouchEnd))},l.prototype._fireEvent=function(t,e){return this._map.fire(t,e?{originalEvent:e}:{})},l.prototype._ignoreEvent=function(t){var e=this._map;return!(!e.boxZoom||!e.boxZoom.isActive())||!(!e.dragRotate||!e.dragRotate.isActive())||(t.touches?t.touches.length>1:!!t.ctrlKey||"mousemove"!==t.type&&t.button&&0!==t.button)},l.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=o.now();t.length>0&&e-t[0][0]>160;)t.shift()},e.exports=l},{"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],242:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/window"),o=t("../../util/browser"),s=i.bezier(0,0,.25,1),l=function(t,e){this._map=t,this._el=e.element||t.getCanvasContainer(),this._button=e.button||"right",this._bearingSnap=e.bearingSnap||0,this._pitchWithRotate=!1!==e.pitchWithRotate,i.bindAll(["_onDown","_onMove","_onUp","_onDragFrame","_onDragFinished"],this)};l.prototype.isEnabled=function(){return!!this._enabled},l.prototype.isActive=function(){return!!this._active},l.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},l.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},l.prototype._onDown=function(t){if(!(this._map.boxZoom&&this._map.boxZoom.isActive()||this._map.dragPan&&this._map.dragPan.isActive()||this.isActive())){if("right"===this._button){var e=t.ctrlKey?0:2,r=t.button;if(void 0!==a.InstallTrigger&&2===t.button&&t.ctrlKey&&a.navigator.platform.toUpperCase().indexOf("MAC")>=0&&(r=0),r!==e)return}else if(t.ctrlKey||0!==t.button)return;n.disableDrag(),a.document.addEventListener("mousemove",this._onMove,{capture:!0}),a.document.addEventListener("mouseup",this._onUp),a.addEventListener("blur",this._onUp),this._active=!1,this._inertia=[[o.now(),this._map.getBearing()]],this._previousPos=n.mousePos(this._el,t),this._center=this._map.transform.centerPoint,t.preventDefault()}},l.prototype._onMove=function(t){this._lastMoveEvent=t;var e=n.mousePos(this._el,t);this._previousPos?(this._pos=e,this.isActive()||(this._active=!0,this._map.moving=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t),this._pitchWithRotate&&this._fireEvent("pitchstart",t),this._map._startAnimation(this._onDragFrame,this._onDragFinished)),this._map._update()):this._previousPos=e},l.prototype._onUp=function(t){a.document.removeEventListener("mousemove",this._onMove,{capture:!0}),a.document.removeEventListener("mouseup",this._onUp),a.removeEventListener("blur",this._onUp),n.enableDrag(),this._onDragFinished(t)},l.prototype._onDragFrame=function(t){var e=this._lastMoveEvent;if(e){var r=this._previousPos,n=this._pos,i=.8*(r.x-n.x),a=-.5*(r.y-n.y),s=t.bearing-i,l=t.pitch-a,c=this._inertia,u=c[c.length-1];this._drainInertiaBuffer(),c.push([o.now(),this._map._normalizeBearing(s,u[1])]),t.bearing=s,this._pitchWithRotate&&(this._fireEvent("pitch",e),t.pitch=l),this._fireEvent("rotate",e),this._fireEvent("move",e),delete this._lastMoveEvent,this._previousPos=this._pos}},l.prototype._onDragFinished=function(t){var e=this;if(this.isActive()){this._active=!1,delete this._lastMoveEvent,delete this._previousPos,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var r=this._map,n=r.getBearing(),i=this._inertia,a=function(){Math.abs(n)180&&(d=180);var g=d/180;u+=h*d*(g/2),Math.abs(r._normalizeBearing(u,0))0&&e-t[0][0]>160;)t.shift()},e.exports=l},{"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],243:[function(t,e,r){function n(t){return t*(2-t)}var i=t("../../util/util"),a=function(t){this._map=t,this._el=t.getCanvasContainer(),i.bindAll(["_onKeyDown"],this)};a.prototype.isEnabled=function(){return!!this._enabled},a.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},a.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},a.prototype._onKeyDown=function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=0,r=0,i=0,a=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?i=-1:(o=1,t.preventDefault());break;default:return}var s=this._map,l=s.getZoom(),c={duration:300,delayEndEvents:500,easing:n,zoom:e?Math.round(l)+e*(t.shiftKey?2:1):l,bearing:s.getBearing()+15*r,pitch:s.getPitch()+10*i,offset:[100*-a,100*-o],center:s.getCenter()};s.easeTo(c,{originalEvent:t})}},e.exports=a},{"../../util/util":275}],244:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/browser"),o=t("../../util/window"),s=t("../../style-spec/util/interpolate").number,l=t("../../geo/lng_lat"),c=o.navigator.userAgent.toLowerCase(),u=-1!==c.indexOf("firefox"),f=-1!==c.indexOf("safari")&&-1===c.indexOf("chrom"),h=function(t){this._map=t,this._el=t.getCanvasContainer(),this._delta=0,i.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};h.prototype.isEnabled=function(){return!!this._enabled},h.prototype.isActive=function(){return!!this._active},h.prototype.enable=function(t){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},h.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},h.prototype._onWheel=function(t){var e=0;"wheel"===t.type?(e=t.deltaY,u&&t.deltaMode===o.WheelEvent.DOM_DELTA_PIXEL&&(e/=a.devicePixelRatio),t.deltaMode===o.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,f&&(e/=3));var r=a.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==e&&e%4.000244140625==0?this._type="wheel":0!==e&&Math.abs(e)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(n*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this.isActive()||this._start(t)),t.preventDefault()},h.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this.isActive()||this._start(t)},h.prototype._start=function(t){if(this._delta){this._active=!0,this._map.moving=!0,this._map.zooming=!0,this._map.fire("movestart",{originalEvent:t}),this._map.fire("zoomstart",{originalEvent:t}),clearTimeout(this._finishTimeout);var e=n.mousePos(this._el,t);this._around=l.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(e)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._map._startAnimation(this._onScrollFrame,this._onScrollFinished)}},h.prototype._onScrollFrame=function(t){if(this.isActive()){if(0!==this._delta){var e="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?1/450:.01,r=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==r&&(r=1/r);var n="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(n*r))),"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}if("wheel"===this._type){var i=Math.min((a.now()-this._lastWheelEventTime)/200,1),o=this._easing(i);t.zoom=s(this._startZoom,this._targetZoom,o),1===i&&this._map.stop()}else t.zoom=this._targetZoom,this._map.stop();t.setLocationAtPoint(this._around,this._aroundPoint),this._map.fire("move",{originalEvent:this._lastWheelEvent}),this._map.fire("zoom",{originalEvent:this._lastWheelEvent})}},h.prototype._onScrollFinished=function(){var t=this;this.isActive()&&(this._active=!1,this._finishTimeout=setTimeout(function(){t._map.moving=!1,t._map.zooming=!1,t._map.fire("zoomend"),t._map.fire("moveend"),delete t._targetZoom},200))},h.prototype._smoothOutEasing=function(t){var e=i.ease;if(this._prevEase){var r=this._prevEase,n=(a.now()-r.start)/r.duration,o=r.easing(n+.01)-r.easing(n),s=.27/Math.sqrt(o*o+1e-4)*.01,l=Math.sqrt(.0729-s*s);e=i.bezier(s,l,.25,1)}return this._prevEase={start:a.now(),duration:t,easing:e},e},e.exports=h},{"../../geo/lng_lat":62,"../../style-spec/util/interpolate":158,"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],245:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/window"),o=t("../../util/browser"),s=i.bezier(0,0,.15,1),l=function(t){this._map=t,this._el=t.getCanvasContainer(),i.bindAll(["_onStart","_onMove","_onEnd"],this)};l.prototype.isEnabled=function(){return!!this._enabled},l.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},l.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},l.prototype.disableRotation=function(){this._rotationDisabled=!0},l.prototype.enableRotation=function(){this._rotationDisabled=!1},l.prototype._onStart=function(t){if(2===t.touches.length){var e=n.mousePos(this._el,t.touches[0]),r=n.mousePos(this._el,t.touches[1]);this._startVec=e.sub(r),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],a.document.addEventListener("touchmove",this._onMove,!1),a.document.addEventListener("touchend",this._onEnd,!1)}},l.prototype._onMove=function(t){if(2===t.touches.length){var e=n.mousePos(this._el,t.touches[0]),r=n.mousePos(this._el,t.touches[1]),i=e.add(r).div(2),a=e.sub(r),s=a.mag()/this._startVec.mag(),l=this._rotationDisabled?0:180*a.angleWith(this._startVec)/Math.PI,c=this._map;if(this._gestureIntent){var u={duration:0,around:c.unproject(i)};"rotate"===this._gestureIntent&&(u.bearing=this._startBearing+l),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(u.zoom=c.transform.scaleZoom(this._startScale*s)),c.stop(),this._drainInertiaBuffer(),this._inertia.push([o.now(),s,i]),c.easeTo(u,{originalEvent:t})}else{var f=Math.abs(1-s)>.15;Math.abs(l)>10?this._gestureIntent="rotate":f&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=a,this._startScale=c.transform.scale,this._startBearing=c.transform.bearing)}t.preventDefault()}},l.prototype._onEnd=function(t){a.document.removeEventListener("touchmove",this._onMove),a.document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,r=this._map;if(e.length<2)r.snapToNorth({},{originalEvent:t});else{var n=e[e.length-1],i=e[0],o=r.transform.scaleZoom(this._startScale*n[1]),l=r.transform.scaleZoom(this._startScale*i[1]),c=o-l,u=(n[0]-i[0])/1e3,f=n[2];if(0!==u&&o!==l){var h=.15*c/u;Math.abs(h)>2.5&&(h=h>0?2.5:-2.5);var p=1e3*Math.abs(h/(12*.15)),d=o+h*p/2e3;d<0&&(d=0),r.easeTo({zoom:d,duration:p,easing:s,around:this._aroundCenter?r.getCenter():r.unproject(f)},{originalEvent:t})}else r.snapToNorth({},{originalEvent:t})}},l.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=o.now();t.length>2&&e-t[0][0]>160;)t.shift()},e.exports=l},{"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],246:[function(t,e,r){var n=t("../util/util"),i=t("../util/window"),a=t("../util/throttle"),o=function(){n.bindAll(["_onHashChange","_updateHash"],this),this._updateHash=a(this._updateHashUnthrottled.bind(this),300)};o.prototype.addTo=function(t){return this._map=t,i.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},o.prototype.remove=function(){return i.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},o.prototype.getHashString=function(t){var e=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,n),a=Math.round(e.lng*i)/i,o=Math.round(e.lat*i)/i,s=this._map.getBearing(),l=this._map.getPitch(),c="";return c+=t?"#/"+a+"/"+o+"/"+r:"#"+r+"/"+o+"/"+a,(s||l)&&(c+="/"+Math.round(10*s)/10),l&&(c+="/"+Math.round(l)),c},o.prototype._onHashChange=function(){var t=i.location.hash.replace("#","").split("/");return t.length>=3&&(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0),pitch:+(t[4]||0)}),!0)},o.prototype._updateHashUnthrottled=function(){var t=this.getHashString();i.history.replaceState("","",t)},e.exports=o},{"../util/throttle":272,"../util/util":275,"../util/window":254}],247:[function(t,e,r){function n(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/util"),a=t("../util/browser"),o=t("../util/window"),s=t("../util/window"),l=s.HTMLImageElement,c=s.HTMLElement,u=t("../util/dom"),f=t("../util/ajax"),h=t("../style/style"),p=t("../style/evaluation_parameters"),d=t("../render/painter"),g=t("../geo/transform"),m=t("./hash"),v=t("./bind_handlers"),y=t("./camera"),x=t("../geo/lng_lat"),b=t("../geo/lng_lat_bounds"),_=t("@mapbox/point-geometry"),w=t("./control/attribution_control"),k=t("./control/logo_control"),M=t("@mapbox/mapbox-gl-supported"),A=t("../util/image").RGBAImage;t("./events");var T={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:0,maxZoom:22,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,transformRequest:null,fadeDuration:300},S=function(t){function e(e){if(null!=(e=i.extend({},T,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than minZoom");var r=new g(e.minZoom,e.maxZoom,e.renderWorldCopies);t.call(this,r,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming;var n=e.transformRequest;if(this._transformRequest=n?function(t,e){return n(t,e)||{url:t}}:function(t){return{url:t}},"string"==typeof e.container){var a=o.document.getElementById(e.container);if(!a)throw new Error("Container '"+e.container+"' not found.");this._container=a}else{if(!(e.container instanceof c))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}e.maxBounds&&this.setMaxBounds(e.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render","_onData","_onDataLoading"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),void 0!==o&&(o.addEventListener("online",this._onWindowOnline,!1),o.addEventListener("resize",this._onWindowResize,!1)),v(this,e),this._hash=e.hash&&(new m).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),this.resize(),e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new w),this.addControl(new k,e.logoPosition),this.on("style.load",function(){this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",this._onData),this.on("dataloading",this._onDataLoading)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={showTileBoundaries:{},showCollisionBoxes:{},showOverdrawInspector:{},repaint:{},vertices:{}};return e.prototype.addControl=function(t,e){void 0===e&&t.getDefaultPosition&&(e=t.getDefaultPosition()),void 0===e&&(e="top-right");var r=t.onAdd(this),n=this._controlPositions[e];return-1!==e.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this},e.prototype.removeControl=function(t){return t.onRemove(this),this},e.prototype.resize=function(){var t=this._containerDimensions(),e=t[0],r=t[1];return this._resizeCanvas(e,r),this.transform.resize(e,r),this.painter.resize(e,r),this.fire("movestart").fire("move").fire("resize").fire("moveend")},e.prototype.getBounds=function(){var t=new b(this.transform.pointLocation(new _(0,this.transform.height)),this.transform.pointLocation(new _(this.transform.width,0)));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new _(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new _(0,this.transform.size.y)))),t},e.prototype.getMaxBounds=function(){return this.transform.latRange&&2===this.transform.latRange.length&&this.transform.lngRange&&2===this.transform.lngRange.length?new b([this.transform.lngRange[0],this.transform.latRange[0]],[this.transform.lngRange[1],this.transform.latRange[1]]):null},e.prototype.setMaxBounds=function(t){if(t){var e=b.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=null,this.transform.latRange=null,this._update());return this},e.prototype.setMinZoom=function(t){if((t=null===t||void 0===t?0:t)>=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},e.prototype.getMaxZoom=function(){return this.transform.maxZoom},e.prototype.project=function(t){return this.transform.locationPoint(x.convert(t))},e.prototype.unproject=function(t){return this.transform.pointLocation(_.convert(t))},e.prototype.on=function(e,r,n){var a=this;if(void 0===n)return t.prototype.on.call(this,e,r);var o=function(){if("mouseenter"===e||"mouseover"===e){var t=!1;return{layer:r,listener:n,delegates:{mousemove:function(o){var s=a.getLayer(r)?a.queryRenderedFeatures(o.point,{layers:[r]}):[];s.length?t||(t=!0,n.call(a,i.extend({features:s},o,{type:e}))):t=!1},mouseout:function(){t=!1}}}}if("mouseleave"===e||"mouseout"===e){var o=!1;return{layer:r,listener:n,delegates:{mousemove:function(t){(a.getLayer(r)?a.queryRenderedFeatures(t.point,{layers:[r]}):[]).length?o=!0:o&&(o=!1,n.call(a,i.extend({},t,{type:e})))},mouseout:function(t){o&&(o=!1,n.call(a,i.extend({},t,{type:e})))}}}}var s;return{layer:r,listener:n,delegates:(s={},s[e]=function(t){var e=a.getLayer(r)?a.queryRenderedFeatures(t.point,{layers:[r]}):[];e.length&&n.call(a,i.extend({features:e},t))},s)}}();for(var s in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(o),o.delegates)a.on(s,o.delegates[s]);return this},e.prototype.off=function(e,r,n){if(void 0===n)return t.prototype.off.call(this,e,r);if(this._delegatedListeners&&this._delegatedListeners[e])for(var i=this._delegatedListeners[e],a=0;athis._map.transform.height-i?["bottom"]:[],t.xthis._map.transform.width-n/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var o=t.add(r[e]).round(),l={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},u=this._container.classList;for(var f in l)u.remove("mapboxgl-popup-anchor-"+f);u.add("mapboxgl-popup-anchor-"+e),a.setTransform(this._container,l[e]+" translate("+o.x+"px,"+o.y+"px)")}},e.prototype._onClickClose=function(){this.remove()},e}(i);e.exports=f},{"../geo/lng_lat":62,"../util/dom":259,"../util/evented":260,"../util/smart_wrap":270,"../util/util":275,"../util/window":254,"@mapbox/point-geometry":4}],250:[function(t,e,r){var n=t("./util"),i=t("./web_worker_transfer"),a=i.serialize,o=i.deserialize,s=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.callbackID=0,n.bindAll(["receive"],this),this.target.addEventListener("message",this.receive,!1)};s.prototype.send=function(t,e,r,n){var i=r?this.mapId+":"+this.callbackID++:null;r&&(this.callbacks[i]=r);var o=[];this.target.postMessage({targetMapId:n,sourceMapId:this.mapId,type:t,id:String(i),data:a(e,o)},o)},s.prototype.receive=function(t){var e,r=this,n=t.data,i=n.id;if(!n.targetMapId||this.mapId===n.targetMapId){var s=function(t,e){var n=[];r.target.postMessage({sourceMapId:r.mapId,type:"",id:String(i),error:t?String(t):null,data:a(e,n)},n)};if(""===n.type)e=this.callbacks[n.id],delete this.callbacks[n.id],e&&n.error?e(new Error(n.error)):e&&e(null,o(n.data));else if(void 0!==n.id&&this.parent[n.type])this.parent[n.type](n.sourceMapId,o(n.data),s);else if(void 0!==n.id&&this.parent.getWorkerSource){var l=n.type.split(".");this.parent.getWorkerSource(n.sourceMapId,l[0])[l[1]](o(n.data),s)}else this.parent[n.type](o(n.data))}},s.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)},e.exports=s},{"./util":275,"./web_worker_transfer":278}],251:[function(t,e,r){function n(t){var e=new a.XMLHttpRequest;for(var r in e.open("GET",t.url,!0),t.headers)e.setRequestHeader(r,t.headers[r]);return e.withCredentials="include"===t.credentials,e}function i(t){var e=a.document.createElement("a");return e.href=t,e.protocol===a.document.location.protocol&&e.host===a.document.location.host}var a=t("./window"),o={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};r.ResourceType=o,"function"==typeof Object.freeze&&Object.freeze(o);var s=function(t){function e(e,r){t.call(this,e),this.status=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error);r.getJSON=function(t,e){var r=n(t);return r.setRequestHeader("Accept","application/json"),r.onerror=function(){e(new Error(r.statusText))},r.onload=function(){if(r.status>=200&&r.status<300&&r.response){var t;try{t=JSON.parse(r.response)}catch(t){return e(t)}e(null,t)}else e(new s(r.statusText,r.status))},r.send(),r},r.getArrayBuffer=function(t,e){var r=n(t);return r.responseType="arraybuffer",r.onerror=function(){e(new Error(r.statusText))},r.onload=function(){var t=r.response;if(0===t.byteLength&&200===r.status)return e(new Error("http status 200 returned without content."));r.status>=200&&r.status<300&&r.response?e(null,{data:t,cacheControl:r.getResponseHeader("Cache-Control"),expires:r.getResponseHeader("Expires")}):e(new s(r.statusText,r.status))},r.send(),r};r.getImage=function(t,e){return r.getArrayBuffer(t,function(t,r){if(t)e(t);else if(r){var n=new a.Image,i=a.URL||a.webkitURL;n.onload=function(){e(null,n),i.revokeObjectURL(n.src)};var o=new a.Blob([new Uint8Array(r.data)],{type:"image/png"});n.cacheControl=r.cacheControl,n.expires=r.expires,n.src=r.data.byteLength?i.createObjectURL(o):"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="}})},r.getVideo=function(t,e){var r=a.document.createElement("video");r.onloadstart=function(){e(null,r)};for(var n=0;n1)for(var f=0;f0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},o.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this},e.exports=o},{"./util":275}],261:[function(t,e,r){function n(t,e){return e.max-t.max}function i(t,e,r,n){this.p=new o(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,i=0;it.y!=f.y>t.y&&t.x<(f.x-u.x)*(t.y-u.y)/(f.y-u.y)+u.x&&(r=!r),n=Math.min(n,s(t,u,f))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var a=t("tinyqueue"),o=t("@mapbox/point-geometry"),s=t("./intersection_tests").distToSegmentSquared;e.exports=function(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var s=1/0,l=1/0,c=-1/0,u=-1/0,f=t[0],h=0;hc)&&(c=p.x),(!h||p.y>u)&&(u=p.y)}var d=c-s,g=u-l,m=Math.min(d,g),v=m/2,y=new a(null,n);if(0===m)return new o(s,l);for(var x=s;x_.d||!_.d)&&(_=k,r&&console.log("found best %d after %d probes",Math.round(1e4*k.d)/1e4,w)),k.max-_.d<=e||(v=k.h/2,y.push(new i(k.p.x-v,k.p.y-v,v,t)),y.push(new i(k.p.x+v,k.p.y-v,v,t)),y.push(new i(k.p.x-v,k.p.y+v,v,t)),y.push(new i(k.p.x+v,k.p.y+v,v,t)),w+=4)}return r&&(console.log("num probes: "+w),console.log("best distance: "+_.d)),_.p}},{"./intersection_tests":264,"@mapbox/point-geometry":4,tinyqueue:33}],262:[function(t,e,r){var n,i=t("./worker_pool");e.exports=function(){return n||(n=new i),n}},{"./worker_pool":279}],263:[function(t,e,r){function n(t,e,r,n){var i=e.width,a=e.height;if(n){if(n.length!==i*a*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(i*a*r);return t.width=i,t.height=a,t.data=n,t}function i(t,e,r){var i=e.width,o=e.height;if(i!==t.width||o!==t.height){var s=n({},{width:i,height:o},r);a(t,s,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,i),height:Math.min(t.height,o)},r),t.width=i,t.height=o,t.data=s.data}}function a(t,e,r,n,i,a){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=t.data,s=e.data,l=0;l1){if(i(t,e))return!0;for(var n=0;n1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function l(t,e){for(var r,n,i,a=!1,o=0;oe.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(a=!a);return a}function c(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(r=!r)}return r}var u=t("./util").isCounterClockwise;e.exports={multiPolygonIntersectsBufferedMultiPoint:function(t,e,r){for(var n=0;n=3)for(var l=0;l=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}}},{}],266:[function(t,e,r){var n=function(t,e){this.max=t,this.onRemove=e,this.reset()};n.prototype.reset=function(){var t=this;for(var e in t.data)t.onRemove(t.data[e]);return this.data={},this.order=[],this},n.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.getAndRemove(this.order[0]);r&&this.onRemove(r)}return this},n.prototype.has=function(t){return t in this.data},n.prototype.keys=function(){return this.order},n.prototype.getAndRemove=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},n.prototype.get=function(t){return this.has(t)?this.data[t]:null},n.prototype.remove=function(t){if(!this.has(t))return this;var e=this.data[t];return delete this.data[t],this.onRemove(e),this.order.splice(this.order.indexOf(t),1),this},n.prototype.setMaxSize=function(t){var e=this;for(this.max=t;this.order.length>this.max;){var r=e.getAndRemove(e.order[0]);r&&e.onRemove(r)}return this},e.exports=n},{}],267:[function(t,e,r){function n(t,e){var r=a(s.API_URL);if(t.protocol=r.protocol,t.authority=r.authority,"/"!==r.path&&(t.path=""+r.path+t.path),!s.REQUIRE_ACCESS_TOKEN)return o(t);if(!(e=e||s.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+c);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+c);return t.params.push("access_token="+e),o(t)}function i(t){return 0===t.indexOf("mapbox:")}function a(t){var e=t.match(f);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function o(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}var s=t("./config"),l=t("./browser"),c="See https://www.mapbox.com/api-documentation/#access-tokens";r.isMapboxURL=i,r.normalizeStyleURL=function(t,e){if(!i(t))return t;var r=a(t);return r.path="/styles/v1"+r.path,n(r,e)},r.normalizeGlyphsURL=function(t,e){if(!i(t))return t;var r=a(t);return r.path="/fonts/v1"+r.path,n(r,e)},r.normalizeSourceURL=function(t,e){if(!i(t))return t;var r=a(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),n(r,e)},r.normalizeSpriteURL=function(t,e,r,s){var l=a(t);return i(t)?(l.path="/styles/v1"+l.path+"/sprite"+e+r,n(l,s)):(l.path+=""+e+r,o(l))};var u=/(\.(png|jpg)\d*)(?=$)/;r.normalizeTileURL=function(t,e,r){if(!e||!i(e))return t;var n=a(t),c=l.devicePixelRatio>=2||512===r?"@2x":"",f=l.supportsWebp?".webp":"$1";return n.path=n.path.replace(u,""+c+f),function(t){for(var e=0;e=65097&&t<=65103)||n["CJK Compatibility Ideographs"](t)||n["CJK Compatibility"](t)||n["CJK Radicals Supplement"](t)||n["CJK Strokes"](t)||!(!n["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||n["CJK Unified Ideographs Extension A"](t)||n["CJK Unified Ideographs"](t)||n["Enclosed CJK Letters and Months"](t)||n["Hangul Compatibility Jamo"](t)||n["Hangul Jamo Extended-A"](t)||n["Hangul Jamo Extended-B"](t)||n["Hangul Jamo"](t)||n["Hangul Syllables"](t)||n.Hiragana(t)||n["Ideographic Description Characters"](t)||n.Kanbun(t)||n["Kangxi Radicals"](t)||n["Katakana Phonetic Extensions"](t)||n.Katakana(t)&&12540!==t||!(!n["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!n["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||n["Unified Canadian Aboriginal Syllabics"](t)||n["Unified Canadian Aboriginal Syllabics Extended"](t)||n["Vertical Forms"](t)||n["Yijing Hexagram Symbols"](t)||n["Yi Syllables"](t)||n["Yi Radicals"](t)))},r.charHasNeutralVerticalOrientation=function(t){return!!(n["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||n["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||n["Letterlike Symbols"](t)||n["Number Forms"](t)||n["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||n["Control Pictures"](t)&&9251!==t||n["Optical Character Recognition"](t)||n["Enclosed Alphanumerics"](t)||n["Geometric Shapes"](t)||n["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||n["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||n["CJK Symbols and Punctuation"](t)||n.Katakana(t)||n["Private Use Area"](t)||n["CJK Compatibility Forms"](t)||n["Small Form Variants"](t)||n["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)},r.charHasRotatedVerticalOrientation=function(t){return!(r.charHasUprightVerticalOrientation(t)||r.charHasNeutralVerticalOrientation(t))}},{"./is_char_in_unicode_block":265}],270:[function(t,e,r){var n=t("../geo/lng_lat");e.exports=function(t,e,r){if(t=new n(t.lng,t.lat),e){var i=new n(t.lng-360,t.lat),a=new n(t.lng+360,t.lat),o=r.locationPoint(t).distSqr(e);r.locationPoint(i).distSqr(e)180;){var s=r.locationPoint(t);if(s.x>=0&&s.y>=0&&s.x<=r.width&&s.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}},{"../geo/lng_lat":62}],271:[function(t,e,r){function n(t,e){return Math.ceil(t/e)*e}var i={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},a=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};a.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},a.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},a.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},a.prototype.clear=function(){this.length=0},a.prototype.resize=function(t){this.reserve(t),this.length=t},a.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},a.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")},e.exports.StructArray=a,e.exports.Struct=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},e.exports.viewTypes=i,e.exports.createLayout=function(t,e){void 0===e&&(e=1);var r=0,a=0;return{members:t.map(function(t){var o=function(t){return i[t].BYTES_PER_ELEMENT}(t.type),s=r=n(r,Math.max(e,o)),l=t.components||1;return a=Math.max(a,o),r+=o*l,{name:t.name,type:t.type,components:l,offset:s}}),size:n(r,Math.max(a,e)),alignment:e}}},{}],272:[function(t,e,r){e.exports=function(t,e){var r=!1,n=0,i=function(){n=0,r&&(t(),n=setTimeout(i,e),r=!1)};return function(){return r=!0,n||i(),n}}},{}],273:[function(t,e,r){function n(t,e){if(t.row>e.row){var r=t;t=e,e=r}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function i(t,e,r,n,i){var a=Math.max(r,Math.floor(e.y0)),o=Math.min(n,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx0,f=e.dx<0,h=a;hu.dy&&(l=c,c=u,u=l),c.dy>f.dy&&(l=c,c=f,f=l),u.dy>f.dy&&(l=u,u=f,f=l),c.dy&&i(f,c,a,o,s),u.dy&&i(f,u,a,o,s)}t("../geo/coordinate");var o=t("../source/tile_id").OverscaledTileID;e.exports=function(t,e,r,n){function i(e,i,a){var c,u,f;if(a>=0&&a<=s)for(c=e;c=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)},r.bezier=function(t,e,r,i){var a=new n(t,e,r,i);return function(t){return a.solve(t)}},r.ease=r.bezier(.25,.1,.25,1),r.clamp=function(t,e,r){return Math.min(r,Math.max(e,t))},r.wrap=function(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i},r.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,i=new Array(t.length),a=null;t.forEach(function(t,o){e(t,function(t,e){t&&(a=t),i[o]=e,0==--n&&r(a,i)})})},r.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},r.keysDifference=function(t,e){var r=[];for(var n in t)n in e||r.push(n);return r},r.extend=function(t){for(var e=arguments,r=[],n=arguments.length-1;n-- >0;)r[n]=e[n+1];for(var i=0,a=r;i=0)return!0;return!1};var o={};r.warnOnce=function(t){o[t]||("undefined"!=typeof console&&console.warn(t),o[t]=!0)},r.isCounterClockwise=function(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)},r.calculateSignedArea=function(t){for(var e=0,r=0,n=t.length,i=n-1,a=void 0,o=void 0;r0||Math.abs(e.y-n.y)>0)&&Math.abs(r.calculateSignedArea(t))>.01},r.sphericalToCartesian=function(t){var e=t[0],r=t[1],n=t[2];return r+=90,r*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n)}},r.parseCacheControl=function(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(t,r,n,i){var a=n||i;return e[r]=!a||a.toLowerCase(),""}),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}},{"../geo/coordinate":61,"../style-spec/util/deep_equal":155,"@mapbox/point-geometry":4,"@mapbox/unitbezier":7}],276:[function(t,e,r){var n=function(t,e,r,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,null!=t.id&&(this.id=t.id)},i={geometry:{}};i.geometry.get=function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},i.geometry.set=function(t){this._geometry=t},n.prototype.toJSON=function(){var t={geometry:this.geometry};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t},Object.defineProperties(n.prototype,i),e.exports=n},{}],277:[function(t,e,r){var n=t("./script_detection");e.exports=function(t){for(var r="",i=0;i":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"}},{"./script_detection":269}],278:[function(t,e,r){function n(t,e,r){void 0===r&&(r={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),g[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}var i=t("grid-index"),a=t("../style-spec/util/color"),o=t("../style-spec/expression"),s=o.StylePropertyFunction,l=o.StyleExpression,c=o.StyleExpressionWithErrorHandling,u=o.ZoomDependentExpression,f=o.ZoomConstantExpression,h=t("../style-spec/expression/compound_expression").CompoundExpression,p=t("../style-spec/expression/definitions"),d=t("./window").ImageData,g={};for(var m in n("Object",Object),i.serialize=function(t,e){var r=t.toArrayBuffer();return e&&e.push(r),r},i.deserialize=function(t){return new i(t)},n("Grid",i),n("Color",a),n("StylePropertyFunction",s),n("StyleExpression",l,{omit:["_evaluator"]}),n("StyleExpressionWithErrorHandling",c,{omit:["_evaluator"]}),n("ZoomDependentExpression",u),n("ZoomConstantExpression",f),n("CompoundExpression",h,{omit:["_evaluate"]}),p)p[m]._classRegistryKey||n("Expression_"+m,p[m]);e.exports={register:n,serialize:function t(e,r){if(null===e||void 0===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(e instanceof ArrayBuffer)return r&&r.push(e),e;if(ArrayBuffer.isView(e)){var n=e;return r&&r.push(n.buffer),n}if(e instanceof d)return r&&r.push(e.data.buffer),e;if(Array.isArray(e)){for(var i=[],a=0,o=e;a=0)){var h=e[f];u[f]=g[c].shallow.indexOf(f)>=0?h:t(h,r)}return{name:c,properties:u}}throw new Error("can't serialize object of type "+typeof e)},deserialize:function t(e){if(null===e||void 0===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof d)return e;if(Array.isArray(e))return e.map(function(e){return t(e)});if("object"==typeof e){var r=e,n=r.name,i=r.properties;if(!n)throw new Error("can't deserialize object of anonymous class");var a=g[n].klass;if(!a)throw new Error("can't deserialize unregistered class "+n);if(a.deserialize)return a.deserialize(i._serialized);for(var o=Object.create(a.prototype),s=0,l=Object.keys(i);s=0?i[c]:t(i[c])}return o}throw new Error("can't deserialize object of type "+typeof e)}}},{"../style-spec/expression":139,"../style-spec/expression/compound_expression":123,"../style-spec/expression/definitions":131,"../style-spec/util/color":153,"./window":254,"grid-index":24}],279:[function(t,e,r){var n=t("./web_worker"),i=function(){this.active={}};i.prototype.acquire=function(e){if(!this.workers){var r=t("../").workerCount;for(this.workers=[];this.workers.lengthp[1][2]&&(v[0]=-v[0]),p[0][2]>p[2][0]&&(v[1]=-v[1]),p[1][0]>p[0][1]&&(v[2]=-v[2]),!0}},{"./normalize":372,"gl-mat4/clone":229,"gl-mat4/create":230,"gl-mat4/determinant":231,"gl-mat4/invert":235,"gl-mat4/transpose":245,"gl-vec3/cross":290,"gl-vec3/dot":293,"gl-vec3/length":298,"gl-vec3/normalize":304}],372:[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;i<16;i++)t[i]=e[i]*n;return!0}},{}],373:[function(t,e,r){var n=t("gl-vec3/lerp"),i=t("mat4-recompose"),a=t("mat4-decompose"),o=t("gl-mat4/determinant"),s=t("quat-slerp"),l=f(),c=f(),u=f();function f(){return{translate:h(),scale:h(1),skew:h(),perspective:[0,0,0,1],quaternion:[0,0,0,1]}}function h(t){return[t||0,t||0,t||0]}e.exports=function(t,e,r,f){if(0===o(e)||0===o(r))return!1;var h=a(e,l.translate,l.scale,l.skew,l.perspective,l.quaternion),p=a(r,c.translate,c.scale,c.skew,c.perspective,c.quaternion);return!(!h||!p||(n(u.translate,l.translate,c.translate,f),n(u.skew,l.skew,c.skew,f),n(u.scale,l.scale,c.scale,f),n(u.perspective,l.perspective,c.perspective,f),s(u.quaternion,l.quaternion,c.quaternion,f),i(t,u.translate,u.scale,u.skew,u.perspective,u.quaternion),0))}},{"gl-mat4/determinant":231,"gl-vec3/lerp":299,"mat4-decompose":371,"mat4-recompose":374,"quat-slerp":425}],374:[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,a,o,s){return n.identity(t),n.fromRotationTranslation(t,s,e),t[3]=o[0],t[7]=o[1],t[11]=o[2],t[15]=o[3],n.identity(i),0!==a[2]&&(i[9]=a[2],n.multiply(t,t,i)),0!==a[1]&&(i[9]=0,i[8]=a[1],n.multiply(t,t,i)),0!==a[0]&&(i[8]=0,i[4]=a[0],n.multiply(t,t,i)),n.scale(t,t,r),t}},{"gl-mat4/create":230,"gl-mat4/fromRotationTranslation":233,"gl-mat4/identity":234,"gl-mat4/multiply":237,"gl-mat4/scale":243,"gl-mat4/translate":244}],375:[function(t,e,r){"use strict";e.exports=Math.log2||function(t){return Math.log(t)*Math.LOG2E}},{}],376:[function(t,e,r){"use strict";var n=t("binary-search-bounds"),i=t("mat4-interpolate"),a=t("gl-mat4/invert"),o=t("gl-mat4/rotateX"),s=t("gl-mat4/rotateY"),l=t("gl-mat4/rotateZ"),c=t("gl-mat4/lookAt"),u=t("gl-mat4/translate"),f=(t("gl-mat4/scale"),t("gl-vec3/normalize")),h=[0,0,0];function p(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]}e.exports=function(t){return new p((t=t||{}).matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])};var d=p.prototype;d.recalcMatrix=function(t){var e=this._time,r=n.le(e,t),o=this.computedMatrix;if(!(r<0)){var s=this._components;if(r===e.length-1)for(var l=16*r,c=0;c<16;++c)o[c]=s[l++];else{var u=e[r+1]-e[r],h=(l=16*r,this.prevMatrix),p=!0;for(c=0;c<16;++c)h[c]=s[l++];var d=this.nextMatrix;for(c=0;c<16;++c)d[c]=s[l++],p=p&&h[c]===d[c];if(u<1e-6||p)for(c=0;c<16;++c)o[c]=h[c];else i(o,h,d,(t-e[r])/u)}var g=this.computedUp;g[0]=o[1],g[1]=o[5],g[2]=o[9],f(g,g);var m=this.computedInverse;a(m,o);var v=this.computedEye,y=m[15];v[0]=m[12]/y,v[1]=m[13]/y,v[2]=m[14]/y;var x=this.computedCenter,b=Math.exp(this.computedRadius[0]);for(c=0;c<3;++c)x[c]=v[c]-o[2+4*c]*b}},d.idle=function(t){if(!(t1&&n(t[o[u-2]],t[o[u-1]],c)<=0;)u-=1,o.pop();for(o.push(l),u=s.length;u>1&&n(t[s[u-2]],t[s[u-1]],c)>=0;)u-=1,s.pop();s.push(l)}for(var r=new Array(s.length+o.length-2),f=0,i=0,h=o.length;i0;--p)r[f++]=s[p];return r};var n=t("robust-orientation")[3]},{"robust-orientation":446}],378:[function(t,e,r){"use strict";e.exports=function(t,e){e||(e=t,t=window);var r=0,i=0,a=0,o={shift:!1,alt:!1,control:!1,meta:!1},s=!1;function l(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==o.alt,o.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==o.shift,o.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==o.control,o.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==o.meta,o.meta=!!t.metaKey),e}function c(t,s){var c=n.x(s),u=n.y(s);"buttons"in s&&(t=0|s.buttons),(t!==r||c!==i||u!==a||l(s))&&(r=0|t,i=c||0,a=u||0,e&&e(r,i,a,o))}function u(t){c(0,t)}function f(){(r||i||a||o.shift||o.alt||o.meta||o.control)&&(i=a=0,r=0,o.shift=o.alt=o.control=o.meta=!1,e&&e(0,0,0,o))}function h(t){l(t)&&e&&e(r,i,a,o)}function p(t){0===n.buttons(t)?c(0,t):c(r,t)}function d(t){c(r|n.buttons(t),t)}function g(t){c(r&~n.buttons(t),t)}function m(){s||(s=!0,t.addEventListener("mousemove",p),t.addEventListener("mousedown",d),t.addEventListener("mouseup",g),t.addEventListener("mouseleave",u),t.addEventListener("mouseenter",u),t.addEventListener("mouseout",u),t.addEventListener("mouseover",u),t.addEventListener("blur",f),t.addEventListener("keyup",h),t.addEventListener("keydown",h),t.addEventListener("keypress",h),t!==window&&(window.addEventListener("blur",f),window.addEventListener("keyup",h),window.addEventListener("keydown",h),window.addEventListener("keypress",h)))}m();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return s},set:function(e){e?m():s&&(s=!1,t.removeEventListener("mousemove",p),t.removeEventListener("mousedown",d),t.removeEventListener("mouseup",g),t.removeEventListener("mouseleave",u),t.removeEventListener("mouseenter",u),t.removeEventListener("mouseout",u),t.removeEventListener("mouseover",u),t.removeEventListener("blur",f),t.removeEventListener("keyup",h),t.removeEventListener("keydown",h),t.removeEventListener("keypress",h),t!==window&&(window.removeEventListener("blur",f),window.removeEventListener("keyup",h),window.removeEventListener("keydown",h),window.removeEventListener("keypress",h)))},enumerable:!0},buttons:{get:function(){return r},enumerable:!0},x:{get:function(){return i},enumerable:!0},y:{get:function(){return a},enumerable:!0},mods:{get:function(){return o},enumerable:!0}}),v};var n=t("mouse-event")},{"mouse-event":380}],379:[function(t,e,r){var n={left:0,top:0};e.exports=function(t,e,r){e=e||t.currentTarget||t.srcElement,Array.isArray(r)||(r=[0,0]);var i=t.clientX||0,a=t.clientY||0,o=(s=e,s===window||s===document||s===document.body?n:s.getBoundingClientRect());var s;return r[0]=i-o.left,r[1]=a-o.top,r}},{}],380:[function(t,e,r){"use strict";function n(t){return t.target||t.srcElement||window}r.buttons=function(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){if(2===(e=t.which))return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1< 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 C=t.getters||[],E=new Array(T),L=0;L=0?E[L]=!0:E[L]=!1;return function(t,e,r,T,S,C){var E=C.length,L=S.length;if(L<2)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var z="extractContour"+S.join("_"),P=[],D=[],O=[],I=0;I0&&N.push(l(I,S[R-1])+"*"+s(S[R-1])),D.push(d(I,S[R])+"=("+N.join("-")+")|0")}for(var I=0;I=0;--I)j.push(s(S[I]));D.push(w+"=("+j.join("*")+")|0",b+"=mallocUint32("+w+")",x+"=mallocUint32("+w+")",k+"=0"),D.push(g(0)+"=0");for(var R=1;R<1<0;M=M-1&d)w.push(x+"["+k+"+"+v(M)+"]");w.push(y(0));for(var M=0;M=0;--e)G(e,0);for(var r=[],e=0;e0){",p(S[e]),"=1;");t(e-1,r|1<=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),a.push("1"),o.push("s["+l+"]-2"));var c=".lo("+a.join()+").hi("+o.join()+")";if(0===a.length&&(c=""),i>0){n.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||n.push("&&s[",l,"]>2");n.push("){grad",i,"(src.pick(",s.join(),")",c);for(var l=0;l=0||e.indexOf(-(l+1))>=0||n.push(",dst.pick(",s.join(),",",l,")",c);n.push(");")}for(var l=0;l1){dst.set(",s.join(),",",u,",0.5*(src.get(",h.join(),")-src.get(",p.join(),")))}else{dst.set(",s.join(),",",u,",0)};"):n.push("if(s[",u,"]>1){diff(",f,",src.pick(",h.join(),")",c,",src.pick(",p.join(),")",c,");}else{zero(",f,");};");break;case"mirror":0===i?n.push("dst.set(",s.join(),",",u,",0);"):n.push("zero(",f,");");break;case"wrap":var d=s.slice(),g=s.slice();e[l]<0?(d[u]="s["+u+"]-2",g[u]="0"):(d[u]="s["+u+"]-1",g[u]="1"),0===i?n.push("if(s[",u,"]>2){dst.set(",s.join(),",",u,",0.5*(src.get(",d.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",u,",0)};"):n.push("if(s[",u,"]>2){diff(",f,",src.pick(",d.join(),")",c,",src.pick(",g.join(),")",c,");}else{zero(",f,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}i>0&&n.push("};")}for(var s=0;s<1<>",rrshift:">>>"};!function(){for(var t in s){var e=s[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 l={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in l){var e=l[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in c){var e=c[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var u=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=n({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=n({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=n({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=n({args:["array","array"],pre:i,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":117}],388:[function(t,e,r){"use strict";var n=t("ndarray"),i=t("./doConvert.js");e.exports=function(t,e){for(var r=[],a=t,o=1;Array.isArray(a);)r.push(a.length),o*=a.length,a=a[0];return 0===r.length?n():(e||(e=n(new Float64Array(o),r)),i(e,t),e)}},{"./doConvert.js":389,ndarray:393}],389:[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":117}],390:[function(t,e,r){"use strict";var n=t("typedarray-pool"),i=32;function a(t){switch(t){case"uint8":return[n.mallocUint8,n.freeUint8];case"uint16":return[n.mallocUint16,n.freeUint16];case"uint32":return[n.mallocUint32,n.freeUint32];case"int8":return[n.mallocInt8,n.freeInt8];case"int16":return[n.mallocInt16,n.freeInt16];case"int32":return[n.mallocInt32,n.freeInt32];case"float32":return[n.mallocFloat,n.freeFloat];case"float64":return[n.mallocDouble,n.freeDouble];default:return null}}function o(t){for(var e=[],r=0;r0?s.push(["d",d,"=s",d,"-d",f,"*n",f].join("")):s.push(["d",d,"=s",d].join("")),f=d),0!=(p=t.length-1-l)&&(h>0?s.push(["e",p,"=s",p,"-e",h,"*n",h,",f",p,"=",c[p],"-f",h,"*n",h].join("")):s.push(["e",p,"=s",p,",f",p,"=",c[p]].join("")),h=p)}r.push("var "+s.join(","));var g=["0","n0-1","data","offset"].concat(o(t.length));r.push(["if(n0<=",i,"){","insertionSort(",g.join(","),")}else{","quickSort(",g.join(","),")}"].join("")),r.push("}return "+n);var m=new Function("insertionSort","quickSort",r.join("\n")),v=function(t,e){var r=["'use strict'"],n=["ndarrayInsertionSort",t.join("d"),e].join(""),i=["left","right","data","offset"].concat(o(t.length)),s=a(e),l=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var c=[],u=1;u1){for(r.push("dptr=0;sptr=ptr"),u=t.length-1;u>=0;--u)0!==(p=t[u])&&r.push(["for(i",p,"=0;i",p,"b){break __l}"].join("")),u=t.length-1;u>=1;--u)r.push("sptr+=e"+u,"dptr+=f"+u,"}");for(r.push("dptr=cptr;sptr=cptr-s0"),u=t.length-1;u>=0;--u)0!==(p=t[u])&&r.push(["for(i",p,"=0;i",p,"=0;--u)0!==(p=t[u])&&r.push(["for(i",p,"=0;i",p,"scratch)){",h("cptr",f("cptr-s0")),"cptr-=s0","}",h("cptr","scratch"));return r.push("}"),t.length>1&&s&&r.push("free(scratch)"),r.push("} return "+n),s?new Function("malloc","free",r.join("\n"))(s[0],s[1]):new Function(r.join("\n"))()}(t,e);return m(v,function(t,e,r){var n=["'use strict'"],s=["ndarrayQuickSort",t.join("d"),e].join(""),l=["left","right","data","offset"].concat(o(t.length)),c=a(e),u=0;n.push(["function ",s,"(",l.join(","),"){"].join(""));var f=["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 h=[],p=1;p=0;--a)0!==(o=t[a])&&n.push(["for(i",o,"=0;i",o,"1)for(a=0;a1?n.push("ptr_shift+=d"+o):n.push("ptr0+=d"+o),n.push("}"))}}function y(e,r,i,a){if(1===r.length)n.push("ptr0="+d(r[0]));else{for(var o=0;o1)for(o=0;o=1;--o)i&&n.push("pivot_ptr+=f"+o),r.length>1?n.push("ptr_shift+=e"+o):n.push("ptr0+=e"+o),n.push("}")}function x(){t.length>1&&c&&n.push("free(pivot1)","free(pivot2)")}function b(e,r){var i="el"+e,a="el"+r;if(t.length>1){var o="__l"+ ++u;y(o,[i,a],!1,["comp=",g("ptr0"),"-",g("ptr1"),"\n","if(comp>0){tmp0=",i,";",i,"=",a,";",a,"=tmp0;break ",o,"}\n","if(comp<0){break ",o,"}"].join(""))}else n.push(["if(",g(d(i)),">",g(d(a)),"){tmp0=",i,";",i,"=",a,";",a,"=tmp0}"].join(""))}function _(e,r){t.length>1?v([e,r],!1,m("ptr0",g("ptr1"))):n.push(m(d(e),g(d(r))))}function w(e,r,i){if(t.length>1){var a="__l"+ ++u;y(a,[r],!0,[e,"=",g("ptr0"),"-pivot",i,"[pivot_ptr]\n","if(",e,"!==0){break ",a,"}"].join(""))}else n.push([e,"=",g(d(r)),"-pivot",i].join(""))}function k(e,r){t.length>1?v([e,r],!1,["tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1","tmp")].join("")):n.push(["ptr0=",d(e),"\n","ptr1=",d(r),"\n","tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1","tmp")].join(""))}function M(e,r,i){t.length>1?(v([e,r,i],!1,["tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1",g("ptr2")),"\n",m("ptr2","tmp")].join("")),n.push("++"+r,"--"+i)):n.push(["ptr0=",d(e),"\n","ptr1=",d(r),"\n","ptr2=",d(i),"\n","++",r,"\n","--",i,"\n","tmp=",g("ptr0"),"\n",m("ptr0",g("ptr1")),"\n",m("ptr1",g("ptr2")),"\n",m("ptr2","tmp")].join(""))}function A(t,e){k(t,e),n.push("--"+e)}function T(e,r,i){t.length>1?v([e,r],!0,[m("ptr0",g("ptr1")),"\n",m("ptr1",["pivot",i,"[pivot_ptr]"].join(""))].join("")):n.push(m(d(e),g(d(r))),m(d(r),"pivot"+i))}function S(e,r){n.push(["if((",r,"-",e,")<=",i,"){\n","insertionSort(",e,",",r,",data,offset,",o(t.length).join(","),")\n","}else{\n",s,"(",e,",",r,",data,offset,",o(t.length).join(","),")\n","}"].join(""))}function C(e,r,i){t.length>1?(n.push(["__l",++u,":while(true){"].join("")),v([e],!0,["if(",g("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",u,"}"].join("")),n.push(i,"}")):n.push(["while(",g(d(e)),"===pivot",r,"){",i,"}"].join(""))}return n.push("var "+f.join(",")),b(1,2),b(4,5),b(1,3),b(2,3),b(1,4),b(3,4),b(2,5),b(2,3),b(4,5),t.length>1?v(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",g("ptr1"),"\n","pivot2[pivot_ptr]=",g("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",g("ptr0"),"\n","y=",g("ptr2"),"\n","z=",g("ptr4"),"\n",m("ptr5","x"),"\n",m("ptr6","y"),"\n",m("ptr7","z")].join("")):n.push(["pivot1=",g(d("el2")),"\n","pivot2=",g(d("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",g(d("el1")),"\n","y=",g(d("el3")),"\n","z=",g(d("el5")),"\n",m(d("index1"),"x"),"\n",m(d("index3"),"y"),"\n",m(d("index5"),"z")].join("")),_("index2","left"),_("index4","right"),n.push("if(pivots_are_equal){"),n.push("for(k=less;k<=great;++k){"),w("comp","k",1),n.push("if(comp===0){continue}"),n.push("if(comp<0){"),n.push("if(k!==less){"),k("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),n.push("while(true){"),w("comp","great",1),n.push("if(comp>0){"),n.push("great--"),n.push("}else if(comp<0){"),M("k","less","great"),n.push("break"),n.push("}else{"),A("k","great"),n.push("break"),n.push("}"),n.push("}"),n.push("}"),n.push("}"),n.push("}else{"),n.push("for(k=less;k<=great;++k){"),w("comp_pivot1","k",1),n.push("if(comp_pivot1<0){"),n.push("if(k!==less){"),k("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),w("comp_pivot2","k",2),n.push("if(comp_pivot2>0){"),n.push("while(true){"),w("comp","great",2),n.push("if(comp>0){"),n.push("if(--greatindex5){"),C("less",1,"++less"),C("great",2,"--great"),n.push("for(k=less;k<=great;++k){"),w("comp_pivot1","k",1),n.push("if(comp_pivot1===0){"),n.push("if(k!==less){"),k("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),w("comp_pivot2","k",2),n.push("if(comp_pivot2===0){"),n.push("while(true){"),w("comp","great",2),n.push("if(comp===0){"),n.push("if(--great1&&c?new Function("insertionSort","malloc","free",n.join("\n"))(r,c[0],c[1]):new Function("insertionSort",n.join("\n"))(r)}(t,e,v))}},{"typedarray-pool":481}],391:[function(t,e,r){"use strict";var n=t("./lib/compile_sort.js"),i={};e.exports=function(t){var e=t.order,r=t.dtype,a=[e,r].join(":"),o=i[a];return o||(i[a]=o=n(e,r)),o(t),t}},{"./lib/compile_sort.js":390}],392:[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_3_arg4_)}",args:[{name:"_inline_3_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_3_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_3_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_3_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_3_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_4_arg2_(this_warped,_inline_4_arg0_),_inline_4_arg1_=_inline_4_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_4_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_4_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_4_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_4_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_4_arg4_",lvalue:!1,rvalue:!1,count:0}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warpND",blockSize:64}),a=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_7_arg2_(this_warped,_inline_7_arg0_),_inline_7_arg1_=_inline_7_arg3_(_inline_7_arg4_,this_warped[0])}",args:[{name:"_inline_7_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_7_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_7_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_7_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_7_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp1D",blockSize:64}),o=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,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],this_warped[1])}",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:"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_13_arg2_(this_warped,_inline_13_arg0_),_inline_13_arg1_=_inline_13_arg3_(_inline_13_arg4_,this_warped[0],this_warped[1],this_warped[2])}",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:"warp3D",blockSize:64});e.exports=function(t,e,r){switch(e.shape.length){case 1:a(t,r,n.d1,e);break;case 2:o(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":120,"ndarray-linear-interpolate":386}],393:[function(t,e,r){var n=t("iota-array"),i=t("is-buffer"),a="undefined"!=typeof Float64Array;function o(t,e){return t[0]-e[0]}function s(){var t,e=this.stride,r=new Array(e.length);for(t=0;tMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&a.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];}}})")):a.push("ORDER})")),a.push("proto.set=function "+r+"_set("+l.join(",")+",v){"),i?a.push("return this.data.set("+u+",v)}"):a.push("return this.data["+u+"]=v}"),a.push("proto.get=function "+r+"_get("+l.join(",")+"){"),i?a.push("return this.data.get("+u+")}"):a.push("return this.data["+u+"]}"),a.push("proto.index=function "+r+"_index(",l.join(),"){return "+u+"}"),a.push("proto.hi=function "+r+"_hi("+l.join(",")+"){return new "+r+"(this.data,"+o.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+o.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var p=o.map(function(t){return"a"+t+"=this.shape["+t+"]"}),d=o.map(function(t){return"c"+t+"=this.stride["+t+"]"});a.push("proto.lo=function "+r+"_lo("+l.join(",")+"){var b=this.offset,d=0,"+p.join(",")+","+d.join(","));for(var g=0;g=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}");a.push("return new "+r+"(this.data,"+o.map(function(t){return"a"+t}).join(",")+","+o.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+l.join(",")+"){var "+o.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+o.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(g=0;g=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}");return a.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),a.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+o.map(function(t){return"shape["+t+"]"}).join(",")+","+o.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",a.join("\n"))(c[t],s)}var c={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=function(t,e,r,n){if(void 0===t)return(0,c.array[0])([]);"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var o=e.length;if(void 0===r){r=new Array(o);for(var s=o-1,u=1;s>=0;--s)r[s]=u,u*=e[s]}if(void 0===n)for(n=0,s=0;s>>0;e.exports=function(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(0===t)return e<0?-i:i;var r=n.hi(t),o=n.lo(t);e>t==t>0?o===a?(r+=1,o=0):o+=1:0===o?(o=a,r-=1):o-=1;return n.pack(o,r)}},{"double-bits":134}],395:[function(t,e,r){var n=Math.PI,i=c(120);function a(t,e,r,n){return["C",t,e,r,n,r,n]}function o(t,e,r,n,i,a){return["C",t/3+2/3*r,e/3+2/3*n,i/3+2/3*r,a/3+2/3*n,i,a]}function s(t,e,r,a,o,c,u,f,h,p){if(p)k=p[0],M=p[1],_=p[2],w=p[3];else{var d=l(t,e,-o);t=d.x,e=d.y;var g=(t-(f=(d=l(f,h,-o)).x))/2,m=(e-(h=d.y))/2,v=g*g/(r*r)+m*m/(a*a);v>1&&(r*=v=Math.sqrt(v),a*=v);var y=r*r,x=a*a,b=(c==u?-1:1)*Math.sqrt(Math.abs((y*x-y*m*m-x*g*g)/(y*m*m+x*g*g)));b==1/0&&(b=1);var _=b*r*m/a+(t+f)/2,w=b*-a*g/r+(e+h)/2,k=Math.asin(((e-w)/a).toFixed(9)),M=Math.asin(((h-w)/a).toFixed(9));k=t<_?n-k:k,M=f<_?n-M:M,k<0&&(k=2*n+k),M<0&&(M=2*n+M),u&&k>M&&(k-=2*n),!u&&M>k&&(M-=2*n)}if(Math.abs(M-k)>i){var A=M,T=f,S=h;M=k+i*(u&&M>k?1:-1);var C=s(f=_+r*Math.cos(M),h=w+a*Math.sin(M),r,a,o,0,u,T,S,[M,A,_,w])}var E=Math.tan((M-k)/4),L=4/3*r*E,z=4/3*a*E,P=[2*t-(t+L*Math.sin(k)),2*e-(e-z*Math.cos(k)),f+L*Math.sin(M),h-z*Math.cos(M),f,h];if(p)return P;C&&(P=P.concat(C));for(var D=0;D7&&(r.push(v.splice(0,7)),v.unshift("C"));break;case"S":var x=p,b=d;"C"!=e&&"S"!=e||(x+=x-n,b+=b-i),v=["C",x,b,v[1],v[2],v[3],v[4]];break;case"T":"Q"==e||"T"==e?(f=2*p-f,h=2*d-h):(f=p,h=d),v=o(p,d,f,h,v[1],v[2]);break;case"Q":f=v[1],h=v[2],v=o(p,d,v[1],v[2],v[3],v[4]);break;case"L":v=a(p,d,v[1],v[2]);break;case"H":v=a(p,d,v[1],d);break;case"V":v=a(p,d,p,v[1]);break;case"Z":v=a(p,d,l,u)}e=y,p=v[v.length-2],d=v[v.length-1],v.length>4?(n=v[v.length-4],i=v[v.length-3]):(n=p,i=d),r.push(v)}return r}},{}],396:[function(t,e,r){r.vertexNormals=function(t,e,r){for(var n=e.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa){var b=i[c],_=1/Math.sqrt(m*y);for(x=0;x<3;++x){var w=(x+1)%3,k=(x+2)%3;b[x]+=_*(v[w]*g[k]-v[k]*g[w])}}}for(o=0;oa)for(_=1/Math.sqrt(M),x=0;x<3;++x)b[x]*=_;else for(x=0;x<3;++x)b[x]=0}return i},r.faceNormals=function(t,e,r){for(var n=t.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa?1/Math.sqrt(p):0;for(c=0;c<3;++c)h[c]*=p;i[o]=h}return i}},{}],397:[function(t,e,r){"use strict";var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(t){n[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,o,s=function(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),l=1;l0){var f=Math.sqrt(u+1);t[0]=.5*(o-l)/f,t[1]=.5*(s-n)/f,t[2]=.5*(r-a)/f,t[3]=.5*f}else{var h=Math.max(e,a,c),f=Math.sqrt(2*h-u+1);e>=h?(t[0]=.5*f,t[1]=.5*(i+r)/f,t[2]=.5*(s+n)/f,t[3]=.5*(o-l)/f):a>=h?(t[0]=.5*(r+i)/f,t[1]=.5*f,t[2]=.5*(l+o)/f,t[3]=.5*(s-n)/f):(t[0]=.5*(n+s)/f,t[1]=.5*(o+l)/f,t[2]=.5*f,t[3]=.5*(r-i)/f)}return t}},{}],399:[function(t,e,r){"use strict";e.exports=function(t){var e=(t=t||{}).center||[0,0,0],r=t.rotation||[0,0,0,1],n=t.radius||1;e=[].slice.call(e,0,3),u(r=[].slice.call(r,0,4),r);var i=new f(r,e,Math.log(n));i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up);return i};var n=t("filtered-vector"),i=t("gl-mat4/lookAt"),a=t("gl-mat4/fromQuat"),o=t("gl-mat4/invert"),s=t("./lib/quatFromFrame");function l(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function c(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function u(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=c(r,n,i,a);o>1e-6?(t[0]=r/o,t[1]=n/o,t[2]=i/o,t[3]=a/o):(t[0]=t[1]=t[2]=0,t[3]=1)}function f(t,e,r){this.radius=n([r]),this.center=n(e),this.rotation=n(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)}var h=f.prototype;h.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},h.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;u(e,e);var r=this.computedMatrix;a(r,e);var n=this.computedCenter,i=this.computedEye,o=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],o[0]=r[1],o[1]=r[5],o[2]=r[9];for(var l=0;l<3;++l){for(var c=0,f=0;f<3;++f)c+=r[l+4*f]*i[f];r[12+l]=-c}},h.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r},h.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},h.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},h.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var i=this.computedMatrix,a=i[1],o=i[5],s=i[9],c=l(a,o,s);a/=c,o/=c,s/=c;var u=i[0],f=i[4],h=i[8],p=u*a+f*o+h*s,d=l(u-=a*p,f-=o*p,h-=s*p);u/=d,f/=d,h/=d;var g=i[2],m=i[6],v=i[10],y=g*a+m*o+v*s,x=g*u+m*f+v*h,b=l(g-=y*a+x*u,m-=y*o+x*f,v-=y*s+x*h);g/=b,m/=b,v/=b;var _=u*e+a*r,w=f*e+o*r,k=h*e+s*r;this.center.move(t,_,w,k);var M=Math.exp(this.computedRadius[0]);M=Math.max(1e-4,M+n),this.radius.set(t,Math.log(M))},h.rotate=function(t,e,r,n){this.recalcMatrix(t),e=e||0,r=r||0;var i=this.computedMatrix,a=i[0],o=i[4],s=i[8],u=i[1],f=i[5],h=i[9],p=i[2],d=i[6],g=i[10],m=e*a+r*u,v=e*o+r*f,y=e*s+r*h,x=-(d*y-g*v),b=-(g*m-p*y),_=-(p*v-d*m),w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2))),k=c(x,b,_,w);k>1e-6?(x/=k,b/=k,_/=k,w/=k):(x=b=_=0,w=1);var M=this.computedRotation,A=M[0],T=M[1],S=M[2],C=M[3],E=A*w+C*x+T*_-S*b,L=T*w+C*b+S*x-A*_,z=S*w+C*_+A*b-T*x,P=C*w-A*x-T*b-S*_;if(n){x=p,b=d,_=g;var D=Math.sin(n)/l(x,b,_);x*=D,b*=D,_*=D,P=P*(w=Math.cos(e))-(E=E*w+P*x+L*_-z*b)*x-(L=L*w+P*b+z*x-E*_)*b-(z=z*w+P*_+E*b-L*x)*_}var O=c(E,L,z,P);O>1e-6?(E/=O,L/=O,z/=O,P/=O):(E=L=z=0,P=1),this.rotation.set(t,E,L,z,P)},h.lookAt=function(t,e,r,n){this.recalcMatrix(t),r=r||this.computedCenter,e=e||this.computedEye,n=n||this.computedUp;var a=this.computedMatrix;i(a,e,r,n);var o=this.computedRotation;s(o,a[0],a[1],a[2],a[4],a[5],a[6],a[8],a[9],a[10]),u(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var l=0,c=0;c<3;++c)l+=Math.pow(r[c]-e[c],2);this.radius.set(t,.5*Math.log(Math.max(l,1e-6))),this.center.set(t,r[0],r[1],r[2])},h.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},h.setMatrix=function(t,e){var r=this.computedRotation;s(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),u(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;o(n,e);var i=n[15];if(Math.abs(i)>1e-6){var a=n[12]/i,l=n[13]/i,c=n[14]/i;this.recalcMatrix(t);var f=Math.exp(this.computedRadius[0]);this.center.set(t,a-n[2]*f,l-n[6]*f,c-n[10]*f),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},h.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},h.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},h.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])]},h.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]}},h.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":398,"filtered-vector":198,"gl-mat4/fromQuat":232,"gl-mat4/invert":235,"gl-mat4/lookAt":236}],400:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return n(r=void 0!==r?r+"":" ",e)+t}},{"repeat-string":439}],401:[function(t,e,r){"use strict";var n=t("pick-by-alias");e.exports=function(t){var e;arguments.length>1&&(t=arguments);"string"==typeof t?t=t.split(/\s/).map(parseFloat):"number"==typeof t&&(t=[t]);t.length&&"number"==typeof t[0]?e=1===t.length?{width:t[0],height:t[0],x:0,y:0}:2===t.length?{width:t[0],height:t[1],x:0,y:0}:{x:t[0],y:t[1],width:t[2]-t[0]||0,height:t[3]-t[1]||0}:t&&(t=n(t,{left:"x l left Left",top:"y t top Top",width:"w width W Width",height:"h height W Width",bottom:"b bottom Bottom",right:"r right Right"}),e={x:t.left||0,y:t.top||0},null==t.width?t.right?e.width=t.right-e.x:e.width=0:e.width=t.width,null==t.height?t.bottom?e.height=t.bottom-e.y:e.height=0:e.height=t.height);return e}},{"pick-by-alias":407}],402:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(i,function(t,r,i){var o=r.toLowerCase();for(i=function(t){var e=t.match(a);return e?e.map(Number):[]}(i),"m"==o&&i.length>2&&(e.push([r].concat(i.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(i.length==n[o])return i.unshift(r),e.push(i);if(i.length0;--o)a=l[o],r=s[o],s[o]=s[a],s[a]=r,l[o]=l[r],l[r]=a,c=(c+r)*o;return n.freeUint32(l),n.freeUint32(s),c},r.unrank=function(t,e,r){switch(t){case 0:return 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]}var n,i,a,o=1;for((r=r||new Array(t))[0]=0,a=1;a0;--a)e=e-(n=e/o|0)*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}},{"invert-permutation":359,"typedarray-pool":481}],407:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,a,o={};if("string"==typeof e&&(e=i(e)),Array.isArray(e)){var s={};for(a=0;a0){o=a[u][r][0],l=u;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=a[f][r],p=0;p0&&(o=d,s=g,l=f)}return i?s:(o&&c(o,l),s)}function f(t,r){var i=a[r][t][0],o=[t];c(i,r);for(var s=i[1^r];;){for(;s!==t;)o.push(s),s=u(o[o.length-2],s,!1);if(a[0][t].length+a[1][t].length===0)break;var l=o[o.length-1],f=t,h=o[1],p=u(l,f,!0);if(n(e[l],e[f],e[h],e[p])<0)break;o.push(t),s=u(l,f)}return o}function h(t,e){return e[1]===e[e.length-1]}for(var o=0;o0;){a[0][o].length;var g=f(o,p);h(d,g)?d.push.apply(d,g):(d.length>0&&l.push(d),d=g)}d.length>0&&l.push(d)}return l};var n=t("compare-angle")},{"compare-angle":108}],409:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=n(t,e.length),i=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){var c=o.pop();i[c]=!1;for(var u=r[c],s=0;s0})).length,m=new Array(g),v=new Array(g),p=0;p0;){var N=B.pop(),j=E[N];l(j,function(t,e){return t-e});var V,U=j.length,q=F[N];if(0===q){var k=d[N];V=[k]}for(var p=0;p=0)&&(F[H]=1^q,B.push(H),0===q)){var k=d[H];R(k)||(k.reverse(),V.push(k))}}0===q&&r.push(V)}return r};var n=t("edges-to-adjacency-list"),i=t("planar-dual"),a=t("point-in-big-polygon"),o=t("two-product"),s=t("robust-sum"),l=t("uniq"),c=t("./lib/trim-leaves");function u(t,e){for(var r=new Array(t),n=0;n>>1;e.dtype||(e.dtype="array"),"string"==typeof e.dtype?d=new(f(e.dtype))(m):e.dtype&&(d=e.dtype,Array.isArray(d)&&(d.length=m));for(var v=0;vr){for(var h=0;hl||A>c||T=E||o===s)){var u=y[a];void 0===s&&(s=u.length);for(var f=o;f=g&&p<=v&&d>=m&&d<=w&&z.push(h)}var b=x[a],_=b[4*o+0],k=b[4*o+1],C=b[4*o+2],L=b[4*o+3],P=function(t,e){for(var r=null,n=0;null===r;)if(r=t[4*e+n],++n>t.length)return null;return r}(b,o+1),D=.5*i,O=a+1;e(r,n,D,O,_,k||C||L||P),e(r,n+D,D,O,k,C||L||P),e(r+D,n,D,O,C,L||P),e(r+D,n+D,D,O,L,P)}}}(0,0,1,0,0,1),z},d;function C(t,e,r){for(var n=1,i=.5,a=.5,o=.5,s=0;s0&&e[i]===r[0]))return 1;a=t[i-1]}for(var s=1;a;){var l=a.key,c=n(r,l[0],l[1]);if(l[0][0]0))return 0;s=-1,a=a.right}else if(c>0)a=a.left;else{if(!(c<0))return 0;s=1,a=a.right}}return s}}(v.slabs,v.coordinates);return 0===a.length?y:function(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}(l(a),y)};var n=t("robust-orientation")[3],i=t("slab-decomposition"),a=t("interval-tree-1d"),o=t("binary-search-bounds");function s(){return!0}function l(t){for(var e={},r=0;r=-t},pointBetween:function(e,r,n){var i=e[1]-r[1],a=n[0]-r[0],o=e[0]-r[0],s=n[1]-r[1],l=o*a+i*s;return!(l-t)},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])t!=o-i>t&&(a-c)*(i-u)/(o-u)+c-n>t&&(s=!s),a=c,o=u}return s}};return e}},{}],418:[function(t,e,r){var n={toPolygon:function(t,e){function r(e){if(e.length<=0)return t.segments({inverted:!1,regions:[]});function r(e){var r=e.slice(0,e.length-1);return t.segments({inverted:!1,regions:[r]})}for(var n=r(e[0]),i=1;i0})}function u(t,n){var i=t.seg,a=n.seg,o=i.start,s=i.end,c=a.start,u=a.end;r&&r.checkIntersection(i,a);var f=e.linesIntersect(o,s,c,u);if(!1===f){if(!e.pointsCollinear(o,s,c))return!1;if(e.pointsSame(o,u)||e.pointsSame(s,c))return!1;var h=e.pointsSame(o,c),p=e.pointsSame(s,u);if(h&&p)return n;var d=!h&&e.pointBetween(o,c,u),g=!p&&e.pointBetween(s,c,u);if(h)return g?l(n,s):l(t,u),n;d&&(p||(g?l(n,s):l(t,u)),l(n,o))}else 0===f.alongA&&(-1===f.alongB?l(t,c):0===f.alongB?l(t,f.pt):1===f.alongB&&l(t,u)),0===f.alongB&&(-1===f.alongA?l(n,o):0===f.alongA?l(n,f.pt):1===f.alongA&&l(n,s));return!1}for(var f=[];!a.isEmpty();){var h=a.getHead();if(r&&r.vert(h.pt[0]),h.isStart){r&&r.segmentNew(h.seg,h.primary);var p=c(h),d=p.before?p.before.ev:null,g=p.after?p.after.ev:null;function m(){if(d){var t=u(h,d);if(t)return t}return!!g&&u(h,g)}r&&r.tempStatus(h.seg,!!d&&d.seg,!!g&&g.seg);var v,y,x=m();if(x)t?(y=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below)&&(x.seg.myFill.above=!x.seg.myFill.above):x.seg.otherFill=h.seg.myFill,r&&r.segmentUpdate(x.seg),h.other.remove(),h.remove();if(a.getHead()!==h){r&&r.rewind(h.seg);continue}t?(y=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below,h.seg.myFill.below=g?g.seg.myFill.above:i,h.seg.myFill.above=y?!h.seg.myFill.below:h.seg.myFill.below):null===h.seg.otherFill&&(v=g?h.primary===g.primary?g.seg.otherFill.above:g.seg.myFill.above:h.primary?o:i,h.seg.otherFill={above:v,below:v}),r&&r.status(h.seg,!!d&&d.seg,!!g&&g.seg),h.other.status=p.insert(n.node({ev:h}))}else{var b=h.status;if(null===b)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(s.exists(b.prev)&&s.exists(b.next)&&u(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!h.primary){var _=h.seg.myFill;h.seg.myFill=h.seg.otherFill,h.seg.otherFill=_}f.push(h.seg)}a.getHead().remove()}return r&&r.done(),f}return t?{addRegion:function(t){for(var n,i,a,o=t[t.length-1],l=0;l=c?(M=1,y=c+2*h+d):y=h*(M=-h/c)+d):(M=0,p>=0?(A=0,y=d):-p>=f?(A=1,y=f+2*p+d):y=p*(A=-p/f)+d);else if(A<0)A=0,h>=0?(M=0,y=d):-h>=c?(M=1,y=c+2*h+d):y=h*(M=-h/c)+d;else{var T=1/k;y=(M*=T)*(c*M+u*(A*=T)+2*h)+A*(u*M+f*A+2*p)+d}else M<0?(b=f+p)>(x=u+h)?(_=b-x)>=(w=c-2*u+f)?(M=1,A=0,y=c+2*h+d):y=(M=_/w)*(c*M+u*(A=1-M)+2*h)+A*(u*M+f*A+2*p)+d:(M=0,b<=0?(A=1,y=f+2*p+d):p>=0?(A=0,y=d):y=p*(A=-p/f)+d):A<0?(b=c+h)>(x=u+p)?(_=b-x)>=(w=c-2*u+f)?(A=1,M=0,y=f+2*p+d):y=(M=1-(A=_/w))*(c*M+u*A+2*h)+A*(u*M+f*A+2*p)+d:(A=0,b<=0?(M=1,y=c+2*h+d):h>=0?(M=0,y=d):y=h*(M=-h/c)+d):(_=f+p-u-h)<=0?(M=0,A=1,y=f+2*p+d):_>=(w=c-2*u+f)?(M=1,A=0,y=c+2*h+d):y=(M=_/w)*(c*M+u*(A=1-M)+2*h)+A*(u*M+f*A+2*p)+d;var S=1-M-A;for(l=0;l1)for(var r=1;r0){var c=t[r-1];if(0===n(s,c)&&a(c)!==l){r-=1;continue}}t[r++]=s}}return t.length=r,t}},{"cell-orientation":93,"compare-cell":109,"compare-oriented-cell":110}],432:[function(t,e,r){"use strict";var n=t("array-bounds"),i=t("color-normalize"),a=t("update-diff"),o=t("pick-by-alias"),s=t("object-assign"),l=t("flatten-vertex-data"),c=t("to-float32"),u=c.float32,f=c.fract32;e.exports=function(t,e){"function"==typeof t?(e||(e={}),e.regl=t):e=t;e.length&&(e.positions=e);if(!(t=e.regl).hasExtension("ANGLE_instanced_arrays"))throw Error("regl-error2d: `ANGLE_instanced_arrays` extension should be enabled");var r,c,p,d,g,m,v=t._gl,y={color:"black",capSize:5,lineWidth:1,opacity:1,viewport:null,range:null,offset:0,count:0,bounds:null,positions:[],errors:[]},x=[];return d=t.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array(0)}),c=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),p=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),g=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)}),m=t.buffer({usage:"static",type:"float",data:h}),k(e),r=t({vert:"\n\t\tprecision highp float;\n\n\t\tattribute vec2 position, positionFract;\n\t\tattribute vec4 error;\n\t\tattribute vec4 color;\n\n\t\tattribute vec2 direction, lineOffset, capOffset;\n\n\t\tuniform vec4 viewport;\n\t\tuniform float lineWidth, capSize;\n\t\tuniform vec2 scale, scaleFract, translate, translateFract;\n\n\t\tvarying vec4 fragColor;\n\n\t\tvoid main() {\n\t\t\tfragColor = color / 255.;\n\n\t\t\tvec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset;\n\n\t\t\tvec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw;\n\n\t\t\tvec2 position = position + dxy;\n\n\t\t\tvec2 pos = (position + translate) * scale\n\t\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t\t+ (position + translate) * scaleFract\n\t\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n\t\t\tpos += pixelOffset / viewport.zw;\n\n\t\t\tgl_Position = vec4(pos * 2. - 1., 0, 1);\n\t\t}\n\t\t",frag:"\n\t\tprecision mediump float;\n\n\t\tvarying vec4 fragColor;\n\n\t\tuniform float opacity;\n\n\t\tvoid main() {\n\t\t\tgl_FragColor = fragColor;\n\t\t\tgl_FragColor.a *= opacity;\n\t\t}\n\t\t",uniforms:{range:t.prop("range"),lineWidth:t.prop("lineWidth"),capSize:t.prop("capSize"),opacity:t.prop("opacity"),scale:t.prop("scale"),translate:t.prop("translate"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{color:{buffer:d,offset:function(t,e){return 4*e.offset},divisor:1},position:{buffer:c,offset:function(t,e){return 8*e.offset},divisor:1},positionFract:{buffer:p,offset:function(t,e){return 8*e.offset},divisor:1},error:{buffer:g,offset:function(t,e){return 16*e.offset},divisor:1},direction:{buffer:m,stride:24,offset:0},lineOffset:{buffer:m,stride:24,offset:8},capOffset:{buffer:m,stride:24,offset:16}},primitive:"triangles",blend:{enable:!0,color:[0,0,0,0],equation:{rgb:"add",alpha:"add"},func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},depth:{enable:!1},scissor:{enable:!0,box:t.prop("viewport")},viewport:t.prop("viewport"),stencil:!1,instances:t.prop("count"),count:h.length}),s(b,{update:k,draw:_,destroy:M,regl:t,gl:v,canvas:v.canvas,groups:x}),b;function b(t){t?k(t):null===t&&M(),_()}function _(e){if("number"==typeof e)return w(e);e&&!Array.isArray(e)&&(e=[e]),t._refresh(),x.forEach(function(t,r){t&&(e&&(e[r]?t.draw=!0:t.draw=!1),t.draw?w(r):t.draw=!0)})}function w(t){"number"==typeof t&&(t=x[t]),null!=t&&t&&t.count&&t.color&&t.opacity&&t.positions&&t.positions.length>1&&(t.scaleRatio=[t.scale[0]*t.viewport.width,t.scale[1]*t.viewport.height],r(t),t.after&&t.after(t))}function k(t){if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var e=0,r=0;if(b.groups=x=t.map(function(t,c){var u=x[c];return t?("function"==typeof t?t={after:t}:"number"==typeof t[0]&&(t={positions:t}),t=o(t,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"}),u||(x[c]=u={id:c,scale:null,translate:null,scaleFract:null,translateFract:null,draw:!0},t=s({},y,t)),a(u,t,[{lineWidth:function(t){return.5*+t},capSize:function(t){return.5*+t},opacity:parseFloat,errors:function(t){return t=l(t),r+=t.length,t},positions:function(t,r){return t=l(t,"float64"),r.count=Math.floor(t.length/2),r.bounds=n(t,2),r.offset=e,e+=r.count,t}},{color:function(t,e){var r=e.count;if(t||(t="transparent"),!Array.isArray(t)||"number"==typeof t[0]){var n=t;t=Array(r);for(var a=0;a 0. && baClipping < length(normalWidth * endBotJoin)) {\n\t\t//handle miter clipping\n\t\tbTopCoord -= normalWidth * endTopJoin;\n\t\tbTopCoord += normalize(endTopJoin * normalWidth) * baClipping;\n\t}\n\n\tif (nextReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);\n\t\tbBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\tbTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {\n\t\t//handle miter clipping\n\t\taBotCoord -= normalWidth * startBotJoin;\n\t\taBotCoord += normalize(startBotJoin * normalWidth) * abClipping;\n\t}\n\n\tvec2 aTopPosition = (aTopCoord) * scale + translate;\n\tvec2 aBotPosition = (aBotCoord) * scale + translate;\n\n\tvec2 bTopPosition = (bTopCoord) * scale + translate;\n\tvec2 bBotPosition = (bBotCoord) * scale + translate;\n\n\t//position is normalized 0..1 coord on the screen\n\tvec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;\n\n\tstartCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\tendCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tenableStartMiter = step(dot(currTangent, prevTangent), .5);\n\tenableEndMiter = step(dot(currTangent, nextTangent), .5);\n\n\t//bevel miter cutoffs\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n\n\t//round miter cutoffs\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\nuniform float dashSize, pixelRatio, thickness, opacity, id, miterMode;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nvoid main() {\n\tfloat alpha = 1., distToStart, distToEnd;\n\tfloat cutoff = thickness * .5;\n\n\t//bevel miter\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToStart + 1., 0.), 1.);\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToEnd + 1., 0.), 1.);\n\t\t}\n\t}\n\n\t// round miter\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - startCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - endCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\t}\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashSize) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]),attributes:{lineEnd:{buffer:r,divisor:0,stride:8,offset:0},lineTop:{buffer:r,divisor:0,stride:8,offset:4},aColor:{buffer:t.prop("colorBuffer"),stride:4,offset:0,divisor:1},bColor:{buffer:t.prop("colorBuffer"),stride:4,offset:4,divisor:1},prevCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:0,divisor:1},aCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:16,divisor:1},nextCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:24,divisor:1}}},n))}catch(t){e=i}return{fill:t({primitive:"triangle",elements:function(t,e){return e.triangles},offset:0,vert:o(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\n\nuniform vec4 color;\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio, id;\nuniform vec4 viewport;\nuniform float opacity;\n\nvarying vec4 fragColor;\n\nconst float MAX_LINES = 256.;\n\nvoid main() {\n\tfloat depth = (MAX_LINES - 4. - id) / (MAX_LINES);\n\n\tvec2 position = position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n\tfragColor.a *= opacity;\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n\tgl_FragColor = fragColor;\n}\n"]),uniforms:{scale:t.prop("scale"),color:t.prop("fill"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),translate:t.prop("translate"),opacity:t.prop("opacity"),pixelRatio:t.context("pixelRatio"),id:t.prop("id"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{position:{buffer:t.prop("positionBuffer"),stride:8,offset:8},positionFract:{buffer:t.prop("positionFractBuffer"),stride:8,offset:8}},blend:n.blend,depth:{enable:!1},scissor:n.scissor,stencil:n.stencil,viewport:n.viewport}),rect:i,miter:e}},m.defaults={dashes:null,join:"miter",miterLimit:1,thickness:10,cap:"square",color:"black",opacity:1,overlay:!1,viewport:null,range:null,close:!1,fill:null},m.prototype.render=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];e.length&&(t=this).update.apply(t,e),this.draw()},m.prototype.draw=function(){for(var t=this,e=[],r=arguments.length;r--;)e[r]=arguments[r];return(e.length?e:this.passes).forEach(function(e,r){if(e&&Array.isArray(e))return(n=t).draw.apply(n,e);var n;("number"==typeof e&&(e=t.passes[e]),e&&e.count>1&&e.opacity)&&(t.regl._refresh(),e.fill&&e.triangles&&e.triangles.length>2&&t.shaders.fill(e),e.thickness&&(e.scale[0]*e.viewport.width>m.precisionThreshold||e.scale[1]*e.viewport.height>m.precisionThreshold?t.shaders.rect(e):"rect"===e.join||!e.join&&(e.thickness<=2||e.count>=m.maxPoints)?t.shaders.rect(e):t.shaders.miter(e)))}),this},m.prototype.update=function(t){var e=this;if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var r=this.regl,o=this.gl;if(t.forEach(function(t,f){var d=e.passes[f];if(void 0!==t)if(null!==t){if("number"==typeof t[0]&&(t={positions:t}),t=s(t,{positions:"positions points data coords",thickness:"thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth",join:"lineJoin linejoin join type mode",miterLimit:"miterlimit miterLimit",dashes:"dash dashes dasharray dash-array dashArray",color:"color colour stroke colors colours stroke-color strokeColor",fill:"fill fill-color fillColor",opacity:"alpha opacity",overlay:"overlay crease overlap intersect",close:"closed close closed-path closePath",range:"range dataBox",viewport:"viewport viewBox",hole:"holes hole hollow"}),d||(e.passes[f]=d={id:f,scale:null,scaleFract:null,translate:null,translateFract:null,count:0,hole:[],depth:0,dashLength:1,dashTexture:r.texture({channels:1,data:new Uint8Array([255]),width:1,height:1,mag:"linear",min:"linear"}),colorBuffer:r.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array}),positionBuffer:r.buffer({usage:"dynamic",type:"float",data:new Uint8Array}),positionFractBuffer:r.buffer({usage:"dynamic",type:"float",data:new Uint8Array})},t=a({},m.defaults,t)),null!=t.thickness&&(d.thickness=parseFloat(t.thickness)),null!=t.opacity&&(d.opacity=parseFloat(t.opacity)),null!=t.miterLimit&&(d.miterLimit=parseFloat(t.miterLimit)),null!=t.overlay&&(d.overlay=!!t.overlay,f 1.0 + delta) {\n\t\tdiscard;\n\t}\n\n\talpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);\n\n\tfloat borderRadius = fragBorderRadius;\n\tfloat ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);\n\tvec4 color = mix(fragColor, fragBorderColor, ratio);\n\tcolor.a *= alpha * opacity;\n\tgl_FragColor = color;\n}\n"]),u.vert=l(["precision highp float;\n#define GLSLIFY 1\n\nattribute float x, y, xFract, yFract;\nattribute float size, borderSize;\nattribute vec4 colorId, borderColorId;\nattribute float isActive;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\nuniform sampler2D palette;\nuniform vec2 paletteSize;\n\nconst float maxSize = 100.;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragBorderRadius, fragWidth;\n\nvec2 paletteCoord(float id) {\n return vec2(\n (mod(id, paletteSize.x) + .5) / paletteSize.x,\n (floor(id / paletteSize.x) + .5) / paletteSize.y\n );\n}\nvec2 paletteCoord(vec2 id) {\n return vec2(\n (id.x + .5) / paletteSize.x,\n (id.y + .5) / paletteSize.y\n );\n}\n\nvec4 getColor(vec4 id) {\n // zero-palette means we deal with direct buffer\n if (paletteSize.x == 0.) return id / 255.;\n return texture2D(palette, paletteCoord(id.xy));\n}\n\nvoid main() {\n // ignore inactive points\n if (isActive == 0.) return;\n\n vec2 position = vec2(x, y);\n vec2 positionFract = vec2(xFract, yFract);\n\n vec4 color = getColor(colorId);\n vec4 borderColor = getColor(borderColorId);\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = (size + borderSize) * pixelRatio;\n\n vec2 pos = (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0, 1);\n\n fragBorderRadius = 1. - 2. * borderSize / (size + borderSize);\n fragColor = color;\n fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor;\n fragWidth = 1. / gl_PointSize;\n}\n"]),h&&(u.frag=u.frag.replace("smoothstep","smoothStep")),this.drawCircle=t(u)}e.exports=v,v.defaults={color:"black",borderColor:"transparent",borderSize:0,size:12,opacity:1,marker:void 0,viewport:null,range:null,pixelSize:null,count:0,offset:0,bounds:null,positions:[],snap:1e4},v.prototype.render=function(){for(var t,e=[],r=arguments.length;r--;)e[r]=arguments[r];return e.length&&(t=this).update.apply(t,e),this.draw(),this},v.prototype.draw=function(){for(var t=this,e=[],r=arguments.length;r--;)e[r]=arguments[r];var n=this.groups;if(1===e.length&&Array.isArray(e[0])&&(null===e[0][0]||Array.isArray(e[0][0]))&&(e=e[0]),this.regl._refresh(),e.length)for(var i=0;in)?e.tree=o(t,{bounds:h}):n&&n.length&&(e.tree=n),e.tree){var p={primitive:"points",usage:"static",data:e.tree,type:"uint32"};e.elements?e.elements(p):e.elements=l.elements(p)}return a({data:d(t),usage:"dynamic"}),s({data:g(t),usage:"dynamic"}),c({data:new Uint8Array(u),type:"uint8",usage:"stream"}),t}},{marker:function(e,r,n){var i=r.activation;if(i.forEach(function(t){return t&&t.destroy&&t.destroy()}),i.length=0,e&&"number"!=typeof e[0]){for(var a=[],o=0,s=Math.min(e.length,r.count);o=0)return a;if(t instanceof Uint8Array||t instanceof Uint8ClampedArray)e=t;else{e=new Uint8Array(t.length);for(var o=0,s=t.length;oi*i*4&&(this.tooManyColors=!0),this.updatePalette(r),1===o.length?o[0]:o},v.prototype.updatePalette=function(t){if(!this.tooManyColors){var e=this.maxColors,r=this.paletteTexture,n=Math.ceil(.25*t.length/e);if(n>1)for(var i=.25*(t=t.slice()).length%e;i2?(s[0],s[2],n=s[1],i=s[3]):s.length?(n=s[0],i=s[1]):(s.x,n=s.y,s.x+s.width,i=s.y+s.height),l.length>2?(a=l[0],o=l[2],l[1],l[3]):l.length?(a=l[0],o=l[1]):(a=l.x,l.y,o=l.x+l.width,l.y+l.height),[a,n,o,i]}function p(t){if("number"==typeof t)return[t,t,t,t];if(2===t.length)return[t[0],t[1],t[0],t[1]];var e=l(t);return[e.x,e.y,e.x+e.width,e.y+e.height]}e.exports=u,u.prototype.render=function(){for(var t,e=this,r=[],n=arguments.length;n--;)r[n]=arguments[n];return r.length&&(t=this).update.apply(t,r),this.regl.attributes.preserveDrawingBuffer?this.draw():(this.dirty?null==this.planned&&(this.planned=o(function(){e.draw(),e.dirty=!0,e.planned=null})):(this.draw(),this.dirty=!0,o(function(){e.dirty=!1})),this)},u.prototype.update=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];if(t.length){for(var r=0;rM))&&(s.lower||!(k>>=e))<<3,(e|=r=(15<(t>>>=r))<<2)|(r=(3<(t>>>=r))<<1)|t>>>r>>1}function l(t){t:{for(var e=16;268435456>=e;e*=16)if(t<=e){t=e;break t}t=0}return 0<(e=Y[s(t)>>2]).length?e.pop():new ArrayBuffer(t)}function c(t){Y[s(t.byteLength)>>2].push(t)}function u(t,e,r,n,i,a){for(var o=0;o(i=l)&&(i=n.buffer.byteLength,5123===f?i>>=1:5125===f&&(i>>=2)),n.vertCount=i,i=s,0>s&&(i=4,1===(s=n.buffer.dimension)&&(i=0),2===s&&(i=1),3===s&&(i=4)),n.primType=i}function s(t){n.elementsCount--,delete l[t.id],t.buffer.destroy(),t.buffer=null}var l={},c=0,u={uint8:5121,uint16:5123};e.oes_element_index_uint&&(u.uint32=5125),i.prototype.bind=function(){this.buffer.bind()};var f=[];return{create:function(t,e){function l(t){if(t)if("number"==typeof t)c(t),f.primType=4,f.vertCount=0|t,f.type=5121;else{var e=null,r=35044,n=-1,i=-1,s=0,h=0;Array.isArray(t)||G(t)||a(t)?e=t:("data"in t&&(e=t.data),"usage"in t&&(r=Q[t.usage]),"primitive"in t&&(n=rt[t.primitive]),"count"in t&&(i=0|t.count),"type"in t&&(h=u[t.type]),"length"in t?s=0|t.length:(s=i,5123===h||5122===h?s*=2:5125!==h&&5124!==h||(s*=4))),o(f,e,r,n,i,s,h)}else c(),f.primType=4,f.vertCount=0,f.type=5121;return l}var c=r.create(null,34963,!0),f=new i(c._buffer);return n.elementsCount++,l(t),l._reglType="elements",l._elements=f,l.subdata=function(t,e){return c.subdata(t,e),l},l.destroy=function(){s(f)},l},createStream:function(t){var e=f.pop();return e||(e=new i(r.create(null,34963,!0,!1)._buffer)),o(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){f.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof i?t._elements:null},clear:function(){W(l).forEach(s)}}}function m(t){for(var e=X.allocType(5123,t.length),r=0;r>>31<<15,i=(a<<1>>>24)-127,a=a>>13&1023;e[r]=-24>i?n:-14>i?n+(a+1024>>-14-i):15>=i,r.height>>=i,p(r,n[i]),t.mipmask|=1<e;++e)t.images[e]=null;return t}function E(t){for(var e=t.images,r=0;re){for(var r=0;r=--this.refCount&&R(this)}}),s.profile&&(o.getTotalTextureSize=function(){var t=0;return Object.keys(ft).forEach(function(e){t+=ft[e].stats.size}),t}),{create2D:function(e,r){function n(t,e){var r=i.texInfo;L.call(r);var a=C();return"number"==typeof t?A(a,0|t,"number"==typeof e?0|e:0|t):t?(z(r,t),T(a,t)):A(a,1,1),r.genMipmaps&&(a.mipmask=(a.width<<1)-1),i.mipmask=a.mipmask,c(i,a),i.internalformat=a.internalformat,n.width=a.width,n.height=a.height,O(i),S(a,3553),P(r,3553),I(),E(a),s.profile&&(i.stats.size=k(i.internalformat,i.type,a.width,a.height,r.genMipmaps,!1)),n.format=$[i.internalformat],n.type=tt[i.type],n.mag=et[r.magFilter],n.min=rt[r.minFilter],n.wrapS=nt[r.wrapS],n.wrapT=nt[r.wrapT],n}var i=new D(3553);return ft[i.id]=i,o.textureCount++,n(e,r),n.subimage=function(t,e,r,a){e|=0,r|=0,a|=0;var o=g();return c(o,i),o.width=0,o.height=0,p(o,t),o.width=o.width||(i.width>>a)-e,o.height=o.height||(i.height>>a)-r,O(i),d(o,3553,e,r,a),I(),M(o),n},n.resize=function(e,r){var a=0|e,o=0|r||a;if(a===i.width&&o===i.height)return n;n.width=i.width=a,n.height=i.height=o,O(i);for(var l=0;i.mipmask>>l;++l)t.texImage2D(3553,l,i.format,a>>l,o>>l,0,i.format,i.type,null);return I(),s.profile&&(i.stats.size=k(i.internalformat,i.type,a,o,!1,!1)),n},n._reglType="texture2d",n._texture=i,s.profile&&(n.stats=i.stats),n.destroy=function(){i.decRef()},n},createCube:function(e,r,n,i,a,l){function f(t,e,r,n,i,a){var o,l=h.texInfo;for(L.call(l),o=0;6>o;++o)m[o]=C();if("number"!=typeof t&&t){if("object"==typeof t)if(e)T(m[0],t),T(m[1],e),T(m[2],r),T(m[3],n),T(m[4],i),T(m[5],a);else if(z(l,t),u(h,t),"faces"in t)for(t=t.faces,o=0;6>o;++o)c(m[o],h),T(m[o],t[o]);else for(o=0;6>o;++o)T(m[o],t)}else for(t=0|t||1,o=0;6>o;++o)A(m[o],t,t);for(c(h,m[0]),h.mipmask=l.genMipmaps?(m[0].width<<1)-1:m[0].mipmask,h.internalformat=m[0].internalformat,f.width=m[0].width,f.height=m[0].height,O(h),o=0;6>o;++o)S(m[o],34069+o);for(P(l,34067),I(),s.profile&&(h.stats.size=k(h.internalformat,h.type,f.width,f.height,l.genMipmaps,!0)),f.format=$[h.internalformat],f.type=tt[h.type],f.mag=et[l.magFilter],f.min=rt[l.minFilter],f.wrapS=nt[l.wrapS],f.wrapT=nt[l.wrapT],o=0;6>o;++o)E(m[o]);return f}var h=new D(34067);ft[h.id]=h,o.cubeCount++;var m=Array(6);return f(e,r,n,i,a,l),f.subimage=function(t,e,r,n,i){r|=0,n|=0,i|=0;var a=g();return c(a,h),a.width=0,a.height=0,p(a,e),a.width=a.width||(h.width>>i)-r,a.height=a.height||(h.height>>i)-n,O(h),d(a,34069+t,r,n,i),I(),M(a),f},f.resize=function(e){if((e|=0)!==h.width){f.width=h.width=e,f.height=h.height=e,O(h);for(var r=0;6>r;++r)for(var n=0;h.mipmask>>n;++n)t.texImage2D(34069+r,n,h.format,e>>n,e>>n,0,h.format,h.type,null);return I(),s.profile&&(h.stats.size=k(h.internalformat,h.type,f.width,f.height,!1,!0)),f}},f._reglType="textureCube",f._texture=h,s.profile&&(f.stats=h.stats),f.destroy=function(){h.decRef()},f},clear:function(){for(var e=0;er;++r)if(0!=(e.mipmask&1<>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;6>n;++n)t.texImage2D(34069+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);P(e.texInfo,e.target)})}}}function A(t,e,r,n,i,a){function o(t,e,r){this.target=t,this.texture=e,this.renderbuffer=r;var n=t=0;e?(t=e.width,n=e.height):r&&(t=r.width,n=r.height),this.width=t,this.height=n}function s(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function l(t,e,r){t&&(t.texture?t.texture._texture.refCount+=1:t.renderbuffer._renderbuffer.refCount+=1)}function c(e,r){r&&(r.texture?t.framebufferTexture2D(36160,e,r.target,r.texture._texture.texture,0):t.framebufferRenderbuffer(36160,e,36161,r.renderbuffer._renderbuffer.renderbuffer))}function u(t){var e=3553,r=null,n=null,i=t;return"object"==typeof t&&(i=t.data,"target"in t&&(e=0|t.target)),"texture2d"===(t=i._reglType)?r=i:"textureCube"===t?r=i:"renderbuffer"===t&&(n=i,e=36161),new o(e,r,n)}function f(t,e,r,a,s){return r?((t=n.create2D({width:t,height:e,format:a,type:s}))._texture.refCount=0,new o(3553,t,null)):((t=i.create({width:t,height:e,format:a}))._renderbuffer.refCount=0,new o(36161,null,t))}function h(t){return t&&(t.texture||t.renderbuffer)}function p(t,e,r){t&&(t.texture?t.texture.resize(e,r):t.renderbuffer&&t.renderbuffer.resize(e,r))}function d(){this.id=k++,M[this.id]=this,this.framebuffer=t.createFramebuffer(),this.height=this.width=0,this.colorAttachments=[],this.depthStencilAttachment=this.stencilAttachment=this.depthAttachment=null}function g(t){t.colorAttachments.forEach(s),s(t.depthAttachment),s(t.stencilAttachment),s(t.depthStencilAttachment)}function m(e){t.deleteFramebuffer(e.framebuffer),e.framebuffer=null,a.framebufferCount--,delete M[e.id]}function v(e){var n;t.bindFramebuffer(36160,e.framebuffer);var i=e.colorAttachments;for(n=0;ni;++i){for(c=0;ct;++t)r[t].resize(n);return e.width=e.height=n,e},_reglType:"framebufferCube",destroy:function(){r.forEach(function(t){t.destroy()})}})},clear:function(){W(M).forEach(m)},restore:function(){W(M).forEach(function(e){e.framebuffer=t.createFramebuffer(),v(e)})}})}function T(){this.w=this.z=this.y=this.x=this.state=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.divisor=this.stride=this.offset=0}function S(t,e,r,n){function i(t,e,r,n){this.name=t,this.id=e,this.location=r,this.info=n}function a(t,e){for(var r=0;rt&&(t=e.stats.uniformsCount)}),t},r.getMaxAttributesCount=function(){var t=0;return h.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)}),t}),{clear:function(){var e=t.deleteShader.bind(t);W(c).forEach(e),c={},W(u).forEach(e),u={},h.forEach(function(e){t.deleteProgram(e.program)}),h.length=0,f={},r.shaderCount=0},program:function(t,e,n){var i=f[e];i||(i=f[e]={});var a=i[t];return a||(a=new s(e,t),r.shaderCount++,l(a),i[t]=a,h.push(a)),a},restore:function(){c={},u={};for(var t=0;t="+e+"?"+i+".constant["+e+"]:0;"}).join(""),"}}else{","if(",o,"(",i,".buffer)){",u,"=",s,".createStream(",34962,",",i,".buffer);","}else{",u,"=",s,".getBuffer(",i,".buffer);","}",f,'="type" in ',i,"?",a.glTypes,"[",i,".type]:",u,".dtype;",l.normalized,"=!!",i,".normalized;"),n("size"),n("offset"),n("stride"),n("divisor"),r("}}"),r.exit("if(",l.isStream,"){",s,".destroyStream(",u,");","}"),l})}),o}function A(t,e,r,n,i){var a=_(t),s=function(t,e,r){function n(t){if(t in i){var r=i[t];t=!0;var n,o,s=0|r.x,l=0|r.y;return"width"in r?n=0|r.width:t=!1,"height"in r?o=0|r.height:t=!1,new O(!t&&e&&e.thisDep,!t&&e&&e.contextDep,!t&&e&&e.propDep,function(t,e){var i=t.shared.context,a=n;"width"in r||(a=e.def(i,".","framebufferWidth","-",s));var c=o;return"height"in r||(c=e.def(i,".","framebufferHeight","-",l)),[s,l,a,c]})}if(t in a){var c=a[t];return t=B(c,function(t,e){var r=t.invoke(e,c),n=t.shared.context,i=e.def(r,".x|0"),a=e.def(r,".y|0");return[i,a,e.def('"width" in ',r,"?",r,".width|0:","(",n,".","framebufferWidth","-",i,")"),r=e.def('"height" in ',r,"?",r,".height|0:","(",n,".","framebufferHeight","-",a,")")]}),e&&(t.thisDep=t.thisDep||e.thisDep,t.contextDep=t.contextDep||e.contextDep,t.propDep=t.propDep||e.propDep),t}return e?new O(e.thisDep,e.contextDep,e.propDep,function(t,e){var r=t.shared.context;return[0,0,e.def(r,".","framebufferWidth"),e.def(r,".","framebufferHeight")]}):null}var i=t.static,a=t.dynamic;if(t=n("viewport")){var o=t;t=new O(t.thisDep,t.contextDep,t.propDep,function(t,e){var r=o.append(t,e),n=t.shared.context;return e.set(n,".viewportWidth",r[2]),e.set(n,".viewportHeight",r[3]),r})}return{viewport:t,scissor_box:n("scissor.box")}}(t,a),l=k(t),c=function(t,e){var r=t.static,n=t.dynamic,i={};return nt.forEach(function(t){function e(e,o){if(t in r){var s=e(r[t]);i[a]=R(function(){return s})}else if(t in n){var l=n[t];i[a]=B(l,function(t,e){return o(t,e,t.invoke(e,l))})}}var a=m(t);switch(t){case"cull.enable":case"blend.enable":case"dither":case"stencil.enable":case"depth.enable":case"scissor.enable":case"polygonOffset.enable":case"sample.alpha":case"sample.enable":case"depth.mask":return e(function(t){return t},function(t,e,r){return r});case"depth.func":return e(function(t){return yt[t]},function(t,e,r){return e.def(t.constants.compareFuncs,"[",r,"]")});case"depth.range":return e(function(t){return t},function(t,e,r){return[e.def("+",r,"[0]"),e=e.def("+",r,"[1]")]});case"blend.func":return e(function(t){return[vt["srcRGB"in t?t.srcRGB:t.src],vt["dstRGB"in t?t.dstRGB:t.dst],vt["srcAlpha"in t?t.srcAlpha:t.src],vt["dstAlpha"in t?t.dstAlpha:t.dst]]},function(t,e,r){function n(t,n){return e.def('"',t,n,'" in ',r,"?",r,".",t,n,":",r,".",t)}t=t.constants.blendFuncs;var i=n("src","RGB"),a=n("dst","RGB"),o=(i=e.def(t,"[",i,"]"),e.def(t,"[",n("src","Alpha"),"]"));return[i,a=e.def(t,"[",a,"]"),o,t=e.def(t,"[",n("dst","Alpha"),"]")]});case"blend.equation":return e(function(t){return"string"==typeof t?[J[t],J[t]]:"object"==typeof t?[J[t.rgb],J[t.alpha]]:void 0},function(t,e,r){var n=t.constants.blendEquations,i=e.def(),a=e.def();return(t=t.cond("typeof ",r,'==="string"')).then(i,"=",a,"=",n,"[",r,"];"),t.else(i,"=",n,"[",r,".rgb];",a,"=",n,"[",r,".alpha];"),e(t),[i,a]});case"blend.color":return e(function(t){return o(4,function(e){return+t[e]})},function(t,e,r){return o(4,function(t){return e.def("+",r,"[",t,"]")})});case"stencil.mask":return e(function(t){return 0|t},function(t,e,r){return e.def(r,"|0")});case"stencil.func":return e(function(t){return[yt[t.cmp||"keep"],t.ref||0,"mask"in t?t.mask:-1]},function(t,e,r){return[t=e.def('"cmp" in ',r,"?",t.constants.compareFuncs,"[",r,".cmp]",":",7680),e.def(r,".ref|0"),e=e.def('"mask" in ',r,"?",r,".mask|0:-1")]});case"stencil.opFront":case"stencil.opBack":return e(function(e){return["stencil.opBack"===t?1029:1028,xt[e.fail||"keep"],xt[e.zfail||"keep"],xt[e.zpass||"keep"]]},function(e,r,n){function i(t){return r.def('"',t,'" in ',n,"?",a,"[",n,".",t,"]:",7680)}var a=e.constants.stencilOps;return["stencil.opBack"===t?1029:1028,i("fail"),i("zfail"),i("zpass")]});case"polygonOffset.offset":return e(function(t){return[0|t.factor,0|t.units]},function(t,e,r){return[e.def(r,".factor|0"),e=e.def(r,".units|0")]});case"cull.face":return e(function(t){var e=0;return"front"===t?e=1028:"back"===t&&(e=1029),e},function(t,e,r){return e.def(r,'==="front"?',1028,":",1029)});case"lineWidth":return e(function(t){return t},function(t,e,r){return r});case"frontFace":return e(function(t){return bt[t]},function(t,e,r){return e.def(r+'==="cw"?2304:2305')});case"colorMask":return e(function(t){return t.map(function(t){return!!t})},function(t,e,r){return o(4,function(t){return"!!"+r+"["+t+"]"})});case"sample.coverage":return e(function(t){return["value"in t?t.value:1,!!t.invert]},function(t,e,r){return[e.def('"value" in ',r,"?+",r,".value:1"),e=e.def("!!",r,".invert")]})}}),i}(t),u=w(t),f=s.viewport;return f&&(c.viewport=f),(s=s[f=m("scissor.box")])&&(c[f]=s),(a={framebuffer:a,draw:l,shader:u,state:c,dirty:s=0>1)",s],");")}function e(){r(l,".drawArraysInstancedANGLE(",[d,g,m,s],");")}p?y?t():(r("if(",p,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(u+".drawElements("+[d,m,v,g+"<<(("+v+"-5121)>>1)"]+");")}function e(){r(u+".drawArrays("+[d,g,m]+");")}p?y?t():(r("if(",p,"){"),t(),r("}else{"),e(),r("}")):e()}var s,l,c=t.shared,u=c.gl,f=c.draw,h=n.draw,p=function(){var i=h.elements,a=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(a=r),i=i.append(t,a)):i=a.def(f,".","elements"),i&&a("if("+i+")"+u+".bindBuffer(34963,"+i+".buffer.buffer);"),i}(),d=i("primitive"),g=i("offset"),m=function(){var i=h.count,a=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(a=r),i=i.append(t,a)):i=a.def(f,".","count"),i}();if("number"==typeof m){if(0===m)return}else r("if(",m,"){"),r.exit("}");Q&&(s=i("instances"),l=t.instancing);var v=p+".type",y=h.elements&&I(h.elements);Q&&("number"!=typeof s||0<=s)?"string"==typeof s?(r("if(",s,">0){"),a(),r("}else if(",s,"<0){"),o(),r("}")):a():o()}function q(t,e,r,n,i){return i=(e=b()).proc("body",i),Q&&(e.instancing=i.def(e.shared.extensions,".angle_instanced_arrays")),t(e,i,r,n),e.compile().body}function H(t,e,r,n){L(t,e),N(t,e,r,n.attributes,function(){return!0}),j(t,e,r,n.uniforms,function(){return!0}),V(t,e,e,r)}function G(t,e,r,n){function i(){return!0}t.batchId="a1",L(t,e),N(t,e,r,n.attributes,i),j(t,e,r,n.uniforms,i),V(t,e,e,r)}function W(t,e,r,n){function i(t){return t.contextDep&&o||t.propDep}function a(t){return!i(t)}L(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var c=t.scope(),u=t.scope();e(c.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",u,"}",c.exit),r.needsContext&&T(t,u,r.context),r.needsFramebuffer&&S(t,u,r.framebuffer),E(t,u,r.state,i),r.profile&&i(r.profile)&&F(t,u,r,!1,!0),n?(N(t,c,r,n.attributes,a),N(t,u,r,n.attributes,i),j(t,c,r,n.uniforms,a),j(t,u,r,n.uniforms,i),V(t,c,u,r)):(e=t.global.def("{}"),n=r.shader.progVar.append(t,u),l=u.def(n,".id"),c=u.def(e,"[",l,"]"),u(t.shared.gl,".useProgram(",n,".program);","if(!",c,"){",c,"=",e,"[",l,"]=",t.link(function(e){return q(G,t,r,e,2)}),"(",n,");}",c,".call(this,a0[",s,"],",s,");"))}function Y(t,r){function n(e){var n=r.shader[e];n&&i.set(a.shader,"."+e,n.append(t,i))}var i=t.proc("scope",3);t.batchId="a2";var a=t.shared,o=a.current;T(t,i,r.context),r.framebuffer&&r.framebuffer.append(t,i),D(Object.keys(r.state)).forEach(function(e){var n=r.state[e].append(t,i);v(n)?n.forEach(function(r,n){i.set(t.next[e],"["+n+"]",r)}):i.set(a.next,"."+e,n)}),F(t,i,r,!0,!0),["elements","offset","count","instances","primitive"].forEach(function(e){var n=r.draw[e];n&&i.set(a.draw,"."+e,""+n.append(t,i))}),Object.keys(r.uniforms).forEach(function(n){i.set(a.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,i))}),Object.keys(r.attributes).forEach(function(e){var n=r.attributes[e].append(t,i),a=t.scopeAttrib(e);Object.keys(new Z).forEach(function(t){i.set(a,"."+t,n[t])})}),n("vert"),n("frag"),0=--this.refCount&&o(this)},i.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(u).forEach(function(e){t+=u[e].stats.size}),t}),{create:function(e,r){function o(e,r){var n=0,a=0,u=32854;if("object"==typeof e&&e?("shape"in e?(n=0|(a=e.shape)[0],a=0|a[1]):("radius"in e&&(n=a=0|e.radius),"width"in e&&(n=0|e.width),"height"in e&&(a=0|e.height)),"format"in e&&(u=s[e.format])):"number"==typeof e?(n=0|e,a="number"==typeof r?0|r:n):e||(n=a=1),n!==c.width||a!==c.height||u!==c.format)return o.width=c.width=n,o.height=c.height=a,c.format=u,t.bindRenderbuffer(36161,c.renderbuffer),t.renderbufferStorage(36161,u,n,a),i.profile&&(c.stats.size=ft[c.format]*c.width*c.height),o.format=l[c.format],o}var c=new a(t.createRenderbuffer());return u[c.id]=c,n.renderbufferCount++,o(e,r),o.resize=function(e,r){var n=0|e,a=0|r||n;return n===c.width&&a===c.height?o:(o.width=c.width=n,o.height=c.height=a,t.bindRenderbuffer(36161,c.renderbuffer),t.renderbufferStorage(36161,c.format,n,a),i.profile&&(c.stats.size=ft[c.format]*c.width*c.height),o)},o._reglType="renderbuffer",o._renderbuffer=c,i.profile&&(o.stats=c.stats),o.destroy=function(){c.decRef()},o},clear:function(){W(u).forEach(o)},restore:function(){W(u).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,e.renderbuffer),t.renderbufferStorage(36161,e.format,e.width,e.height)}),t.bindRenderbuffer(36161,null)}}},pt=[];pt[6408]=4;var dt=[];dt[5121]=1,dt[5126]=4,dt[36193]=2;var gt=["x","y","z","w"],mt="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),vt={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},yt={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},xt={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},bt={cw:2304,ccw:2305},_t=new O(!1,!1,!1,function(){});return function(t){function e(){if(0===X.length)w&&w.update(),Q=null;else{Q=q.next(e),f();for(var t=X.length-1;0<=t;--t){var r=X[t];r&&r(z,null,0)}m.flush(),w&&w.update()}}function r(){!Q&&0=X.length&&n()}}}}function u(){var t=W.viewport,e=W.scissor_box;t[0]=t[1]=e[0]=e[1]=0,z.viewportWidth=z.framebufferWidth=z.drawingBufferWidth=t[2]=e[2]=m.drawingBufferWidth,z.viewportHeight=z.framebufferHeight=z.drawingBufferHeight=t[3]=e[3]=m.drawingBufferHeight}function f(){z.tick+=1,z.time=p(),u(),G.procs.poll()}function h(){u(),G.procs.refresh(),w&&w.update()}function p(){return(H()-k)/1e3}if(!(t=i(t)))return null;var m=t.gl,v=m.getContextAttributes();m.isContextLost();var y=function(t,e){function r(e){var r;e=e.toLowerCase();try{r=n[e]=t.getExtension(e)}catch(t){}return!!r}for(var n={},i=0;ie;++e)$(j({framebuffer:t.framebuffer.faces[e]},t),l);else $(t,l);else l(0,t)},prop:U.define.bind(null,1),context:U.define.bind(null,2),this:U.define.bind(null,3),draw:s({}),buffer:function(t){return D.create(t,34962,!1,!1)},elements:function(t){return O.create(t,!1)},texture:R.create2D,cube:R.createCube,renderbuffer:B.create,framebuffer:V.create,framebufferCube:V.createCube,attributes:v,frame:c,on:function(t,e){var r;switch(t){case"frame":return c(e);case"lost":r=Z;break;case"restore":r=J;break;case"destroy":r=K}return r.push(e),{cancel:function(){for(var t=0;t=r)return i.substr(0,r);for(;r>i.length&&e>1;)1&e&&(i+=t),e>>=1,t+=t;return i=(i+=t).substr(0,r)}},{}],440:[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:{})},{}],441:[function(t,e,r){"use strict";e.exports=function(t){for(var e=t.length,r=t[t.length-1],n=e,i=e-2;i>=0;--i){var a=r,o=t[i],s=(r=a+o)-a,l=o-s;l&&(t[--n]=r,r=l)}for(var c=0,i=n;i>1;return["sum(",t(e.slice(0,r)),",",t(e.slice(r)),")"].join("")}(e);var n}function u(t){return new Function("sum","scale","prod","compress",["function robustDeterminant",t,"(m){return compress(",c(function(t){for(var e=new Array(t),r=0;r>1;return["sum(",c(t.slice(0,e)),",",c(t.slice(e)),")"].join("")}function u(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 u(e,t)}function f(t){if(2===t.length)return[["diff(",u(t[0][0],t[1][1]),",",u(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0&&r.push(","),r.push("[");for(var o=0;o0&&r.push(","),o===i?r.push("+b[",a,"]"):r.push("+A[",a,"][",o,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var s=new Function("det",r.join(""));return s(t<6?n[t]:n)}var o=[function(){return[0]},function(t,e){return[[e[0]],[t[0][0]]]}];!function(){for(;o.length>1;return["sum(",c(t.slice(0,e)),",",c(t.slice(e)),")"].join("")}function u(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;r0){if(a<=0)return o;n=i+a}else{if(!(i<0))return o;if(a>=0)return o;n=-(i+a)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o:h(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],a=e[0]-n[0],o=r[0]-n[0],s=t[1]-n[1],l=e[1]-n[1],c=r[1]-n[1],u=t[2]-n[2],f=e[2]-n[2],h=r[2]-n[2],d=a*c,g=o*l,m=o*s,v=i*c,y=i*l,x=a*s,b=u*(d-g)+f*(m-v)+h*(y-x),_=7.771561172376103e-16*((Math.abs(d)+Math.abs(g))*Math.abs(u)+(Math.abs(m)+Math.abs(v))*Math.abs(f)+(Math.abs(y)+Math.abs(x))*Math.abs(h));return b>_||-b>_?b:p(t,e,r,n)}];!function(){for(;d.length<=s;)d.push(f(d.length));for(var t=[],r=["slow"],n=0;n<=s;++n)t.push("a"+n),r.push("o"+n);var i=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(n=2;n<=s;++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;i0&&o>0||a<0&&o<0)return!1;var s=n(r,t,e),l=n(i,t,e);if(s>0&&l>0||s<0&&l<0)return!1;if(0===a&&0===o&&0===s&&0===l)return function(t,e,r,n){for(var i=0;i<2;++i){var a=t[i],o=e[i],s=Math.min(a,o),l=Math.max(a,o),c=r[i],u=n[i],f=Math.min(c,u),h=Math.max(c,u);if(h=n?(i=f,(l+=1)=n?(i=f,(l+=1)0?1:0}},{}],453:[function(t,e,r){"use strict";e.exports=function(t){return i(n(t))};var n=t("boundary-cells"),i=t("reduce-simplicial-complex")},{"boundary-cells":77,"reduce-simplicial-complex":431}],454:[function(t,e,r){"use strict";e.exports=function(t,e,r,s){r=r||0,void 0===s&&(s=function(t){for(var e=t.length,r=0,n=0;n>1,v=E[2*m+1];","if(v===b){return m}","if(b0&&l.push(","),l.push("[");for(var n=0;n0&&l.push(","),l.push("B(C,E,c[",i[0],"],c[",i[1],"])")}l.push("]")}l.push(");")}}for(var a=t+1;a>1;--a){a>1,s=a(t[o],e);s<=0?(0===s&&(i=o),r=o+1):s>0&&(n=o-1)}return i}function u(t,e){for(var r=new Array(t.length),i=0,o=r.length;i=t.length||0!==a(t[m],s)););}return r}function f(t,e){if(e<0)return[];for(var r=[],i=(1<>>u&1&&c.push(i[u]);e.push(c)}return s(e)},r.skeleton=f,r.boundary=function(t){for(var e=[],r=0,n=t.length;r>1:(t>>1)-1}function x(t){for(var e=v(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(n0;){var r=y(t);if(r>=0){var n=v(r);if(e0){var t=M[0];return m(0,S-1),S-=1,x(0),t}return-1}function w(t,e){var r=M[t];return c[r]===e?t:(c[r]=-1/0,b(t),_(),c[r]=e,b((S+=1)-1))}function k(t){if(!u[t]){u[t]=!0;var e=s[t],r=l[t];s[r]>=0&&(s[r]=e),l[e]>=0&&(l[e]=r),A[e]>=0&&w(A[e],g(e)),A[r]>=0&&w(A[r],g(r))}}for(var M=[],A=new Array(a),f=0;f>1;f>=0;--f)x(f);for(;;){var C=_();if(C<0||c[C]>r)break;k(C)}for(var E=[],f=0;f=0&&r>=0&&e!==r){var n=A[e],i=A[r];n!==i&&z.push([n,i])}}),i.unique(i.normalize(z)),{positions:E,edges:z}};var n=t("robust-orientation"),i=t("simplicial-complex")},{"robust-orientation":446,"simplicial-complex":458}],461:[function(t,e,r){"use strict";e.exports=function(t,e){var r,a,o,s;if(e[0][0]e[1][0]))return i(e,t);r=e[1],a=e[0]}if(t[0][0]t[1][0]))return-i(t,e);o=t[1],s=t[0]}var l=n(r,a,s),c=n(r,a,o);if(l<0){if(c<=0)return l}else if(l>0){if(c>=0)return l}else if(c)return c;if(l=n(s,o,a),c=n(s,o,r),l<0){if(c<=0)return l}else if(l>0){if(c>=0)return l}else if(c)return c;return a[0]-s[0]};var n=t("robust-orientation");function i(t,e){var r,i,a,o;if(e[0][0]e[1][0])){var s=Math.min(t[0][1],t[1][1]),l=Math.max(t[0][1],t[1][1]),c=Math.min(e[0][1],e[1][1]),u=Math.max(e[0][1],e[1][1]);return lu?s-u:l-u}r=e[1],i=e[0]}t[0][1]0)if(e[0]!==o[1][0])r=t,t=t.right;else{if(l=c(t.right,e))return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l;if(l=c(t.right,e))return l;t=t.left}}return r}function u(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function f(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}s.prototype.castUp=function(t){var e=n.le(this.coordinates,t[0]);if(e<0)return-1;this.slabs[e];var r=c(this.slabs[e],t),i=-1;if(r&&(i=r.value),this.coordinates[e]===t[0]){var s=null;if(r&&(s=r.key),e>0){var u=c(this.slabs[e-1],t);u&&(s?o(u.key,s)>0&&(s=u.key,i=u.value):(i=u.value,s=u.key))}var f=this.horizontal[e];if(f.length>0){var h=n.ge(f,t[1],l);if(h=f.length)return i;p=f[h]}}if(p.start)if(s){var d=a(s[0],s[1],[t[0],p.y]);s[0][0]>s[1][0]&&(d=-d),d>0&&(i=p.index)}else i=p.index;else p.y!==t[1]&&(i=p.index)}}}return i}},{"./lib/order-segments":461,"binary-search-bounds":73,"functional-red-black-tree":200,"robust-orientation":446}],463:[function(t,e,r){"use strict";var n=t("robust-dot-product"),i=t("robust-sum");function a(t,e){var r=i(n(t,e),[e[e.length-1]]);return r[r.length-1]}function o(t,e,r,n){var i=-e/(n-e);i<0?i=0:i>1&&(i=1);for(var a=1-i,o=t.length,s=new Array(o),l=0;l0||i>0&&u<0){var f=o(s,u,l,i);r.push(f),n.push(f.slice())}u<0?n.push(l.slice()):u>0?r.push(l.slice()):(r.push(l.slice()),n.push(l.slice())),i=u}return{positive:r,negative:n}},e.exports.positive=function(t,e){for(var r=[],n=a(t[t.length-1],e),i=t[t.length-1],s=t[0],l=0;l0||n>0&&c<0)&&r.push(o(i,c,s,n)),c>=0&&r.push(s.slice()),n=c}return r},e.exports.negative=function(t,e){for(var r=[],n=a(t[t.length-1],e),i=t[t.length-1],s=t[0],l=0;l0||n>0&&c<0)&&r.push(o(i,c,s,n)),c<=0&&r.push(s.slice()),n=c}return r}},{"robust-dot-product":443,"robust-sum":451}],464:[function(t,e,r){!function(){"use strict";var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};function e(r){return function(r,n){var i,a,o,s,l,c,u,f,h,p=1,d=r.length,g="";for(a=0;a=0),s[8]){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,s[6]?parseInt(s[6]):0);break;case"e":i=s[7]?parseFloat(i).toExponential(s[7]):parseFloat(i).toExponential();break;case"f":i=s[7]?parseFloat(i).toFixed(s[7]):parseFloat(i);break;case"g":i=s[7]?String(Number(i.toPrecision(s[7]))):parseFloat(i);break;case"o":i=(parseInt(i,10)>>>0).toString(8);break;case"s":i=String(i),i=s[7]?i.substring(0,s[7]):i;break;case"t":i=String(!!i),i=s[7]?i.substring(0,s[7]):i;break;case"T":i=Object.prototype.toString.call(i).slice(8,-1).toLowerCase(),i=s[7]?i.substring(0,s[7]):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=s[7]?i.substring(0,s[7]):i;break;case"x":i=(parseInt(i,10)>>>0).toString(16);break;case"X":i=(parseInt(i,10)>>>0).toString(16).toUpperCase()}t.json.test(s[8])?g+=i:(!t.number.test(s[8])||f&&!s[3]?h="":(h=f?"+":"-",i=i.toString().replace(t.sign,"")),c=s[4]?"0"===s[4]?"0":s[4].charAt(1):" ",u=s[6]-(h+i).length,l=s[6]&&u>0?c.repeat(u):"",g+=s[5]?h+i+l:"0"===c?h+l+i:l+h+i)}return g}(function(e){if(i[e])return i[e];var r,n=e,a=[],o=0;for(;n;){if(null!==(r=t.text.exec(n)))a.push(r[0]);else if(null!==(r=t.modulo.exec(n)))a.push("%");else{if(null===(r=t.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){o|=1;var s=[],l=r[2],c=[];if(null===(c=t.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(c[1]);""!==(l=l.substring(c[0].length));)if(null!==(c=t.key_access.exec(l)))s.push(c[1]);else{if(null===(c=t.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(c[1])}r[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");a.push(r)}n=n.substring(r[0].length)}return i[e]=a}(r),arguments)}function n(t,r){return e.apply(null,[t].concat(r||[]))}var i=Object.create(null);void 0!==r&&(r.sprintf=e,r.vsprintf=n),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=n)}()},{}],465:[function(t,e,r){"use strict";e.exports=function(t){for(var e=t.length,r=new Array(e),n=new Array(e),i=new Array(e),a=new Array(e),o=new Array(e),s=new Array(e),l=0;l0;){e=c[c.length-1];var p=t[e];if(a[e]=0&&s[e].push(o[g])}a[e]=d}else{if(n[e]===r[e]){for(var m=[],v=[],y=0,d=l.length-1;d>=0;--d){var x=l[d];if(i[x]=!1,m.push(x),v.push(s[x]),y+=s[x].length,o[x]=f.length,x===e){l.length=d;break}}f.push(m);for(var b=new Array(y),d=0;d c)|0 },"),"generic"===e&&a.push("getters:[0],");for(var s=[],l=[],c=0;c>>7){");for(var c=0;c<1<<(1<128&&c%128==0){f.length>0&&h.push("}}");var p="vExtra"+f.length;a.push("case ",c>>>7,":",p,"(m&0x7f,",l.join(),");break;"),h=["function ",p,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&c,":");for(var d=new Array(r),g=new Array(r),m=new Array(r),v=new Array(r),y=0,x=0;xx)&&!(c&1<<_)!=!(c&1<0&&(A="+"+m[b]+"*c");var T=d[b].length/y*.5,S=.5+v[b]/y*.5;M.push("d"+b+"-"+S+"-"+T+"*("+d[b].join("+")+A+")/("+g[b].join("+")+")")}h.push("a.push([",M.join(),"]);","break;")}a.push("}},"),f.length>0&&h.push("}}");for(var C=[],c=0;c<1<1&&(a=1),a<-1&&(a=-1),i*Math.acos(a)};r.default=function(t){var e=t.px,r=t.py,l=t.cx,c=t.cy,u=t.rx,f=t.ry,h=t.xAxisRotation,p=void 0===h?0:h,d=t.largeArcFlag,g=void 0===d?0:d,m=t.sweepFlag,v=void 0===m?0:m,y=[];if(0===u||0===f)return[];var x=Math.sin(p*i/360),b=Math.cos(p*i/360),_=b*(e-l)/2+x*(r-c)/2,w=-x*(e-l)/2+b*(r-c)/2;if(0===_&&0===w)return[];u=Math.abs(u),f=Math.abs(f);var k=Math.pow(_,2)/Math.pow(u,2)+Math.pow(w,2)/Math.pow(f,2);k>1&&(u*=Math.sqrt(k),f*=Math.sqrt(k));var M=function(t,e,r,n,a,o,l,c,u,f,h,p){var d=Math.pow(a,2),g=Math.pow(o,2),m=Math.pow(h,2),v=Math.pow(p,2),y=d*g-d*v-g*m;y<0&&(y=0),y/=d*v+g*m;var x=(y=Math.sqrt(y)*(l===c?-1:1))*a/o*p,b=y*-o/a*h,_=f*x-u*b+(t+r)/2,w=u*x+f*b+(e+n)/2,k=(h-x)/a,M=(p-b)/o,A=(-h-x)/a,T=(-p-b)/o,S=s(1,0,k,M),C=s(k,M,A,T);return 0===c&&C>0&&(C-=i),1===c&&C<0&&(C+=i),[_,w,S,C]}(e,r,l,c,u,f,g,v,x,b,_,w),A=n(M,4),T=A[0],S=A[1],C=A[2],E=A[3],L=Math.max(Math.ceil(Math.abs(E)/(i/4)),1);E/=L;for(var z=0;ze[2]&&(e[2]=c[u+0]),c[u+1]>e[3]&&(e[3]=c[u+1]);return e}},{"abs-svg-path":45,assert:53,"is-svg-path":367,"normalize-svg-path":470,"parse-svg-path":402}],470:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=[],o=0,s=0,l=0,c=0,u=null,f=null,h=0,p=0,d=0,g=t.length;d4?(o=m[m.length-4],s=m[m.length-3]):(o=h,s=p),r.push(m)}return r};var n=t("svg-arc-to-cubic-bezier");function i(t,e,r,n){return["C",t,e,r,n,r,n]}function a(t,e,r,n,i,a){return["C",t/3+2/3*r,e/3+2/3*n,i/3+2/3*r,a/3+2/3*n,i,a]}},{"svg-arc-to-cubic-bezier":468}],471:[function(t,e,r){(function(r){"use strict";var n=t("svg-path-bounds"),i=t("parse-svg-path"),a=t("draw-svg-path"),o=t("is-svg-path"),s=t("bitmap-sdf"),l=document.createElement("canvas"),c=l.getContext("2d");e.exports=function(t,e){if(!o(t))throw Error("Argument should be valid svg path string");e||(e={});var u,f;e.shape?(u=e.shape[0],f=e.shape[1]):(u=l.width=e.w||e.width||200,f=l.height=e.h||e.height||200);var h=Math.min(u,f),p=e.stroke||0,d=e.viewbox||e.viewBox||n(t),g=[u/(d[2]-d[0]),f/(d[3]-d[1])],m=Math.min(g[0]||0,g[1]||0)/2;c.fillStyle="black",c.fillRect(0,0,u,f),c.fillStyle="white",p&&("number"!=typeof p&&(p=1),c.strokeStyle=p>0?"white":"black",c.lineWidth=Math.abs(p));if(c.translate(.5*u,.5*f),c.scale(m,m),r.Path2D){var v=new Path2D(t);c.fill(v),p&&c.stroke(v)}else{var y=i(t);a(c,y),c.fill(),p&&c.stroke()}return c.setTransform(1,0,0,1,0,0),s(c,{cutoff:null!=e.cutoff?e.cutoff:.5,radius:null!=e.radius?e.radius:.5*h})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bitmap-sdf":75,"draw-svg-path":135,"is-svg-path":367,"parse-svg-path":402,"svg-path-bounds":469}],472:[function(t,e,r){(function(r){"use strict";e.exports=function t(e,r,i){var i=i||{};var o=a[e];o||(o=a[e]={" ":{data:new Float32Array(0),shape:.2}});var s=o[r];if(!s)if(r.length<=1||!/\d/.test(r))s=o[r]=function(t){for(var e=t.cells,r=t.positions,n=new Float32Array(6*e.length),i=0,a=0,o=0;o0&&(f+=.02);for(var p=new Float32Array(u),d=0,g=-.5*f,h=0;h1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)n=i=a=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;n=o(l,s,t+1/3),i=o(l,s,t),a=o(l,s,t-1/3)}return{r:255*n,g:255*i,b:255*a}}(e.h,l,u),f=!0,h="hsl"),e.hasOwnProperty("a")&&(a=e.a));var p,d,g;return a=E(a),{ok:f,format:e.format||h,r:o(255,s(i.r,0)),g:o(255,s(i.g,0)),b:o(255,s(i.b,0)),a:a}}(e);this._originalInput=e,this._r=u.r,this._g=u.g,this._b=u.b,this._a=u.a,this._roundA=a(100*this._a)/100,this._format=l.format||u.format,this._gradientType=l.gradientType,this._r<1&&(this._r=a(this._r)),this._g<1&&(this._g=a(this._g)),this._b<1&&(this._b=a(this._b)),this._ok=u.ok,this._tc_id=i++}function u(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,a=s(t,e,r),l=o(t,e,r),c=(a+l)/2;if(a==l)n=i=0;else{var u=a-l;switch(i=c>.5?u/(2-a-l):u/(a+l),a){case t:n=(e-r)/u+(e>1)+720)%360;--e;)n.h=(n.h+i)%360,a.push(c(n));return a}function T(t,e){e=e||6;for(var r=c(t).toHsv(),n=r.h,i=r.s,a=r.v,o=[],s=1/e;e--;)o.push(c({h:n,s:i,v:a})),a=(a+s)%1;return o}c.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 e,r,n,i=this.toRgb();return e=i.r/255,r=i.g/255,n=i.b/255,.2126*(e<=.03928?e/12.92:t.pow((e+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:t.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:t.pow((n+.055)/1.055,2.4))},setAlpha:function(t){return this._a=E(t),this._roundA=a(100*this._a)/100,this},toHsv:function(){var t=f(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=f(this._r,this._g,this._b),e=a(360*t.h),r=a(100*t.s),n=a(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=u(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=u(this._r,this._g,this._b),e=a(360*t.h),r=a(100*t.s),n=a(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return h(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,n,i){var o=[D(a(t).toString(16)),D(a(e).toString(16)),D(a(r).toString(16)),D(I(n))];if(i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:a(this._r),g:a(this._g),b:a(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+a(this._r)+", "+a(this._g)+", "+a(this._b)+")":"rgba("+a(this._r)+", "+a(this._g)+", "+a(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:a(100*L(this._r,255))+"%",g:a(100*L(this._g,255))+"%",b:a(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+a(100*L(this._r,255))+"%, "+a(100*L(this._g,255))+"%, "+a(100*L(this._b,255))+"%)":"rgba("+a(100*L(this._r,255))+"%, "+a(100*L(this._g,255))+"%, "+a(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(C[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+p(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var i=c(t);r="#"+p(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return c(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(v,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(m,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(A,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(M,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(k,arguments)}},c.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:O(t[n]));t=r}return c(t,e)},c.equals=function(t,e){return!(!t||!e)&&c(t).toRgbString()==c(e).toRgbString()},c.random=function(){return c.fromRatio({r:l(),g:l(),b:l()})},c.mix=function(t,e,r){r=0===r?0:r||50;var n=c(t).toRgb(),i=c(e).toRgb(),a=r/100;return c({r:(i.r-n.r)*a+n.r,g:(i.g-n.g)*a+n.g,b:(i.b-n.b)*a+n.b,a:(i.a-n.a)*a+n.a})},c.readability=function(e,r){var n=c(e),i=c(r);return(t.max(n.getLuminance(),i.getLuminance())+.05)/(t.min(n.getLuminance(),i.getLuminance())+.05)},c.isReadable=function(t,e,r){var n,i,a=c.readability(t,e);switch(i=!1,(n=function(t){var e,r;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==r&&"large"!==r&&(r="small");return{level:e,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":i=a>=4.5;break;case"AAlarge":i=a>=3;break;case"AAAsmall":i=a>=7}return i},c.mostReadable=function(t,e,r){var n,i,a,o,s=null,l=0;i=(r=r||{}).includeFallbackColors,a=r.level,o=r.size;for(var u=0;ul&&(l=n,s=c(e[u]));return c.isReadable(t,s,{level:a,size:o})||!i?s:(r.includeFallbackColors=!1,c.mostReadable(t,["#fff","#000"],r))};var S=c.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"},C=c.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(S);function E(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(e,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(e)&&(e="100%");var n=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(e);return e=o(r,s(0,parseFloat(e))),n&&(e=parseInt(e*r,10)/100),t.abs(e-r)<1e-6?1:e%r/parseFloat(r)}function z(t){return o(1,s(0,t))}function P(t){return parseInt(t,16)}function D(t){return 1==t.length?"0"+t:""+t}function O(t){return t<=1&&(t=100*t+"%"),t}function I(e){return t.round(255*parseFloat(e)).toString(16)}function R(t){return P(t)/255}var B,F,N,j=(F="[\\s|\\(]+("+(B="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+B+")[,|\\s]+("+B+")\\s*\\)?",N="[\\s|\\(]+("+B+")[,|\\s]+("+B+")[,|\\s]+("+B+")[,|\\s]+("+B+")\\s*\\)?",{CSS_UNIT:new RegExp(B),rgb:new RegExp("rgb"+F),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+F),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+F),hsva:new RegExp("hsva"+N),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})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function V(t){return!!j.CSS_UNIT.exec(t)}void 0!==e&&e.exports?e.exports=c:window.tinycolor=c}(Math)},{}],474:[function(t,e,r){"use strict";function n(t){if(t instanceof Float32Array)return t;if("number"==typeof t)return new Float32Array([t])[0];var e=new Float32Array(t);return e.set(t),e}e.exports=n,e.exports.float32=e.exports.float=n,e.exports.fract32=e.exports.fract=function(t){if("number"==typeof t)return n(t-n(t));for(var e=n(t),r=0,i=e.length;rf&&(f=l[0]),l[1]h&&(h=l[1])}function i(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(i);break;case"Point":n(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(n)}}if(!e){var a,o,s=r(t),l=new Array(2),c=1/0,u=c,f=-c,h=-c;for(o in t.arcs.forEach(function(t){for(var e=-1,r=t.length;++ef&&(f=l[0]),l[1]h&&(h=l[1])}),t.objects)i(t.objects[o]);e=t.bbox=[c,u,f,h]}return e},i=function(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r};function a(t,e){var r=e.id,n=e.bbox,i=null==e.properties?{}:e.properties,a=o(t,e);return null==r&&null==n?{type:"Feature",properties:i,geometry:a}:null==n?{type:"Feature",id:r,properties:i,geometry:a}:{type:"Feature",id:r,bbox:n,properties:i,geometry:a}}function o(t,e){var n=r(t),a=t.arcs;function o(t,e){e.length&&e.pop();for(var r=a[t<0?~t:t],o=0,s=r.length;o1)n=function(t,e,r){var n,i=[],a=[];function o(t){var e=t<0?~t:t;(a[e]||(a[e]=[])).push({i:t,g:n})}function s(t){t.forEach(o)}function l(t){t.forEach(s)}return function t(e){switch(n=e,e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"LineString":s(e.arcs);break;case"MultiLineString":case"Polygon":l(e.arcs);break;case"MultiPolygon":e.arcs.forEach(l)}}(e),a.forEach(null==r?function(t){i.push(t[0].i)}:function(t){r(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,e,r);else for(i=0,n=new Array(a=t.arcs.length);i1)for(var a,o,c=1,u=l(i[0]);cu&&(o=i[0],i[0]=i[c],i[c]=o,u=a);return i})}}var u=function(t,e){for(var r=0,n=t.length;r>>1;t[i]=2))throw new Error("n must be \u22652");if(t.transform)throw new Error("already quantized");var r,i=n(t),a=i[0],o=(i[2]-a)/(e-1)||1,s=i[1],l=(i[3]-s)/(e-1)||1;function c(t){t[0]=Math.round((t[0]-a)/o),t[1]=Math.round((t[1]-s)/l)}function u(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(u);break;case"Point":c(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(c)}}for(r in t.arcs.forEach(function(t){for(var e,r,n,i=1,c=1,u=t.length,f=t[0],h=f[0]=Math.round((f[0]-a)/o),p=f[1]=Math.round((f[1]-s)/l);iMath.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,l=0;l<3;++l)a+=t[l]*t[l],o+=i[l]*t[l];for(l=0;l<3;++l)i[l]-=o/a*t[l];return s(i,i),i}function h(t,e,r,i,a,o,s,l){this.center=n(r),this.up=n(i),this.right=n(a),this.radius=n([o]),this.angle=n([s,l]),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;c<16;++c)this.computedMatrix[c]=.5;this.recalcMatrix(0)}var p=h.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,n=0,i=0,a=0;a<3;++a)i+=e[a]*r[a],n+=e[a]*e[a];var l=Math.sqrt(n),u=0;for(a=0;a<3;++a)r[a]-=e[a]*i/n,u+=r[a]*r[a],e[a]/=l;var f=Math.sqrt(u);for(a=0;a<3;++a)r[a]/=f;var h=this.computedToward;o(h,e,r),s(h,h);var p=Math.exp(this.computedRadius[0]),d=this.computedAngle[0],g=this.computedAngle[1],m=Math.cos(d),v=Math.sin(d),y=Math.cos(g),x=Math.sin(g),b=this.computedCenter,_=m*y,w=v*y,k=x,M=-m*x,A=-v*x,T=y,S=this.computedEye,C=this.computedMatrix;for(a=0;a<3;++a){var E=_*r[a]+w*h[a]+k*e[a];C[4*a+1]=M*r[a]+A*h[a]+T*e[a],C[4*a+2]=E,C[4*a+3]=0}var L=C[1],z=C[5],P=C[9],D=C[2],O=C[6],I=C[10],R=z*I-P*O,B=P*D-L*I,F=L*O-z*D,N=c(R,B,F);R/=N,B/=N,F/=N,C[0]=R,C[4]=B,C[8]=F;for(a=0;a<3;++a)S[a]=b[a]+C[2+4*a]*p;for(a=0;a<3;++a){u=0;for(var j=0;j<3;++j)u+=C[a+4*j]*S[j];C[12+a]=-u}C[15]=1},p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r};var d=[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;d[0]=i[2],d[1]=i[6],d[2]=i[10];for(var o=this.computedUp,s=this.computedRight,l=this.computedToward,c=0;c<3;++c)i[4*c]=o[c],i[4*c+1]=s[c],i[4*c+2]=l[c];a(i,i,n,d);for(c=0;c<3;++c)o[c]=i[4*c],s[c]=i[4*c+1];this.up.set(t,o[0],o[1],o[2]),this.right.set(t,s[0],s[1],s[2])}},p.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var i=this.computedMatrix,a=(Math.exp(this.computedRadius[0]),i[1]),o=i[5],s=i[9],l=c(a,o,s);a/=l,o/=l,s/=l;var u=i[0],f=i[4],h=i[8],p=u*a+f*o+h*s,d=c(u-=a*p,f-=o*p,h-=s*p),g=(u/=d)*e+a*r,m=(f/=d)*e+o*r,v=(h/=d)*e+s*r;this.center.move(t,g,m,v);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+n),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,n){var a=1;"number"==typeof r&&(a=0|r),(a<0||a>3)&&(a=1);var o=(a+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var s=e[a],l=e[a+4],f=e[a+8];if(n){var h=Math.abs(s),p=Math.abs(l),d=Math.abs(f),g=Math.max(h,p,d);h===g?(s=s<0?-1:1,l=f=0):d===g?(f=f<0?-1:1,s=l=0):(l=l<0?-1:1,s=f=0)}else{var m=c(s,l,f);s/=m,l/=m,f/=m}var v,y,x=e[o],b=e[o+4],_=e[o+8],w=x*s+b*l+_*f,k=c(x-=s*w,b-=l*w,_-=f*w),M=l*(_/=k)-f*(b/=k),A=f*(x/=k)-s*_,T=s*b-l*x,S=c(M,A,T);if(M/=S,A/=S,T/=S,this.center.jump(t,H,G,W),this.radius.idle(t),this.up.jump(t,s,l,f),this.right.jump(t,x,b,_),2===a){var C=e[1],E=e[5],L=e[9],z=C*x+E*b+L*_,P=C*M+E*A+L*T;v=R<0?-Math.PI/2:Math.PI/2,y=Math.atan2(P,z)}else{var D=e[2],O=e[6],I=e[10],R=D*s+O*l+I*f,B=D*x+O*b+I*_,F=D*M+O*A+I*T;v=Math.asin(u(R)),y=Math.atan2(F,B)}this.angle.jump(t,y,v),this.recalcMatrix(t);var N=e[2],j=e[6],V=e[10],U=this.computedMatrix;i(U,e);var q=U[15],H=U[12]/q,G=U[13]/q,W=U[14]/q,Y=Math.exp(this.computedRadius[0]);this.center.jump(t,H-N*Y,G-j*Y,W-V*Y)},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,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter;var i=(n=n||this.computedUp)[0],a=n[1],o=n[2],s=c(i,a,o);if(!(s<1e-6)){i/=s,a/=s,o/=s;var l=e[0]-r[0],f=e[1]-r[1],h=e[2]-r[2],p=c(l,f,h);if(!(p<1e-6)){l/=p,f/=p,h/=p;var d=this.computedRight,g=d[0],m=d[1],v=d[2],y=i*g+a*m+o*v,x=c(g-=y*i,m-=y*a,v-=y*o);if(!(x<.01&&(x=c(g=a*h-o*f,m=o*l-i*h,v=i*f-a*l))<1e-6)){g/=x,m/=x,v/=x,this.up.set(t,i,a,o),this.right.set(t,g,m,v),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(p));var b=a*v-o*m,_=o*g-i*v,w=i*m-a*g,k=c(b,_,w),M=i*l+a*f+o*h,A=g*l+m*f+v*h,T=(b/=k)*l+(_/=k)*f+(w/=k)*h,S=Math.asin(u(M)),C=Math.atan2(T,A),E=this.angle._state,L=E[E.length-1],z=E[E.length-2];L%=2*Math.PI;var P=Math.abs(L+2*Math.PI-C),D=Math.abs(L-C),O=Math.abs(L-2*Math.PI-C);P0?r.pop():new ArrayBuffer(t)}function h(t){return new Uint8Array(f(t),0,t)}function p(t){return new Uint16Array(f(2*t),0,t)}function d(t){return new Uint32Array(f(4*t),0,t)}function g(t){return new Int8Array(f(t),0,t)}function m(t){return new Int16Array(f(2*t),0,t)}function v(t){return new Int32Array(f(4*t),0,t)}function y(t){return new Float32Array(f(4*t),0,t)}function x(t){return new Float64Array(f(8*t),0,t)}function b(t){return o?new Uint8ClampedArray(f(t),0,t):h(t)}function _(t){return new DataView(f(t),0,t)}function w(t){t=i.nextPow2(t);var e=i.log2(t),r=c[e];return r.length>0?r.pop():new n(t)}r.free=function(t){if(n.isBuffer(t))c[i.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|i.log2(e);l[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=function(t){u(t.buffer)},r.freeArrayBuffer=u,r.freeBuffer=function(t){c[i.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return f(t);switch(e){case"uint8":return h(t);case"uint16":return p(t);case"uint32":return d(t);case"int8":return g(t);case"int16":return m(t);case"int32":return v(t);case"float":case"float32":return y(t);case"double":case"float64":return x(t);case"uint8_clamped":return b(t);case"buffer":return w(t);case"data":case"dataview":return _(t);default:return null}return null},r.mallocArrayBuffer=f,r.mallocUint8=h,r.mallocUint16=p,r.mallocUint32=d,r.mallocInt8=g,r.mallocInt16=m,r.mallocInt32=v,r.mallocFloat32=r.mallocFloat=y,r.mallocFloat64=r.mallocDouble=x,r.mallocUint8Clamped=b,r.mallocDataView=_,r.mallocBuffer=w,r.clearCache=function(){for(var t=0;t<32;++t)s.UINT8[t].length=0,s.UINT16[t].length=0,s.UINT32[t].length=0,s.INT8[t].length=0,s.INT16[t].length=0,s.INT32[t].length=0,s.FLOAT[t].length=0,s.DOUBLE[t].length=0,s.UINT8C[t].length=0,l[t].length=0,c[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":74,buffer:86,dup:137}],482:[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;e=a)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}}),l=n[r];r=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(e)?n.showHidden=e:e&&r._extend(n,e),y(n.showHidden)&&(n.showHidden=!1),y(n.depth)&&(n.depth=2),y(n.colors)&&(n.colors=!1),y(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=l),u(n,t,n.depth)}function l(t,e){var r=s.styles[e];return r?"\x1b["+s.colors[r][0]+"m"+t+"\x1b["+s.colors[r][1]+"m":t}function c(t,e){return t}function u(t,e,n){if(t.customInspect&&e&&k(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return v(i)||(i=u(t,i,n)),i}var a=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(m(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(g(e))return t.stylize("null","null")}(t,e);if(a)return a;var o=Object.keys(e),s=function(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),w(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return f(e);if(0===o.length){if(k(e)){var l=e.name?": "+e.name:"";return t.stylize("[Function"+l+"]","special")}if(x(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(_(e))return t.stylize(Date.prototype.toString.call(e),"date");if(w(e))return f(e)}var c,b="",M=!1,A=["{","}"];(p(e)&&(M=!0,A=["[","]"]),k(e))&&(b=" [Function"+(e.name?": "+e.name:"")+"]");return x(e)&&(b=" "+RegExp.prototype.toString.call(e)),_(e)&&(b=" "+Date.prototype.toUTCString.call(e)),w(e)&&(b=" "+f(e)),0!==o.length||M&&0!=e.length?n<0?x(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=M?function(t,e,r,n,i){for(var a=[],o=0,s=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(c,b,A)):A[0]+b+A[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i,a){var o,s,l;if((l=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=l.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):l.set&&(s=t.stylize("[Setter]","special")),S(n,i)||(o="["+i+"]"),s||(t.seen.indexOf(l.value)<0?(s=g(r)?u(t,l.value,null):u(t,l.value,r-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n")):s=t.stylize("[Circular]","special")),y(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function g(t){return null===t}function m(t){return"number"==typeof t}function v(t){return"string"==typeof t}function y(t){return void 0===t}function x(t){return b(t)&&"[object RegExp]"===M(t)}function b(t){return"object"==typeof t&&null!==t}function _(t){return b(t)&&"[object Date]"===M(t)}function w(t){return b(t)&&("[object Error]"===M(t)||t instanceof Error)}function k(t){return"function"==typeof t}function M(t){return Object.prototype.toString.call(t)}function A(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(y(a)&&(a=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(a)){var n=e.pid;o[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else o[t]=function(){};return o[t]},r.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=d,r.isNull=g,r.isNullOrUndefined=function(t){return null==t},r.isNumber=m,r.isString=v,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=y,r.isRegExp=x,r.isObject=b,r.isDate=_,r.isError=w,r.isFunction=k,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t("./support/isBuffer");var T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function S(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[A(t.getHours()),A(t.getMinutes()),A(t.getSeconds())].join(":"),[t.getDate(),T[t.getMonth()],e].join(" ")),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!b(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":486,_process:424,inherits:485}],488:[function(t,e,r){"use strict";e.exports=function(t,e){"object"==typeof e&&null!==e||(e={});return n(t,e.canvas||i,e.context||a,e)};var n=t("./lib/vtext"),i=null,a=null;"undefined"!=typeof document&&((i=document.createElement("canvas")).width=8192,i.height=1024,a=i.getContext("2d"))},{"./lib/vtext":489}],489:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var a=n.size||64,o=n.font||"normal";return r.font=a+"px "+o,r.textAlign="start",r.textBaseline="alphabetic",r.direction="ltr",f(function(t,e,r,n){var a=0|Math.ceil(e.measureText(r).width+2*n);if(a>8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var o=3*n;t.height=0?e[a]:i})},has___:{value:x(function(e){var n=y(e);return n?r in n:t.indexOf(e)>=0})},set___:{value:x(function(n,i){var a,o=y(n);return o?o[r]=i:(a=t.indexOf(n))>=0?e[a]=i:(a=t.length,e[a]=i,t[a]=n),this})},delete___:{value:x(function(n){var i,a,o=y(n);return o?r in o&&delete o[r]:!((i=t.indexOf(n))<0||(a=t.length-1,t[i]=void 0,e[i]=e[a],t[i]=t[a],t.length=a,e.length=a,0))})}})};g.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 r?function(){function n(){this instanceof g||b();var e,n=new r,i=void 0,a=!1;return e=t?function(t,e){return n.set(t,e),n.has(t)||(i||(i=new g),i.set(t,e)),this}:function(t,e){if(a)try{n.set(t,e)}catch(r){i||(i=new g),i.set___(t,e)}else n.set(t,e);return this},Object.create(g.prototype,{get___:{value:x(function(t,e){return i?n.has(t)?n.get(t):i.get___(t,e):n.get(t,e)})},has___:{value:x(function(t){return n.has(t)||!!i&&i.has___(t)})},set___:{value:x(e)},delete___:{value:x(function(t){var e=!!n.delete(t);return i&&i.delete___(t)||e})},permitHostObjects___:{value:x(function(t){if(t!==m)throw new Error("bogus call to permitHostObjects___");a=!0})}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),n.prototype=g.prototype,e.exports=n,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=g)}function m(t){t.permitHostObjects___&&t.permitHostObjects___(m)}function v(t){return!(t.substr(0,l.length)==l&&"___"===t.substr(t.length-3))}function y(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[c];if(e&&e.key===t)return e;if(s(t)){e={key:t};try{return o(t,c,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(t){return}}}function x(t){return t.prototype=null,Object.freeze(t)}function b(){p||"undefined"==typeof console||(p=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}()},{}],491:[function(t,e,r){var n=t("./hidden-store.js");e.exports=function(){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:n(e,t)}}},{"./hidden-store.js":492}],492:[function(t,e,r){e.exports=function(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}},{}],493:[function(t,e,r){var n=t("./create-store.js");e.exports=function(){var t=n();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){return t(e).value=r,this},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}},{"./create-store.js":491}],494:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":202}],495:[function(t,e,r){var n=t("../main"),i=t("object-assign"),a=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar,i(o.prototype,{name:"Chinese",jdEpoch:1721425.5,hasYearZero:!1,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(t,e){if("string"==typeof t){var r=t.match(l);return r?r[0]:""}var n=this._validateYear(t),i=t.month(),a=""+this.toChineseMonth(n,i);return e&&a.length<2&&(a="0"+a),this.isIntercalaryMonth(n,i)&&(a+="i"),a},monthNames:function(t){if("string"==typeof t){var e=t.match(c);return e?e[0]:""}var r=this._validateYear(t),n=t.month(),i=["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"][this.toChineseMonth(r,n)-1];return this.isIntercalaryMonth(r,n)&&(i="\u95f0"+i),i},monthNamesShort:function(t){if("string"==typeof t){var e=t.match(u);return e?e[0]:""}var r=this._validateYear(t),n=t.month(),i=["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"][this.toChineseMonth(r,n)-1];return this.isIntercalaryMonth(r,n)&&(i="\u95f0"+i),i},parseMonth:function(t,e){t=this._validateYear(t);var r,n=parseInt(e);if(isNaN(n))"\u95f0"===e[0]&&(r=!0,e=e.substring(1)),"\u6708"===e[e.length-1]&&(e=e.substring(0,e.length-1)),n=1+["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"].indexOf(e);else{var i=e[e.length-1];r="i"===i||"I"===i}return this.toMonthIndex(t,n,r)},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},_validateYear:function(t,e){if(t.year&&(t=t.year()),"number"!=typeof t||t<1888||t>2111)throw e.replace(/\{0\}/,this.local.name);return t},toMonthIndex:function(t,e,r){var i=this.intercalaryMonth(t);if(r&&e!==i||e<1||e>12)throw n.local.invalidMonth.replace(/\{0\}/,this.local.name);return i?!r&&e<=i?e-1:e:e-1},toChineseMonth:function(t,e){t.year&&(e=(t=t.year()).month());var r=this.intercalaryMonth(t);if(e<0||e>(r?12:11))throw n.local.invalidMonth.replace(/\{0\}/,this.local.name);return r?e>13},isIntercalaryMonth:function(t,e){t.year&&(e=(t=t.year()).month());var r=this.intercalaryMonth(t);return!!r&&r===e},leapYear:function(t){return 0!==this.intercalaryMonth(t)},weekOfYear:function(t,e,r){var i,o=this._validateYear(t,n.local.invalidyear),s=h[o-h[0]],l=s>>9&4095,c=s>>5&15,u=31&s;(i=a.newDate(l,c,u)).add(4-(i.dayOfWeek()||7),"d");var f=this.toJD(t,e,r)-i.toJD();return 1+Math.floor(f/7)},monthsInYear:function(t){return this.leapYear(t)?13:12},daysInMonth:function(t,e){t.year&&(e=t.month(),t=t.year()),t=this._validateYear(t);var r=f[t-f[0]];if(e>(r>>13?12:11))throw n.local.invalidMonth.replace(/\{0\}/,this.local.name);return r&1<<12-e?30:29},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,s,r,n.local.invalidDate);t=this._validateYear(i.year()),e=i.month(),r=i.day();var o=this.isIntercalaryMonth(t,e),s=this.toChineseMonth(t,e),l=function(t,e,r,n,i){var a,o,s;if("object"==typeof t)o=t,a=e||{};else{var l="number"==typeof t&&t>=1888&&t<=2111;if(!l)throw new Error("Lunar year outside range 1888-2111");var c="number"==typeof e&&e>=1&&e<=12;if(!c)throw new Error("Lunar month outside range 1 - 12");var u,p="number"==typeof r&&r>=1&&r<=30;if(!p)throw new Error("Lunar day outside range 1 - 30");"object"==typeof n?(u=!1,a=n):(u=!!n,a=i||{}),o={year:t,month:e,day:r,isIntercalary:u}}s=o.day-1;var d,g=f[o.year-f[0]],m=g>>13;d=m?o.month>m?o.month:o.isIntercalary?o.month:o.month-1:o.month-1;for(var v=0;v>9&4095,(x>>5&15)-1,(31&x)+s);return a.year=b.getFullYear(),a.month=1+b.getMonth(),a.day=b.getDate(),a}(t,s,r,o);return a.toJD(l.year,l.month,l.day)},fromJD:function(t){var e=a.fromJD(t),r=function(t,e,r,n){var i,a;if("object"==typeof t)i=t,a=e||{};else{var o="number"==typeof t&&t>=1888&&t<=2111;if(!o)throw new Error("Solar year outside range 1888-2111");var s="number"==typeof e&&e>=1&&e<=12;if(!s)throw new Error("Solar month outside range 1 - 12");var l="number"==typeof r&&r>=1&&r<=31;if(!l)throw new Error("Solar day outside range 1 - 31");i={year:t,month:e,day:r},a=n||{}}var c=h[i.year-h[0]],u=i.year<<9|i.month<<5|i.day;a.year=u>=c?i.year:i.year-1,c=h[a.year-h[0]];var p,d=new Date(c>>9&4095,(c>>5&15)-1,31&c),g=new Date(i.year,i.month-1,i.day);p=Math.round((g-d)/864e5);var m,v=f[a.year-f[0]];for(m=0;m<13;m++){var y=v&1<<12-m?30:29;if(p>13;!x||m=2&&n<=6},extraInfo:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return{century:o[Math.floor((i.year()-1)/100)+1]||""}},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return t=i.year()+(i.year()<0?1:0),e=i.month(),(r=i.day())+(e>1?16:0)+(e>2?32*(e-2):0)+400*(t-1)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t+.5)-Math.floor(this.jdEpoch)-1;var e=Math.floor(t/400)+1;t-=400*(e-1),t+=t>15?16:0;var r=Math.floor(t/32)+1,n=t-32*(r-1)+1;return this.newDate(e<=0?e-1:e,r,n)}});var o={20:"Fruitbat",21:"Anchovy"};n.calendars.discworld=a},{"../main":509,"object-assign":397}],498:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Ethiopian",jdEpoch:1724220.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return(t=e.year()+(e.year()<0?1:0))%4==3||t%4==-1},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear),13},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(13===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return(t=i.year())<0&&t++,i.day()+30*(i.month()-1)+365*(t-1)+Math.floor(t/4)+this.jdEpoch-1},fromJD:function(t){var e=Math.floor(t)+.5-this.jdEpoch,r=Math.floor((e-Math.floor((e+366)/1461))/365)+1;r<=0&&r--,e=Math.floor(t)+.5-this.newDate(r,1,1).toJD();var n=Math.floor(e/30)+1,i=e-30*(n-1)+1;return this.newDate(r,n,i)}}),n.calendars.ethiopian=a},{"../main":509,"object-assign":397}],499:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function o(t,e){return t-e*Math.floor(t/e)}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return this._leapYear(e.year())},_leapYear:function(t){return o(7*(t=t<0?t+1:t)+1,19)<7},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),this._leapYear(t.year?t.year():t)?13:12},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return t=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year(),this.toJD(-1===t?1:t+1,7,1)-this.toJD(t,7,1)},daysInMonth:function(t,e){return t.year&&(e=t.month(),t=t.year()),this._validate(t,e,this.minDay,n.local.invalidMonth),12===e&&this.leapYear(t)?30:8===e&&5===o(this.daysInYear(t),10)?30:9===e&&3===o(this.daysInYear(t),10)?29:this.daysPerMonth[e-1]},weekDay:function(t,e,r){return 6!==this.dayOfWeek(t,e,r)},extraInfo:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return{yearType:(this.leapYear(i)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(i)%10-3]}},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);t=i.year(),e=i.month(),r=i.day();var a=t<=0?t+1:t,o=this.jdEpoch+this._delay1(a)+this._delay2(a)+r+1;if(e<7){for(var s=7;s<=this.monthsInYear(t);s++)o+=this.daysInMonth(t,s);for(s=1;s=this.toJD(-1===e?1:e+1,7,1);)e++;for(var r=tthis.toJD(e,r,this.daysInMonth(e,r));)r++;var n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),n.calendars.hebrew=a},{"../main":509,"object-assign":397}],500:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Islamic",jdEpoch:1948439.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-kham\u012bs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(t){return(11*this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year()+14)%30<11},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return this.leapYear(t)?355:354},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return t=i.year(),e=i.month(),r=i.day(),t=t<=0?t+1:t,r+Math.ceil(29.5*(e-1))+354*(t-1)+Math.floor((3+11*t)/30)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t)+.5;var e=Math.floor((30*(t-this.jdEpoch)+10646)/10631);e=e<=0?e-1:e;var r=Math.min(12,Math.ceil((t-29-this.toJD(e,1,1))/29.5)+1),n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),n.calendars.islamic=a},{"../main":509,"object-assign":397}],501:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Julian",jdEpoch:1721423.5,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return(t=e.year()<0?e.year()+1:e.year())%4==0},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(4-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return t=i.year(),e=i.month(),r=i.day(),t<0&&t++,e<=2&&(t--,e+=12),Math.floor(365.25*(t+4716))+Math.floor(30.6001*(e+1))+r-1524.5},fromJD:function(t){var e=Math.floor(t+.5)+1524,r=Math.floor((e-122.1)/365.25),n=Math.floor(365.25*r),i=Math.floor((e-n)/30.6001),a=i-Math.floor(i<14?1:13),o=r-Math.floor(a>2?4716:4715),s=e-n-Math.floor(30.6001*i);return o<=0&&o--,this.newDate(o,a,s)}}),n.calendars.julian=a},{"../main":509,"object-assign":397}],502:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function o(t,e){return t-e*Math.floor(t/e)}function s(t,e){return o(t-1,e)+1}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),!1},formatYear:function(t){t=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year();var e=Math.floor(t/400);return t%=400,t+=t<0?400:0,e+"."+Math.floor(t/20)+"."+t%20},forYear:function(t){if((t=t.split(".")).length<3)throw"Invalid Mayan year";for(var e=0,r=0;r19||r>0&&n<0)throw"Invalid Mayan year";e=20*e+n}return e},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),18},weekOfYear:function(t,e,r){return this._validate(t,e,r,n.local.invalidDate),0},daysInYear:function(t){return this._validate(t,this.minMonth,this.minDay,n.local.invalidYear),360},daysInMonth:function(t,e){return this._validate(t,e,this.minDay,n.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(t,e,r){return this._validate(t,e,r,n.local.invalidDate).day()},weekDay:function(t,e,r){return this._validate(t,e,r,n.local.invalidDate),!0},extraInfo:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate).toJD(),a=this._toHaab(i),o=this._toTzolkin(i);return{haabMonthName:this.local.haabMonths[a[0]-1],haabMonth:a[0],haabDay:a[1],tzolkinDayName:this.local.tzolkinMonths[o[0]-1],tzolkinDay:o[0],tzolkinTrecena:o[1]}},_toHaab:function(t){var e=o((t-=this.jdEpoch)+8+340,365);return[Math.floor(e/20)+1,o(e,20)]},_toTzolkin:function(t){return[s((t-=this.jdEpoch)+20,20),s(t+4,13)]},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);return i.day()+20*i.month()+360*i.year()+this.jdEpoch},fromJD:function(t){t=Math.floor(t)+.5-this.jdEpoch;var e=Math.floor(t/360);t%=360,t+=t<0?360:0;var r=Math.floor(t/20),n=t%20;return this.newDate(e,r,n)}}),n.calendars.mayan=a},{"../main":509,"object-assign":397}],503:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar;var o=n.instance("gregorian");i(a.prototype,{name:"Nanakshahi",jdEpoch:2257673.5,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return o.leapYear(e.year()+(e.year()<1?1:0)+1469)},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(1-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidMonth);(t=i.year())<0&&t++;for(var a=i.day(),s=1;s=this.toJD(e+1,1,1);)e++;for(var r=t-Math.floor(this.toJD(e,1,1)+.5)+1,n=1;r>this.daysInMonth(e,n);)r-=this.daysInMonth(e,n),n++;return this.newDate(e,n,r)}}),n.calendars.nanakshahi=a},{"../main":509,"object-assign":397}],504:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar,i(a.prototype,{name:"Nepali",jdEpoch:1700709.5,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(t){return this.daysInYear(t)!==this.daysPerYear},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){if(t=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear).year(),void 0===this.NEPALI_CALENDAR_DATA[t])return this.daysPerYear;for(var e=0,r=this.minMonth;r<=12;r++)e+=this.NEPALI_CALENDAR_DATA[t][r];return e},daysInMonth:function(t,e){return t.year&&(e=t.month(),t=t.year()),this._validate(t,e,this.minDay,n.local.invalidMonth),void 0===this.NEPALI_CALENDAR_DATA[t]?this.daysPerMonth[e-1]:this.NEPALI_CALENDAR_DATA[t][e]},weekDay:function(t,e,r){return 6!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);t=i.year(),e=i.month(),r=i.day();var a=n.instance(),o=0,s=e,l=t;this._createMissingCalendarData(t);var c=t-(s>9||9===s&&r>=this.NEPALI_CALENDAR_DATA[l][0]?56:57);for(9!==e&&(o=r,s--);9!==s;)s<=0&&(s=12,l--),o+=this.NEPALI_CALENDAR_DATA[l][s],s--;return 9===e?(o+=r-this.NEPALI_CALENDAR_DATA[l][0])<0&&(o+=a.daysInYear(c)):o+=this.NEPALI_CALENDAR_DATA[l][9]-this.NEPALI_CALENDAR_DATA[l][0],a.newDate(c,1,1).add(o,"d").toJD()},fromJD:function(t){var e=n.instance().fromJD(t),r=e.year(),i=e.dayOfYear(),a=r+56;this._createMissingCalendarData(a);for(var o=9,s=this.NEPALI_CALENDAR_DATA[a][0],l=this.NEPALI_CALENDAR_DATA[a][o]-s+1;i>l;)++o>12&&(o=1,a++),l+=this.NEPALI_CALENDAR_DATA[a][o];var c=this.NEPALI_CALENDAR_DATA[a][o]-(l-i);return this.newDate(a,o,c)},_createMissingCalendarData:function(t){var e=this.daysPerMonth.slice(0);e.unshift(17);for(var r=t-1;r0?474:473))%2820+474+38)%2816<682},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-(n.dayOfWeek()+1)%7,"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(12===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);t=i.year(),e=i.month(),r=i.day();var a=t-(t>=0?474:473),s=474+o(a,2820);return r+(e<=7?31*(e-1):30*(e-1)+6)+Math.floor((682*s-110)/2816)+365*(s-1)+1029983*Math.floor(a/2820)+this.jdEpoch-1},fromJD:function(t){var e=(t=Math.floor(t)+.5)-this.toJD(475,1,1),r=Math.floor(e/1029983),n=o(e,1029983),i=2820;if(1029982!==n){var a=Math.floor(n/366),s=o(n,366);i=Math.floor((2134*a+2816*s+2815)/1028522)+a+1}var l=i+2820*r+474;l=l<=0?l-1:l;var c=t-this.toJD(l,1,1)+1,u=c<=186?Math.ceil(c/31):Math.ceil((c-6)/30),f=t-this.toJD(l,u,1)+1;return this.newDate(l,u,f)}}),n.calendars.persian=a,n.calendars.jalali=a},{"../main":509,"object-assign":397}],506:[function(t,e,r){var n=t("../main"),i=t("object-assign"),a=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar,i(o.prototype,{name:"Taiwan",jdEpoch:2419402.5,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(e.year());return a.leapYear(t)},weekOfYear:function(t,e,r){var i=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(i.year());return a.weekOfYear(t,i.month(),i.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);t=this._t2gYear(i.year());return a.toJD(t,i.month(),i.day())},fromJD:function(t){var e=a.fromJD(t),r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)},_g2tYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)}}),n.calendars.taiwan=o},{"../main":509,"object-assign":397}],507:[function(t,e,r){var n=t("../main"),i=t("object-assign"),a=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar,i(o.prototype,{name:"Thai",jdEpoch:1523098.5,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(e.year());return a.leapYear(t)},weekOfYear:function(t,e,r){var i=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=this._t2gYear(i.year());return a.weekOfYear(t,i.month(),i.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(2===r.month()&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate);t=this._t2gYear(i.year());return a.toJD(t,i.month(),i.day())},fromJD:function(t){var e=a.fromJD(t),r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)},_g2tYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)}}),n.calendars.thai=o},{"../main":509,"object-assign":397}],508:[function(t,e,r){var n=t("../main"),i=t("object-assign");function a(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}a.prototype=new n.baseCalendar,i(a.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thal\u0101th\u0101\u2019","Yawm al-Arba\u2018\u0101\u2019","Yawm al-Kham\u012bs","Yawm al-Jum\u2018a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return 355===this.daysInYear(e.year())},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){for(var e=0,r=1;r<=12;r++)e+=this.daysInMonth(t,r);return e},daysInMonth:function(t,e){for(var r=this._validate(t,e,this.minDay,n.local.invalidMonth).toJD()-24e5+.5,i=0,a=0;ar)return o[i]-o[i-1];i++}return 30},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var i=this._validate(t,e,r,n.local.invalidDate),a=12*(i.year()-1)+i.month()-15292;return i.day()+o[a-1]-1+24e5-.5},fromJD:function(t){for(var e=t-24e5+.5,r=0,n=0;ne);n++)r++;var i=r+15292,a=Math.floor((i-1)/12),s=a+1,l=i-12*a,c=e-o[r-1]+1;return this.newDate(s,l,c)},isValid:function(t,e,r){var i=n.baseCalendar.prototype.isValid.apply(this,arguments);return i&&(i=(t=null!=t.year?t.year:t)>=1276&&t<=1500),i},_validate:function(t,e,r,i){var a=n.baseCalendar.prototype._validate.apply(this,arguments);if(a.year<1276||a.year>1500)throw i.replace(/\{0\}/,this.local.name);return a}}),n.calendars.ummalqura=a;var o=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]},{"../main":509,"object-assign":397}],509:[function(t,e,r){var n=t("object-assign");function i(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}function a(t,e,r,n){if(this._calendar=t,this._year=e,this._month=r,this._day=n,0===this._calendar._validateLevel&&!this._calendar.isValid(this._year,this._month,this._day))throw(c.local.invalidDate||c.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function o(t,e){return"000000".substring(0,e-(t=""+t).length)+t}function s(){this.shortYearCutoff="+10"}function l(t){this.local=this.regionalOptions[t]||this.regionalOptions[""]}n(i.prototype,{instance:function(t,e){t=(t||"gregorian").toLowerCase(),e=e||"";var r=this._localCals[t+"-"+e];if(!r&&this.calendars[t]&&(r=new this.calendars[t](e),this._localCals[t+"-"+e]=r),!r)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,t);return r},newDate:function(t,e,r,n,i){return(n=(null!=t&&t.year?t.calendar():"string"==typeof n?this.instance(n,i):n)||this.instance()).newDate(t,e,r)},substituteDigits:function(t){return function(e){return(e+"").replace(/[0-9]/g,function(e){return t[e]})}},substituteChineseDigits:function(t,e){return function(r){for(var n="",i=0;r>0;){var a=r%10;n=(0===a?"":t[a]+e[i])+n,i++,r=Math.floor(r/10)}return 0===n.indexOf(t[1]+e[1])&&(n=n.substr(1)),n||t[0]}}}),n(a.prototype,{newDate:function(t,e,r){return this._calendar.newDate(null==t?this:t,e,r)},year:function(t){return 0===arguments.length?this._year:this.set(t,"y")},month:function(t){return 0===arguments.length?this._month:this.set(t,"m")},day:function(t){return 0===arguments.length?this._day:this.set(t,"d")},date:function(t,e,r){if(!this._calendar.isValid(t,e,r))throw(c.local.invalidDate||c.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=t,this._month=e,this._day=r,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(t,e){return this._calendar.add(this,t,e)},set:function(t,e){return this._calendar.set(this,t,e)},compareTo:function(t){if(this._calendar.name!==t._calendar.name)throw(c.local.differentCalendars||c.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,t._calendar.local.name);var e=this._year!==t._year?this._year-t._year:this._month!==t._month?this.monthOfYear()-t.monthOfYear():this._day-t._day;return 0===e?0:e<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(t){return this._calendar.fromJD(t)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(t){return this._calendar.fromJSDate(t)},toString:function(){return(this.year()<0?"-":"")+o(Math.abs(this.year()),4)+"-"+o(this.month(),2)+"-"+o(this.day(),2)}}),n(s.prototype,{_validateLevel:0,newDate:function(t,e,r){return null==t?this.today():(t.year&&(this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate),r=t.day(),e=t.month(),t=t.year()),new a(this,t,e,r))},today:function(){return this.fromJSDate(new Date)},epoch:function(t){return this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear).year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear);return(e.year()<0?"-":"")+o(Math.abs(e.year()),4)},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear),12},monthOfYear:function(t,e){var r=this._validate(t,e,this.minDay,c.local.invalidMonth||c.regionalOptions[""].invalidMonth);return(r.month()+this.monthsInYear(r)-this.firstMonth)%this.monthsInYear(r)+this.minMonth},fromMonthOfYear:function(t,e){var r=(e+this.firstMonth-2*this.minMonth)%this.monthsInYear(t)+this.minMonth;return this._validate(t,r,this.minDay,c.local.invalidMonth||c.regionalOptions[""].invalidMonth),r},daysInYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,c.local.invalidYear||c.regionalOptions[""].invalidYear);return this.leapYear(e)?366:365},dayOfYear:function(t,e,r){var n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate);return n.toJD()-this.newDate(n.year(),this.fromMonthOfYear(n.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(t,e,r){var n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(n))+2)%this.daysInWeek()},extraInfo:function(t,e,r){return this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate),{}},add:function(t,e,r){return this._validate(t,this.minMonth,this.minDay,c.local.invalidDate||c.regionalOptions[""].invalidDate),this._correctAdd(t,this._add(t,e,r),e,r)},_add:function(t,e,r){if(this._validateLevel++,"d"===r||"w"===r){var n=t.toJD()+e*("w"===r?this.daysInWeek():1),i=t.calendar().fromJD(n);return this._validateLevel--,[i.year(),i.month(),i.day()]}try{var a=t.year()+("y"===r?e:0),o=t.monthOfYear()+("m"===r?e:0);i=t.day();"y"===r?(t.month()!==this.fromMonthOfYear(a,o)&&(o=this.newDate(a,t.month(),this.minDay).monthOfYear()),o=Math.min(o,this.monthsInYear(a)),i=Math.min(i,this.daysInMonth(a,this.fromMonthOfYear(a,o)))):"m"===r&&(!function(t){for(;oe-1+t.minMonth;)a++,o-=e,e=t.monthsInYear(a)}(this),i=Math.min(i,this.daysInMonth(a,this.fromMonthOfYear(a,o))));var s=[a,this.fromMonthOfYear(a,o),i];return this._validateLevel--,s}catch(t){throw this._validateLevel--,t}},_correctAdd:function(t,e,r,n){if(!(this.hasYearZero||"y"!==n&&"m"!==n||0!==e[0]&&t.year()>0==e[0]>0)){var i={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[n],a=r<0?-1:1;e=this._add(t,r*i[0]+a*i[1],i[2])}return t.date(e[0],e[1],e[2])},set:function(t,e,r){this._validate(t,this.minMonth,this.minDay,c.local.invalidDate||c.regionalOptions[""].invalidDate);var n="y"===r?e:t.year(),i="m"===r?e:t.month(),a="d"===r?e:t.day();return"y"!==r&&"m"!==r||(a=Math.min(a,this.daysInMonth(n,i))),t.date(n,i,a)},isValid:function(t,e,r){this._validateLevel++;var n=this.hasYearZero||0!==t;if(n){var i=this.newDate(t,e,this.minDay);n=e>=this.minMonth&&e-this.minMonth=this.minDay&&r-this.minDay13.5?13:1),c=i-(l>2.5?4716:4715);return c<=0&&c--,this.newDate(c,l,s)},toJSDate:function(t,e,r){var n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate),i=new Date(n.year(),n.month()-1,n.day());return i.setHours(0),i.setMinutes(0),i.setSeconds(0),i.setMilliseconds(0),i.setHours(i.getHours()>12?i.getHours()+2:0),i},fromJSDate:function(t){return this.newDate(t.getFullYear(),t.getMonth()+1,t.getDate())}});var c=e.exports=new i;c.cdate=a,c.baseCalendar=s,c.calendars.gregorian=l},{"object-assign":397}],510:[function(t,e,r){var n=t("object-assign"),i=t("./main");n(i.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),i.local=i.regionalOptions[""],n(i.cdate.prototype,{formatDate:function(t,e){return"string"!=typeof t&&(e=t,t=""),this._calendar.formatDate(t||"",this,e)}}),n(i.baseCalendar.prototype,{UNIX_EPOCH:i.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:86400,TICKS_EPOCH:i.instance().jdEpoch,TICKS_PER_DAY:864e9,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(t,e,r){if("string"!=typeof t&&(r=e,e=t,t=""),!e)return"";if(e.calendar()!==this)throw i.local.invalidFormat||i.regionalOptions[""].invalidFormat;t=t||this.local.dateFormat;for(var n,a,o,s,l=(r=r||{}).dayNamesShort||this.local.dayNamesShort,c=r.dayNames||this.local.dayNames,u=r.monthNumbers||this.local.monthNumbers,f=r.monthNamesShort||this.local.monthNamesShort,h=r.monthNames||this.local.monthNames,p=(r.calculateWeek||this.local.calculateWeek,function(e,r){for(var n=1;w+n1}),d=function(t,e,r,n){var i=""+e;if(p(t,n))for(;i.length1},x=function(t,r){var n=y(t,r),a=[2,3,n?4:2,n?4:2,10,11,20]["oyYJ@!".indexOf(t)+1],o=new RegExp("^-?\\d{1,"+a+"}"),s=e.substring(A).match(o);if(!s)throw(i.local.missingNumberAt||i.regionalOptions[""].missingNumberAt).replace(/\{0\}/,A);return A+=s[0].length,parseInt(s[0],10)},b=this,_=function(){if("function"==typeof l){y("m");var t=l.call(b,e.substring(A));return A+=t.length,t}return x("m")},w=function(t,r,n,a){for(var o=y(t,a)?n:r,s=0;s-1){p=1,d=g;for(var C=this.daysInMonth(h,p);d>C;C=this.daysInMonth(h,p))p++,d-=C}return f>-1?this.fromJD(f):this.newDate(h,p,d)},determineDate:function(t,e,r,n,i){r&&"object"!=typeof r&&(i=n,n=r,r=null),"string"!=typeof n&&(i=n,n="");var a=this;return e=e?e.newDate():null,t=null==t?e:"string"==typeof t?function(t){try{return a.parseDate(n,t,i)}catch(t){}for(var e=((t=t.toLowerCase()).match(/^c/)&&r?r.newDate():null)||a.today(),o=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,s=o.exec(t);s;)e.add(parseInt(s[1],10),s[2]||"d"),s=o.exec(t);return e}(t):"number"==typeof t?isNaN(t)||t===1/0||t===-1/0?e:a.today().add(t,"d"):a.newDate(t)}})},{"./main":509,"object-assign":397}],511:[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":117}],512:[function(t,e,r){"use strict";e.exports=function(t,e){var r=[];return e=+e||0,n(t.hi(t.shape[0]-1),r,e),r};var n=t("./lib/zc-core")},{"./lib/zc-core":511}],513:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./common_defaults"),o=t("./attributes");e.exports=function(t,e,r,s,l){function c(r,i){return n.coerce(t,e,o,r,i)}s=s||{};var u=c("visible",!(l=l||{}).itemIsNotPlainObject),f=c("clicktoshow");if(!u&&!f)return e;a(t,e,r,c);for(var h=e.showarrow,p=["x","y"],d=[-10,-30],g={_fullLayout:r},m=0;m<2;m++){var v=p[m],y=i.coerceRef(t,e,g,v,"","paper");if(i.coercePosition(e,g,c,y,v,.5),h){var x="a"+v,b=i.coerceRef(t,e,g,x,"pixel");"pixel"!==b&&b!==y&&(b=e[x]="pixel");var _="pixel"===b?d[m]:.4;i.coercePosition(e,g,c,b,x,_)}c(v+"anchor"),c(v+"shift")}if(n.noneOrAll(t,e,["x","y"]),h&&n.noneOrAll(t,e,["ax","ay"]),f){var w=c("xclick"),k=c("yclick");e._xclick=void 0===w?e.x:i.cleanPosition(w,g,e.xref),e._yclick=void 0===k?e.y:i.cleanPosition(k,g,e.yref)}return e}},{"../../lib":660,"../../plots/cartesian/axes":706,"./attributes":515,"./common_defaults":518}],514:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{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,noRotate:!0},{path:"M2,2V-2H-2V2Z",backoff:0,noRotate:!0}]},{}],515:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0,editType:"calcIfAutorange+arraydraw"},text:{valType:"string",editType:"calcIfAutorange+arraydraw"},textangle:{valType:"angle",dflt:0,editType:"calcIfAutorange+arraydraw"},font:i({editType:"calcIfAutorange+arraydraw",colorEditType:"arraydraw"}),width:{valType:"number",min:1,dflt:null,editType:"calcIfAutorange+arraydraw"},height:{valType:"number",min:1,dflt:null,editType:"calcIfAutorange+arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},align:{valType:"enumerated",values:["left","center","right"],dflt:"center",editType:"arraydraw"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",editType:"arraydraw"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},borderpad:{valType:"number",min:0,dflt:1,editType:"calcIfAutorange+arraydraw"},borderwidth:{valType:"number",min:0,dflt:1,editType:"calcIfAutorange+arraydraw"},showarrow:{valType:"boolean",dflt:!0,editType:"calcIfAutorange+arraydraw"},arrowcolor:{valType:"color",editType:"arraydraw"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},startarrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},arrowside:{valType:"flaglist",flags:["end","start"],extras:["none"],dflt:"end",editType:"arraydraw"},arrowsize:{valType:"number",min:.3,dflt:1,editType:"calcIfAutorange+arraydraw"},startarrowsize:{valType:"number",min:.3,dflt:1,editType:"calcIfAutorange+arraydraw"},arrowwidth:{valType:"number",min:.1,editType:"calcIfAutorange+arraydraw"},standoff:{valType:"number",min:0,dflt:0,editType:"calcIfAutorange+arraydraw"},startstandoff:{valType:"number",min:0,dflt:0,editType:"calcIfAutorange+arraydraw"},ax:{valType:"any",editType:"calcIfAutorange+arraydraw"},ay:{valType:"any",editType:"calcIfAutorange+arraydraw"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()],editType:"calc"},x:{valType:"any",editType:"calcIfAutorange+arraydraw"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",editType:"calcIfAutorange+arraydraw"},xshift:{valType:"number",dflt:0,editType:"calcIfAutorange+arraydraw"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()],editType:"calc"},y:{valType:"any",editType:"calcIfAutorange+arraydraw"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"calcIfAutorange+arraydraw"},yshift:{valType:"number",dflt:0,editType:"calcIfAutorange+arraydraw"},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1,editType:"arraydraw"},xclick:{valType:"any",editType:"arraydraw"},yclick:{valType:"any",editType:"arraydraw"},hovertext:{valType:"string",editType:"arraydraw"},hoverlabel:{bgcolor:{valType:"color",editType:"arraydraw"},bordercolor:{valType:"color",editType:"arraydraw"},font:i({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}}},{"../../plots/cartesian/constants":711,"../../plots/font_attributes":732,"./arrow_paths":514}],516:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./draw").draw;function o(t){var e=t._fullLayout;n.filterVisible(e.annotations).forEach(function(e){var r,n,a,o,s=i.getFromId(t,e.xref),l=i.getFromId(t,e.yref),c=3*e.arrowsize*e.arrowwidth||0,u=3*e.startarrowsize*e.arrowwidth||0;s&&s.autorange&&(r=c+e.xshift,n=c-e.xshift,a=u+e.xshift,o=u-e.xshift,e.axref===e.xref?(i.expand(s,[s.r2c(e.x)],{ppadplus:r,ppadminus:n}),i.expand(s,[s.r2c(e.ax)],{ppadplus:Math.max(e._xpadplus,a),ppadminus:Math.max(e._xpadminus,o)})):(a=e.ax?a+e.ax:a,o=e.ax?o-e.ax:o,i.expand(s,[s.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r,a),ppadminus:Math.max(e._xpadminus,n,o)}))),l&&l.autorange&&(r=c-e.yshift,n=c+e.yshift,a=u-e.yshift,o=u+e.yshift,e.ayref===e.yref?(i.expand(l,[l.r2c(e.y)],{ppadplus:r,ppadminus:n}),i.expand(l,[l.r2c(e.ay)],{ppadplus:Math.max(e._ypadplus,a),ppadminus:Math.max(e._ypadminus,o)})):(a=e.ay?a+e.ay:a,o=e.ay?o-e.ay:o,i.expand(l,[l.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r,a),ppadminus:Math.max(e._ypadminus,n,o)})))})}e.exports=function(t){var e=t._fullLayout,r=n.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};for(var l in r.forEach(function(t){s[t.xref]=1,s[t.yref]=1}),s){var c=i.getFromId(t,l);if(c&&c.autorange)return n.syncOrAsync([a,o],t)}}}},{"../../lib":660,"../../plots/cartesian/axes":706,"./draw":521}],517:[function(t,e,r){"use strict";var n=t("../../registry");function i(t,e){var r,n,i,o,s,l,c,u=t._fullLayout.annotations,f=[],h=[],p=[],d=(e||[]).length;for(r=0;r0||r.explicitOff.length>0},onClick:function(t,e){var r,a=i(t,e),o=a.on,s=a.off.concat(a.explicitOff),l={};if(!o.length&&!s.length)return;for(r=0;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}e._w=I,e._h=B;for(var V=!1,U=["x","y"],q=0;q1)&&(K===J?((ot=Q.r2fraction(e["a"+Z]))<0||ot>1)&&(V=!0):V=!0,V))continue;H=Q._offset+Q.r2p(e[Z]),Y=.5}else"x"===Z?(W=e[Z],H=x.l+x.w*W):(W=1-e[Z],H=x.t+x.h*W),Y=e.showarrow?.5:W;if(e.showarrow){at.head=H;var st=e["a"+Z];X=tt*j(.5,e.xanchor)-et*j(.5,e.yanchor),K===J?(at.tail=Q._offset+Q.r2p(st),G=X):(at.tail=H+st,G=X+st),at.text=at.tail+X;var lt=y["x"===Z?"width":"height"];if("paper"===J&&(at.head=o.constrain(at.head,1,lt-1)),"pixel"===K){var ct=-Math.max(at.tail-3,at.text),ut=Math.min(at.tail+3,at.text)-lt;ct>0?(at.tail+=ct,at.text+=ct):ut>0&&(at.tail-=ut,at.text-=ut)}at.tail+=it,at.head+=it}else G=X=rt*j(Y,nt),at.text=H+X;at.text+=it,X+=it,G+=it,e["_"+Z+"padplus"]=rt/2+G,e["_"+Z+"padminus"]=rt/2-G,e["_"+Z+"size"]=rt,e["_"+Z+"shift"]=X}if(V)C.remove();else{var ft=0,ht=0;if("left"!==e.align&&(ft=(I-S)*("center"===e.align?.5:1)),"top"!==e.valign&&(ht=(B-L)*("middle"===e.valign?.5:1)),u)n.select("svg").attr({x:z+ft-1,y:z+ht}).call(c.setClipUrl,D?_:null);else{var pt=z+ht-m.top,dt=z+ft-m.left;R.call(f.positionText,dt,pt).call(c.setClipUrl,D?_:null)}O.select("rect").call(c.setRect,z,z,I,B),P.call(c.setRect,E/2,E/2,F-E,N-E),C.call(c.setTranslate,Math.round(w.x.text-F/2),Math.round(w.y.text-N/2)),A.attr({transform:"rotate("+k+","+w.x.text+","+w.y.text+")"});var gt,mt,vt=function(r,n){M.selectAll(".annotation-arrow-g").remove();var u=w.x.head,f=w.y.head,h=w.x.tail+r,m=w.y.tail+n,y=w.x.text+r,_=w.y.text+n,T=o.rotationXYMatrix(k,y,_),S=o.apply2DTransform(T),E=o.apply2DTransform2(T),L=+P.attr("width"),z=+P.attr("height"),D=y-.5*L,O=D+L,I=_-.5*z,R=I+z,B=[[D,I,D,R],[D,R,O,R],[O,R,O,I],[O,I,D,I]].map(E);if(!B.reduce(function(t,e){return t^!!o.segmentsIntersect(u,f,u+1e6,f+1e6,e[0],e[1],e[2],e[3])},!1)){B.forEach(function(t){var e=o.segmentsIntersect(h,m,u,f,t[0],t[1],t[2],t[3]);e&&(h=e.x,m=e.y)});var F=e.arrowwidth,N=e.arrowcolor,j=e.arrowside,V=M.append("g").style({opacity:l.opacity(N)}).classed("annotation-arrow-g",!0),U=V.append("path").attr("d","M"+h+","+m+"L"+u+","+f).style("stroke-width",F+"px").call(l.stroke,l.rgb(N));if(d(U,j,e),b.annotationPosition&&U.node().parentNode&&!a){var q=u,H=f;if(e.standoff){var G=Math.sqrt(Math.pow(u-h,2)+Math.pow(f-m,2));q+=e.standoff*(h-u)/G,H+=e.standoff*(m-f)/G}var W,Y,X,Z=V.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).classed("cursor-move",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(h-q)+","+(m-H),transform:"translate("+q+","+H+")"}).style("stroke-width",F+6+"px").call(l.stroke,"rgba(0,0,0,0)").call(l.fill,"rgba(0,0,0,0)");p.init({element:Z.node(),gd:t,prepFn:function(){var t=c.getTranslate(C);Y=t.x,X=t.y,W={},s&&s.autorange&&(W[s._name+".autorange"]=!0),g&&g.autorange&&(W[g._name+".autorange"]=!0)},moveFn:function(t,r){var n=S(Y,X),i=n[0]+t,a=n[1]+r;C.call(c.setTranslate,i,a),W[v+".x"]=s?s.p2r(s.r2p(e.x)+t):e.x+t/x.w,W[v+".y"]=g?g.p2r(g.r2p(e.y)+r):e.y-r/x.h,e.axref===e.xref&&(W[v+".ax"]=s.p2r(s.r2p(e.ax)+t)),e.ayref===e.yref&&(W[v+".ay"]=g.p2r(g.r2p(e.ay)+r)),V.attr("transform","translate("+t+","+r+")"),A.attr({transform:"rotate("+k+","+i+","+a+")"})},doneFn:function(){i.call("relayout",t,W);var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&vt(0,0),T)p.init({element:C.node(),gd:t,prepFn:function(){mt=A.attr("transform"),gt={}},moveFn:function(t,r){var n="pointer";if(e.showarrow)e.axref===e.xref?gt[v+".ax"]=s.p2r(s.r2p(e.ax)+t):gt[v+".ax"]=e.ax+t,e.ayref===e.yref?gt[v+".ay"]=g.p2r(g.r2p(e.ay)+r):gt[v+".ay"]=e.ay+r,vt(t,r);else{if(a)return;if(s)gt[v+".x"]=s.p2r(s.r2p(e.x)+t);else{var i=e._xsize/x.w,o=e.x+(e._xshift-e.xshift)/x.w-i/2;gt[v+".x"]=p.align(o+t/x.w,i,0,1,e.xanchor)}if(g)gt[v+".y"]=g.p2r(g.r2p(e.y)+r);else{var l=e._ysize/x.h,c=e.y-(e._yshift+e.yshift)/x.h-l/2;gt[v+".y"]=p.align(c-r/x.h,l,0,1,e.yanchor)}s&&g||(n=p.getCursor(s?.5:gt[v+".x"],g?.5:gt[v+".y"],e.xanchor,e.yanchor))}A.attr({transform:"translate("+t+","+r+")"+mt}),h(C,n)},doneFn:function(){h(C),i.call("relayout",t,gt);var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}}e.exports={draw:function(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r=0,m=e.indexOf("end")>=0,v=f.backoff*p+r.standoff,y=h.backoff*d+r.startstandoff;if("line"===u.nodeName){o={x:+t.attr("x1"),y:+t.attr("y1")},s={x:+t.attr("x2"),y:+t.attr("y2")};var x=o.x-s.x,b=o.y-s.y;if(c=(l=Math.atan2(b,x))+Math.PI,v&&y&&v+y>Math.sqrt(x*x+b*b))return void z();if(v){if(v*v>x*x+b*b)return void z();var _=v*Math.cos(l),w=v*Math.sin(l);s.x+=_,s.y+=w,t.attr({x2:s.x,y2:s.y})}if(y){if(y*y>x*x+b*b)return void z();var k=y*Math.cos(l),M=y*Math.sin(l);o.x-=k,o.y-=M,t.attr({x1:o.x,y1:o.y})}}else if("path"===u.nodeName){var A=u.getTotalLength(),T="";if(A1){c=!0;break}}c?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+s+'"]').remove():(l._pdata=i(t.glplot.cameraParams,[e.xaxis.r2l(l.x)*r[0],e.yaxis.r2l(l.y)*r[1],e.zaxis.r2l(l.z)*r[2]]),n(t.graphDiv,l,s,t.id,l._xa,l._ya))}}},{"../../plots/gl3d/project":757,"../annotations/draw":521}],528:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib");e.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:t("./attributes")}}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),includeBasePlot:function(t,e){var r=n.subplotsRegistry.gl3d;if(!r)return;for(var a=r.attrRegex,o=Object.keys(t),s=0;s=0))return t;if(3===o)n[o]>1&&(n[o]=1);else if(n[o]>=1)return t}var s=Math.round(255*n[0])+", "+Math.round(255*n[1])+", "+Math.round(255*n[2]);return a?"rgba("+s+", "+n[3]+")":"rgb("+s+")"}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(n(t))},a.opacity=function(t){return t?n(t).getAlpha():0},a.addOpacity=function(t,e){var r=n(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},a.combine=function(t,e){var r=n(t).toRgb();if(1===r.a)return n(t).toRgbString();var i=n(e||l).toRgb(),a=1===i.a?i:{r:255*(1-i.a)+i.r*i.a,g:255*(1-i.a)+i.g*i.a,b:255*(1-i.a)+i.b*i.a},o={r:a.r*(1-r.a)+r.r*r.a,g:a.g*(1-r.a)+r.g*r.a,b:a.b*(1-r.a)+r.b*r.a};return n(o).toRgbString()},a.contrast=function(t,e,r){var i=n(t);return 1!==i.getAlpha()&&(i=n(a.combine(t,l))),(i.isDark()?e?i.lighten(e):l:r?i.darken(r):s).toString()},a.stroke=function(t,e){var r=n(e);t.style({stroke:a.tinyRGB(r),"stroke-opacity":r.getAlpha()})},a.fill=function(t,e){var r=n(e);t.style({fill:a.tinyRGB(r),"fill-opacity":r.getAlpha()})},a.clean=function(t){if(t&&"object"==typeof t){var e,r,n,i,o=Object.keys(t);for(e=0;e0?A>=P:A<=P));T++)A>O&&A0?A>=P:A<=P));T++)A>S[0]&&A1){var nt=Math.pow(10,Math.floor(Math.log(rt)/Math.LN10));tt*=nt*c.roundUp(rt/nt,[2,5,10]),(Math.abs(r.levels.start)/r.levels.size+1e-6)%1<2e-6&&(Q.tick0=0)}Q.dtick=tt}Q.domain=[X+G,X+U-G],Q.setScale();var it=c.ensureSingle(b._infolayer,"g",e,function(t){t.classed(_.colorbar,!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),t.select(".cbtitle").datum(0)})});it.attr("transform","translate("+Math.round(M.l)+","+Math.round(M.t)+")");var at=it.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(M.l)+",-"+Math.round(M.t)+")");Q._axislayer=it.select(".cbaxis");var ot=0;if(-1!==["top","bottom"].indexOf(r.titleside)){var st,lt=M.l+(r.x+q)*M.w,ct=Q.titlefont.size;st="top"===r.titleside?(1-(X+U-G))*M.h+M.t+3+.75*ct:(1-(X+G))*M.h+M.t-3-.25*ct,gt(Q._id+"title",{attributes:{x:lt,y:st,"text-anchor":"start"}})}var ut,ft,ht,pt=c.syncOrAsync([a.previousPromises,function(){if(-1!==["top","bottom"].indexOf(r.titleside)){var e=it.select(".cbtitle"),a=e.select("text"),o=[-r.outlinewidth/2,r.outlinewidth/2],l=e.select(".h"+Q._id+"title-math-group").node(),u=15.6;if(a.node()&&(u=parseInt(a.node().style.fontSize,10)*m),l?(ot=h.bBox(l).height)>u&&(o[1]-=(ot-u)/2):a.node()&&!a.classed(_.jsPlaceholder)&&(ot=h.bBox(a.node()).height),ot){if(ot+=5,"top"===r.titleside)Q.domain[1]-=ot/M.h,o[1]*=-1;else{Q.domain[0]+=ot/M.h;var f=g.lineCount(a);o[1]+=(1-f)*u}e.attr("transform","translate("+o+")"),Q.setScale()}}it.selectAll(".cbfills,.cblines").attr("transform","translate(0,"+Math.round(M.h*(1-Q.domain[1]))+")"),Q._axislayer.attr("transform","translate(0,"+Math.round(-M.t)+")");var p=it.select(".cbfills").selectAll("rect.cbfill").data(E);p.enter().append("rect").classed(_.cbfill,!0).style("stroke","none"),p.exit().remove(),p.each(function(t,e){var r=[0===e?S[0]:(E[e]+E[e-1])/2,e===E.length-1?S[1]:(E[e]+E[e+1])/2].map(Q.c2p).map(Math.round);e!==E.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=z(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:W,width:Math.max(N,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var d=it.select(".cblines").selectAll("path.cbline").data(r.line.color&&r.line.width?C:[]);return d.enter().append("path").classed(_.cbline,!0),d.exit().remove(),d.each(function(t){n.select(this).attr("d","M"+W+","+(Math.round(Q.c2p(t))+r.line.width/2%1)+"h"+N).call(h.lineGroupStyle,r.line.width,L(t),r.line.dash)}),Q._axislayer.selectAll("g."+Q._id+"tick,path").remove(),Q._pos=W+N+(r.outlinewidth||0)/2-("outside"===r.ticks?1:0),Q.side="right",c.syncOrAsync([function(){return s.doTicksSingle(t,Q,!0)},function(){if(-1===["top","bottom"].indexOf(r.titleside)){var e=Q.titlefont.size,i=Q._offset+Q._length/2,a=M.l+(Q.position||0)*M.w+("right"===Q.side?10+e*(Q.showticklabels?1:.5):-10-e*(Q.showticklabels?.5:0));gt("h"+Q._id+"title",{avoid:{selection:n.select(t).selectAll("g."+Q._id+"tick"),side:r.titleside,offsetLeft:M.l,offsetTop:0,maxShift:b.width},attributes:{x:a,y:i,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])},a.previousPromises,function(){var n=N+r.outlinewidth/2+h.bBox(Q._axislayer.node()).width;if((R=at.select("text")).node()&&!R.classed(_.jsPlaceholder)){var i,o=at.select(".h"+Q._id+"title-math-group").node();i=o&&-1!==["top","bottom"].indexOf(r.titleside)?h.bBox(o).width:h.bBox(at.node()).right-W-M.l,n=Math.max(n,i)}var s=2*r.xpad+n+r.borderwidth+r.outlinewidth/2,l=Z-J;it.select(".cbbg").attr({x:W-r.xpad-(r.borderwidth+r.outlinewidth)/2,y:J-H,width:Math.max(s,2),height:Math.max(l+2*H,2)}).call(p.fill,r.bgcolor).call(p.stroke,r.bordercolor).style({"stroke-width":r.borderwidth}),it.selectAll(".cboutline").attr({x:W,y:J+r.ypad+("top"===r.titleside?ot:0),width:Math.max(N,2),height:Math.max(l-2*r.ypad-ot,2)}).call(p.stroke,r.outlinecolor).style({fill:"None","stroke-width":r.outlinewidth});var c=({center:.5,right:1}[r.xanchor]||0)*s;it.attr("transform","translate("+(M.l-c)+","+M.t+")"),a.autoMargin(t,e,{x:r.x,y:r.y,l:s*({right:1,center:.5}[r.xanchor]||0),r:s*({left:1,center:.5}[r.xanchor]||0),t:l*({bottom:1,middle:.5}[r.yanchor]||0),b:l*({top:1,middle:.5}[r.yanchor]||0)})}],t);if(pt&&pt.then&&(t._promises||[]).push(pt),t._context.edits.colorbarPosition)l.init({element:it.node(),gd:t,prepFn:function(){ut=it.attr("transform"),f(it)},moveFn:function(t,e){it.attr("transform",ut+" translate("+t+","+e+")"),ft=l.align(Y+t/M.w,j,0,1,r.xanchor),ht=l.align(X-e/M.h,U,0,1,r.yanchor);var n=l.getCursor(ft,ht,r.xanchor,r.yanchor);f(it,n)},doneFn:function(){f(it),void 0!==ft&&void 0!==ht&&o.call("restyle",t,{"colorbar.x":ft,"colorbar.y":ht},k().index)}});return pt}function dt(t,e){return c.coerce(K,Q,x,t,e)}function gt(e,r){var n,i=k();n=o.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:Q,propName:n,traceIndex:i.index,placeholder:b._dfltTitle.colorbar,containerGroup:it.select(".cbtitle")},s="h"===e.charAt(0)?e.substr(1):"h"+e;it.selectAll("."+s+",."+s+"-math-group").remove(),d.draw(t,e,u(a,r||{}))}b._infolayer.selectAll("g."+e).remove()}function k(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,s.reversescale?a(y):y),l.autocolorscale||f("autocolorscale",!1))}},{"../../lib":660,"./flip_scale":544,"./scales":551}],540:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendFlat;t("./scales.js");e.exports=function(t,e,r){return{color:{valType:"color",arrayOk:!0,editType:e||"style"},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{impliedEdits:{cmin:void 0,cmax:void 0}}),cmax:i({},n.zmax,{editType:e||n.zmax.editType,impliedEdits:{cauto:!1}}),cmin:i({},n.zmin,{editType:e||n.zmin.editType,impliedEdits:{cauto:!1}}),autocolorscale:i({},n.autocolorscale,{dflt:!1===r?r:n.autocolorscale.dflt}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":649,"./attributes":538,"./scales.js":551}],541:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":551}],542:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../colorbar/has_colorbar"),o=t("../colorbar/defaults"),s=t("./is_valid_scale"),l=t("./flip_scale");e.exports=function(t,e,r,c,u){var f,h=u.prefix,p=u.cLetter,d=h.slice(0,h.length-1),g=h?i.nestedProperty(t,d).get()||{}:t,m=h?i.nestedProperty(e,d).get()||{}:e,v=g[p+"min"],y=g[p+"max"],x=g.colorscale;c(h+p+"auto",!(n(v)&&n(y)&&v=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],545:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./default_scale"),a=t("./is_valid_scale_array");e.exports=function(t,e){if(e||(e=i),!t)return e;function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return"string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e}},{"./default_scale":541,"./is_valid_scale_array":549,"./scales":551}],546:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("./is_valid_scale");e.exports=function(t,e){var r=e?i.nestedProperty(t,e).get()||{}:t,o=r.color,s=!1;if(i.isArrayOrTypedArray(o))for(var l=0;l4/3-s?o:s}},{}],553:[function(t,e,r){"use strict";var n=t("../../lib"),i=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function(t,e,r,a){return t="left"===r?0:"center"===r?1:"right"===r?2:n.constrain(Math.floor(3*t),0,2),e="bottom"===a?0:"middle"===a?1:"top"===a?2:n.constrain(Math.floor(3*e),0,2),i[e][t]}},{"../../lib":660}],554:[function(t,e,r){"use strict";var n=t("mouse-event-offset"),i=t("has-hover"),a=t("has-passive-events"),o=t("../../registry"),s=t("../../lib"),l=t("../../plots/cartesian/constants"),c=t("../../constants/interactions"),u=e.exports={};u.align=t("./align"),u.getCursor=t("./cursor");var f=t("./unhover");function h(){var t=document.createElement("div");t.className="dragcover";var e=t.style;return e.position="fixed",e.left=0,e.right=0,e.top=0,e.bottom=0,e.zIndex=999999999,e.background="none",document.body.appendChild(t),t}function p(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}u.unhover=f.wrapped,u.unhoverRaw=f.raw,u.init=function(t){var e,r,n,f,d,g,m,v,y=t.gd,x=1,b=c.DBLCLICKDELAY,_=t.element;y._mouseDownTime||(y._mouseDownTime=0),_.style.pointerEvents="all",_.onmousedown=k,a?(_._ontouchstart&&_.removeEventListener("touchstart",_._ontouchstart),_._ontouchstart=k,_.addEventListener("touchstart",k,{passive:!1})):_.ontouchstart=k;var w=t.clampFn||function(t,e,r){return Math.abs(t)b&&(x=Math.max(x-1,1)),y._dragged)t.doneFn&&t.doneFn();else if(t.clickFn&&t.clickFn(x,g),!v){var r;try{r=new MouseEvent("click",e)}catch(t){var n=p(e);(r=document.createEvent("MouseEvents")).initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,n[0],n[1],e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}m.dispatchEvent(r)}!function(t){t._dragging=!1,t._replotPending&&o.call("plot",t)}(y),y._dragged=!1}else y._dragged=!1}},u.coverSlip=h},{"../../constants/interactions":636,"../../lib":660,"../../plots/cartesian/constants":711,"../../registry":790,"./align":552,"./cursor":553,"./unhover":555,"has-hover":354,"has-passive-events":355,"mouse-event-offset":379}],555:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=t("../../lib/throttle"),a=t("../../lib/get_graph_div"),o=t("../fx/constants"),s=e.exports={};s.wrapped=function(t,e,r){(t=a(t))._fullLayout&&i.clear(t._fullLayout._uid+o.HOVERID),s.raw(t,e,r)},s.raw=function(t,e){var r=t._fullLayout,i=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&i&&t.emit("plotly_unhover",{event:e,points:i}))}},{"../../lib/events":648,"../../lib/get_graph_div":655,"../../lib/throttle":685,"../fx/constants":569}],556:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],557:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../../registry"),s=t("../color"),l=t("../colorscale"),c=t("../../lib"),u=t("../../lib/svg_text_utils"),f=t("../../constants/xmlns_namespaces"),h=t("../../constants/alignment").LINE_SPACING,p=t("../../constants/interactions").DESELECTDIM,d=t("../../traces/scatter/subtypes"),g=t("../../traces/scatter/make_bubble_size_func"),m=e.exports={};m.font=function(t,e,r,n){c.isPlainObject(e)&&(n=e.color,r=e.size,e=e.family),e&&t.style("font-family",e),r+1&&t.style("font-size",r+"px"),n&&t.call(s.fill,n)},m.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},m.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},m.setRect=function(t,e,r,n,i){t.call(m.setPosition,e,r).call(m.setSize,n,i)},m.translatePoint=function(t,e,r,n){var a=r.c2p(t.x),o=n.c2p(t.y);return!!(i(a)&&i(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0)},m.translatePoints=function(t,e,r){t.each(function(t){var i=n.select(this);m.translatePoint(t,i,e,r)})},m.hideOutsideRangePoint=function(t,e,r,n,i,a){e.attr("display",r.isPtWithinRange(t,i)&&n.isPtWithinRange(t,a)?null:"none")},m.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,i=e.yaxis;t.each(function(e){var a=e[0].trace,o=a.xcalendar,s=a.ycalendar,l="bar"===a.type?".bartext":".point,.textpoint";t.selectAll(l).each(function(t){m.hideOutsideRangePoint(t,n.select(this),r,i,o,s)})})}},m.crispRound=function(t,e,r){return e&&i(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},m.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,l=i||a.dash||"";s.stroke(e,n||a.color),m.dashLine(e,l,o)},m.lineGroupStyle=function(t,e,r,i){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=e||a.width||0,l=i||a.dash||"";n.select(this).call(s.stroke,r||a.color).call(m.dashLine,l,o)})},m.dashLine=function(t,e,r){r=+r||0,e=m.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},m.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);return"solid"===t?t="":"dot"===t?t=r+"px,"+r+"px":"dash"===t?t=3*r+"px,"+3*r+"px":"longdash"===t?t=5*r+"px,"+5*r+"px":"dashdot"===t?t=3*r+"px,"+r+"px,"+r+"px,"+r+"px":"longdashdot"===t&&(t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"),t},m.singleFillStyle=function(t){var e=(((n.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(s.fill,e)},m.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=n.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(e){c.error(e,t),r.remove()}})};var v=t("./symbol_defs");m.symbolNames=[],m.symbolFuncs=[],m.symbolNeedLines={},m.symbolNoDot={},m.symbolNoFill={},m.symbolList=[],Object.keys(v).forEach(function(t){var e=v[t];m.symbolList=m.symbolList.concat([e.n,t,e.n+100,t+"-open"]),m.symbolNames[e.n]=t,m.symbolFuncs[e.n]=e.f,e.needLine&&(m.symbolNeedLines[e.n]=!0),e.noDot?m.symbolNoDot[e.n]=!0:m.symbolList=m.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"]),e.noFill&&(m.symbolNoFill[e.n]=!0)});var y=m.symbolNames.length,x="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";function b(t,e){var r=t%100;return m.symbolFuncs[r](e)+(t>=200?x:"")}m.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=m.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=y||t>=400?0:Math.floor(Math.max(t,0))};var _={x1:1,x2:0,y1:0,y2:0},w={x1:0,x2:0,y1:1,y2:0};m.gradient=function(t,e,r,i,o,l){var u=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([i+o+l],c.identity);u.exit().remove(),u.enter().append("radial"===i?"radialGradient":"linearGradient").each(function(){var t=n.select(this);"horizontal"===i?t.attr(_):"vertical"===i&&t.attr(w),t.attr("id",r);var e=a(o),c=a(l);t.append("stop").attr({offset:"0%","stop-color":s.tinyRGB(c),"stop-opacity":c.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":s.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},m.initGradients=function(t){c.ensureSingle(t._fullLayout._defs,"g","gradients").selectAll("linearGradient,radialGradient").remove()},m.pointStyle=function(t,e,r){if(t.size()){var i=m.makePointStyleFns(e);t.each(function(t){m.singlePointStyle(t,n.select(this),e,i,r)})}},m.singlePointStyle=function(t,e,r,n,i){var a=r.marker,o=a.line;if(e.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(t):void 0===t.mo?a.opacity:t.mo),n.ms2mrc){var l;l="various"===t.ms||"various"===a.size?3:n.ms2mrc(t.ms),t.mrc=l,n.selectedSizeFn&&(l=t.mrc=n.selectedSizeFn(t));var u=m.symbolNumber(t.mx||a.symbol)||0;t.om=u%200>=100,e.attr("d",b(u,l))}var f,h,p,d=!1;if(t.so?(p=o.outlierwidth,h=o.outliercolor,f=a.outliercolor):(p=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,h="mlc"in t?t.mlcc=n.lineScale(t.mlc):c.isArrayOrTypedArray(o.color)?s.defaultLine:o.color,c.isArrayOrTypedArray(a.color)&&(f=s.defaultLine,d=!0),f="mc"in t?t.mcc=n.markerScale(t.mc):a.color||"rgba(0,0,0,0)",n.selectedColorFn&&(f=n.selectedColorFn(t))),t.om)e.call(s.stroke,f).style({"stroke-width":(p||1)+"px",fill:"none"});else{e.style("stroke-width",p+"px");var g=a.gradient,v=t.mgt;if(v?d=!0:v=g&&g.type,v&&"none"!==v){var y=t.mgc;y?d=!0:y=g.color;var x="g"+i._fullLayout._uid+"-"+r.uid;d&&(x+="-"+t.i),e.call(m.gradient,i,x,v,f,y)}else e.call(s.fill,f);p&&e.call(s.stroke,h)}},m.makePointStyleFns=function(t){var e={},r=t.marker;return e.markerScale=m.tryColorscale(r,""),e.lineScale=m.tryColorscale(r,"line"),o.traceIs(t,"symbols")&&(e.ms2mrc=d.isBubble(t)?g(t):function(){return(r.size||6)/2}),t.selectedpoints&&c.extendFlat(e,m.makeSelectedPointStyleFns(t)),e},m.makeSelectedPointStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},i=t.marker||{},a=r.marker||{},s=n.marker||{},l=i.opacity,u=a.opacity,f=s.opacity,h=void 0!==u,d=void 0!==f;(c.isArrayOrTypedArray(l)||h||d)&&(e.selectedOpacityFn=function(t){var e=void 0===t.mo?i.opacity:t.mo;return t.selected?h?u:e:d?f:p*e});var g=i.color,m=a.color,v=s.color;(m||v)&&(e.selectedColorFn=function(t){var e=t.mcc||g;return t.selected?m||e:v||e});var y=i.size,x=a.size,b=s.size,_=void 0!==x,w=void 0!==b;return o.traceIs(t,"symbols")&&(_||w)&&(e.selectedSizeFn=function(t){var e=t.mrc||y/2;return t.selected?_?x/2:e:w?b/2:e}),e},m.makeSelectedTextStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},i=t.textfont||{},a=r.textfont||{},o=n.textfont||{},l=i.color,c=a.color,u=o.color;return e.selectedTextColorFn=function(t){var e=t.tc||l;return t.selected?c||e:u||(c?e:s.addOpacity(e,p))},e},m.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=m.makeSelectedPointStyleFns(e),i=e.marker||{},a=[];r.selectedOpacityFn&&a.push(function(t,e){t.style("opacity",r.selectedOpacityFn(e))}),r.selectedColorFn&&a.push(function(t,e){s.fill(t,r.selectedColorFn(e))}),r.selectedSizeFn&&a.push(function(t,e){var n=e.mx||i.symbol||0,a=r.selectedSizeFn(e);t.attr("d",b(m.symbolNumber(n),a)),e.mrc2=a}),a.length&&t.each(function(t){for(var e=n.select(this),r=0;r0?r:0}m.textPointStyle=function(t,e,r){if(t.size()){var i;if(e.selectedpoints){var a=m.makeSelectedTextStyleFns(e);i=a.selectedTextColorFn}t.each(function(t){var a=n.select(this),o=c.extractOption(t,e,"tx","text");if(o){var s=t.tp||e.textposition,l=A(t,e),f=i?i(t):t.tc||e.textfont.color;a.call(m.font,t.tf||e.textfont.family,l,f).text(o).call(u.convertToTspans,r).call(M,s,l,t.mrc)}else a.remove()})}},m.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=m.makeSelectedTextStyleFns(e);t.each(function(t){var i=n.select(this),a=r.selectedTextColorFn(t),o=t.tp||e.textposition,l=A(t,e);s.fill(i,a),M(i,o,l,t.mrc2||t.mrc)})}};var T=.5;function S(t,e,r,i){var a=t[0]-e[0],o=t[1]-e[1],s=r[0]-e[0],l=r[1]-e[1],c=Math.pow(a*a+o*o,T/2),u=Math.pow(s*s+l*l,T/2),f=(u*u*a-c*c*s)*i,h=(u*u*o-c*c*l)*i,p=3*u*(c+u),d=3*c*(c+u);return[[n.round(e[0]+(p&&f/p),2),n.round(e[1]+(p&&h/p),2)],[n.round(e[0]-(d&&f/d),2),n.round(e[1]-(d&&h/d),2)]]}m.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],i=[];for(r=1;r=1e4&&(m.savedBBoxes={},L=0),r&&(m.savedBBoxes[r]=v),L++,c.extendFlat({},v)},m.setClipUrl=function(t,e){if(e){if(void 0===m.baseUrl){var r=n.select("base");r.size()&&r.attr("href")?m.baseUrl=window.location.href.split("#")[0]:m.baseUrl=""}t.attr("clip-path","url("+m.baseUrl+"#"+e+")")}else t.attr("clip-path",null)},m.getTranslate=function(t){var e=(t[t.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+e[0]||0,y:+e[1]||0}},m.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||0,r=r||0,a=a.replace(/(\btranslate\(.*?\);?)/,"").trim(),a=(a+=" translate("+e+", "+r+")").trim(),t[i]("transform",a),a},m.getScale=function(t){var e=(t[t.attr?"attr":"getAttribute"]("transform")||"").replace(/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+e[0]||1,y:+e[1]||1}},m.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||1,r=r||1,a=a.replace(/(\bscale\(.*?\);?)/,"").trim(),a=(a+=" scale("+e+", "+r+")").trim(),t[i]("transform",a),a};var P=/\s*sc.*/;m.setPointGroupScale=function(t,e,r){if(e=e||1,r=r||1,t){var n=1===e&&1===r?"":" scale("+e+","+r+")";t.each(function(){var t=(this.getAttribute("transform")||"").replace(P,"");t=(t+=n).trim(),this.setAttribute("transform",t)})}};var D=/translate\([^)]*\)\s*$/;m.setTextPointsScale=function(t,e,r){t&&t.each(function(){var t,i=n.select(this),a=i.select("text");if(a.node()){var o=parseFloat(a.attr("x")||0),s=parseFloat(a.attr("y")||0),l=(i.attr("transform")||"").match(D);t=1===e&&1===r?[]:["translate("+o+","+s+")","scale("+e+","+r+")","translate("+-o+","+-s+")"],l&&t.push(l),i.attr("transform",t.join(" "))}})}},{"../../constants/alignment":632,"../../constants/interactions":636,"../../constants/xmlns_namespaces":639,"../../lib":660,"../../lib/svg_text_utils":684,"../../registry":790,"../../traces/scatter/make_bubble_size_func":1007,"../../traces/scatter/subtypes":1012,"../color":532,"../colorscale":547,"./symbol_defs":558,d3:131,"fast-isnumeric":197,tinycolor2:473}],558:[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,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+i+a+i+a+o+a+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",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),a=n.round(-.309*t,2);return"M"+e+","+a+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+a+"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),a=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(-.309*e,2),c=n.round(.118*e,2),u=n.round(.809*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+c+"L"+o+","+u+"L0,"+n.round(.382*e,2)+"L-"+o+","+u+"L-"+a+","+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),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+i+o+"-"+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),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+i+o+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,noFill:!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,noFill:!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,noFill:!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,noFill:!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,noFill:!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,noFill:!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,noFill:!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,noFill:!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,noFill:!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,noFill:!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,noFill:!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,noFill:!0}}},{d3:131}],559:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean",editType:"calc"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"],editType:"calc"},symmetric:{valType:"boolean",editType:"calc"},array:{valType:"data_array",editType:"calc"},arrayminus:{valType:"data_array",editType:"calc"},value:{valType:"number",min:0,dflt:10,editType:"calc"},valueminus:{valType:"number",min:0,dflt:10,editType:"calc"},traceref:{valType:"integer",min:0,dflt:0,editType:"style"},tracerefminus:{valType:"integer",min:0,dflt:0,editType:"style"},copy_ystyle:{valType:"boolean",editType:"plot"},copy_zstyle:{valType:"boolean",editType:"style"},color:{valType:"color",editType:"style"},thickness:{valType:"number",min:0,dflt:2,editType:"style"},width:{valType:"number",min:0,editType:"plot"},editType:"calc",_deprecated:{opacity:{valType:"number",editType:"style"}}}},{}],560:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../registry"),a=t("../../plots/cartesian/axes"),o=t("./compute_error");function s(t,e,r,i){var s=e["error_"+i]||{},l=[];if(s.visible&&-1!==["linear","log"].indexOf(r.type)){for(var c=o(s),u=0;u0;t.each(function(t){var u,f=t[0].trace,h=f.error_x||{},p=f.error_y||{};f.ids&&(u=function(t){return t.id});var d=o.hasMarkers(f)&&f.marker.maxdisplayed>0;p.visible||h.visible||(t=[]);var g=n.select(this).selectAll("g.errorbar").data(t,u);if(g.exit().remove(),t.length){h.visible||g.selectAll("path.xerror").remove(),p.visible||g.selectAll("path.yerror").remove(),g.style("opacity",1);var m=g.enter().append("g").classed("errorbar",!0);c&&m.style("opacity",0).transition().duration(r.duration).style("opacity",1),a.setClipUrl(g,e.layerClipId),g.each(function(t){var e=n.select(this),a=function(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};void 0!==t.yh&&(n.yh=r.c2p(t.yh),n.ys=r.c2p(t.ys),i(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),i(n.xs)||(n.noXS=!0,n.xs=e.c2p(t.xs,!0)));return n}(t,s,l);if(!d||t.vis){var o,u=e.select("path.yerror");if(p.visible&&i(a.x)&&i(a.yh)&&i(a.ys)){var f=p.width;o="M"+(a.x-f)+","+a.yh+"h"+2*f+"m-"+f+",0V"+a.ys,a.noYS||(o+="m-"+f+",0h"+2*f),!u.size()?u=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):c&&(u=u.transition().duration(r.duration).ease(r.easing)),u.attr("d",o)}else u.remove();var g=e.select("path.xerror");if(h.visible&&i(a.y)&&i(a.xh)&&i(a.xs)){var m=(h.copy_ystyle?p:h).width;o="M"+a.xh+","+(a.y-m)+"v"+2*m+"m0,-"+m+"H"+a.xs,a.noXS||(o+="m0,-"+m+"v"+2*m),!g.size()?g=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):c&&(g=g.transition().duration(r.duration).ease(r.easing)),g.attr("d",o)}else g.remove()}})}})}},{"../../traces/scatter/subtypes":1012,"../drawing":557,d3:131,"fast-isnumeric":197}],565:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color");e.exports=function(t){t.each(function(t){var e=t[0].trace,r=e.error_y||{},a=e.error_x||{},o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(i.stroke,r.color),a.copy_ystyle&&(a=r),o.selectAll("path.xerror").style("stroke-width",a.thickness+"px").call(i.stroke,a.color)})}},{"../color":532,d3:131}],566:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0,editType:"none"},bordercolor:{valType:"color",arrayOk:!0,editType:"none"},font:n({arrayOk:!0,editType:"none"}),namelength:{valType:"integer",min:-1,arrayOk:!0,editType:"none"},editType:"calc"}}},{"../../plots/font_attributes":732}],567:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry");function a(t,e,r,i){i=i||n.identity,Array.isArray(t)&&(e[0][r]=i(t))}e.exports=function(t){var e=t.calcdata,r=t._fullLayout;function o(t){return function(e){return n.coerceHoverinfo({hoverinfo:e},{_module:t._module},r)}}for(var s=0;s=0&&r.index-1&&o.length>y&&(o=y>3?o.substr(0,y-3)+"...":o.substr(0,y))}void 0!==t.zLabel?(void 0!==t.xLabel&&(c+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(c+="y: "+t.yLabel+"
"),c+=(c?"z: ":"")+t.zLabel):L&&t[i+"Label"]===M?c=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(c=t.yLabel):c=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(c+=(c?"
":"")+t.text),void 0!==t.extraText&&(c+=(c?"
":"")+t.extraText),""===c&&(""===o&&e.remove(),c=o);var x=e.select("text.nums").call(u.font,t.fontFamily||d,t.fontSize||g,t.fontColor||m).text(c).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r),b=e.select("text.name"),_=0;o&&o!==c?(b.call(u.font,t.fontFamily||d,t.fontSize||g,p).text(o).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r),_=b.node().getBoundingClientRect().width+2*k):(b.remove(),e.select("rect").remove()),e.select("path").style({fill:p,stroke:m});var A,T,z=x.node().getBoundingClientRect(),P=t.xa._offset+(t.x0+t.x1)/2,D=t.ya._offset+(t.y0+t.y1)/2,O=Math.abs(t.x1-t.x0),I=Math.abs(t.y1-t.y0),R=z.width+w+k+_;t.ty0=S-z.top,t.bx=z.width+2*k,t.by=z.height+2*k,t.anchor="start",t.txwidth=z.width,t.tx2width=_,t.offset=0,a?(t.pos=P,A=D+I/2+R<=E,T=D-I/2-R>=0,"top"!==t.idealAlign&&A||!T?A?(D+=I/2,t.anchor="start"):t.anchor="middle":(D-=I/2,t.anchor="end")):(t.pos=D,A=P+O/2+R<=C,T=P-O/2-R>=0,"left"!==t.idealAlign&&A||!T?A?(P+=O/2,t.anchor="start"):t.anchor="middle":(P-=O/2,t.anchor="end")),x.attr("text-anchor",t.anchor),_&&b.attr("text-anchor",t.anchor),e.attr("transform","translate("+P+","+D+")"+(a?"rotate("+v+")":""))}),R}function A(t,e){t.each(function(t){var r=n.select(this);if(t.del)r.remove();else{var i="end"===t.anchor?-1:1,a=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],s=o*(w+k),c=s+o*(t.txwidth+k),f=0,h=t.offset;"middle"===t.anchor&&(s-=t.tx2width/2,c+=t.txwidth/2+k),e&&(h*=-_,f=t.offset*b),r.select("path").attr("d","middle"===t.anchor?"M-"+(t.bx/2+t.tx2width/2)+","+(h-t.by/2)+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(i*w+f)+","+(w+h)+"v"+(t.by/2-w)+"h"+i*t.bx+"v-"+t.by+"H"+(i*w+f)+"V"+(h-w)+"Z"),a.call(l.positionText,s+f,h+t.ty0-t.by/2+k),t.tx2width&&(r.select("text.name").call(l.positionText,c+o*k+f,h+t.ty0-t.by/2+k),r.select("rect").call(u.setRect,c+(o-1)*t.tx2width/2+f,h-t.by/2-1,t.tx2width,t.by+2))}})}function T(t,e){var r=t.index,n=t.trace||{},i=t.cd[0],a=t.cd[r]||{},s=Array.isArray(r)?function(t,e){return o.castOption(i,r,t)||o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(a,n,t,e)};function l(e,r,n){var i=s(r,n);i&&(t[e]=i)}if(l("hoverinfo","hi","hoverinfo"),l("color","hbg","hoverlabel.bgcolor"),l("borderColor","hbc","hoverlabel.bordercolor"),l("fontFamily","htf","hoverlabel.font.family"),l("fontSize","hts","hoverlabel.font.size"),l("fontColor","htc","hoverlabel.font.color"),l("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e?t.xa._offset+(t.x0+t.x1)/2:t.ya._offset+(t.y0+t.y1)/2,t.x0=o.constrain(t.x0,0,t.xa._length),t.x1=o.constrain(t.x1,0,t.xa._length),t.y0=o.constrain(t.y0,0,t.ya._length),t.y1=o.constrain(t.y1,0,t.ya._length),void 0!==t.xLabelVal&&(t.xLabel="xLabel"in t?t.xLabel:p.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:p.hoverLabelText(t.ya,t.yLabelVal),t.yVal=t.ya.c2d(t.yLabelVal)),void 0!==t.zLabelVal&&void 0===t.zLabel&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var c=p.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+c+" / -"+p.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+c,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var u=p.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+p.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var f=t.hoverinfo||t.trace.hoverinfo;return"all"!==f&&(-1===(f=Array.isArray(f)?f:f.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===f.indexOf("y")&&(t.yLabel=void 0),-1===f.indexOf("z")&&(t.zLabel=void 0),-1===f.indexOf("text")&&(t.text=void 0),-1===f.indexOf("name")&&(t.name=void 0)),t}function S(t,e){var r,n,i=e.container,o=e.fullLayout,s=e.event,l=!!t.hLinePoint,c=!!t.vLinePoint;if(i.selectAll(".spikeline").remove(),c||l){var h=f.combine(o.plot_bgcolor,o.paper_bgcolor);if(l){var p,d,g=t.hLinePoint;r=g&&g.xa,"cursor"===(n=g&&g.ya).spikesnap?(p=s.pointerX,d=s.pointerY):(p=r._offset+g.x,d=n._offset+g.y);var m,v,y=a.readability(g.color,h)<1.5?f.contrast(h):g.color,x=n.spikemode,b=n.spikethickness,_=n.spikecolor||y,w=n._boundingBox,k=(w.left+w.right)/2w[0]._length||tt<0||tt>k[0]._length)return h.unhoverRaw(t,e)}if(e.pointerX=$+w[0]._offset,e.pointerY=tt+k[0]._offset,I="xval"in e?g.flat(l,e.xval):g.p2c(w,$),R="yval"in e?g.flat(l,e.yval):g.p2c(k,tt),!i(I[0])||!i(R[0]))return o.warn("Fx.hover failed",e,t),h.unhoverRaw(t,e)}var nt=1/0;for(F=0;FY&&(J.splice(0,Y),nt=J[0].distance),y&&0!==Z&&0===J.length){W.distance=Z,W.index=!1;var lt=j._module.hoverPoints(W,H,G,"closest",u._hoverlayer);if(lt&&(lt=lt.filter(function(t){return t.spikeDistance<=Z})),lt&<.length){var ct,ut=lt.filter(function(t){return t.xa.showspikes});if(ut.length){var ft=ut[0];i(ft.x0)&&i(ft.y0)&&(ct=gt(ft),(!Q.vLinePoint||Q.vLinePoint.spikeDistance>ct.spikeDistance)&&(Q.vLinePoint=ct))}var ht=lt.filter(function(t){return t.ya.showspikes});if(ht.length){var pt=ht[0];i(pt.x0)&&i(pt.y0)&&(ct=gt(pt),(!Q.hLinePoint||Q.hLinePoint.spikeDistance>ct.spikeDistance)&&(Q.hLinePoint=ct))}}}}function dt(t,e){for(var r,n=null,i=1/0,a=0;a1,Ct=f.combine(u.plot_bgcolor||f.background,u.paper_bgcolor),Et={hovermode:O,rotateLabels:St,bgColor:Ct,container:u._hoverlayer,outerContainer:u._paperdiv,commonLabelOpts:u.hoverlabel,hoverdistance:u.hoverdistance},Lt=M(J,Et,t);if(function(t,e,r){var n,i,a,o,s,l,c,u=0,f=t.map(function(t,n){var i=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===i._id.charAt(0)?x:1)/2,pmin:0,pmax:"x"===i._id.charAt(0)?r.width:r.height}]}).sort(function(t,e){return t[0].posref-e[0].posref});function h(t){var e=t[0],r=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,a=r.pos+r.dp+r.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(a<.01)){if(i<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=a;n=!1}if(n){var c=0;for(o=0;oe.pmax&&c++;for(o=t.length-1;o>=0&&!(c<=0);o--)(l=t[o]).pos>e.pmax-1&&(l.del=!0,c--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(c<=0);o--)(l=t[o]).pos+l.dp+l.size>e.pmax&&(l.del=!0,c--)}}}for(;!n&&u<=t.length;){for(u++,n=!0,o=0;o.01&&g.pmin===m.pmin&&g.pmax===m.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(p.push.apply(p,d),f.splice(o+1,1),c=0,s=p.length-1;s>=0;s--)c+=p[s].dp;for(a=c/p.length,s=p.length-1;s>=0;s--)p[s].dp-=a;n=!1}else o++}f.forEach(h)}for(o=f.length-1;o>=0;o--){var v=f[o];for(s=v.length-1;s>=0;s--){var y=v[s],b=t[y.i];b.offset=y.dp,b.del=y.del}}}(J,St?"xa":"ya",u),A(Lt,St),e.target&&e.target.tagName){var zt=d.getComponentMethod("annotations","hasClickToShow")(t,At);c(n.select(e.target),zt?"pointer":"")}if(!e.target||a||!function(t,e,r){if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}(t,0,Mt))return;Mt&&t.emit("plotly_unhover",{event:e,points:Mt});t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:w,yaxes:k,xvals:I,yvals:R})}(t,e,r,a)})},r.loneHover=function(t,e){var r={color:t.color||f.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,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},i=n.select(e.container),a=e.outerContainer?n.select(e.outerContainer):i,o={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||f.background,container:i,outerContainer:a},s=M([r],o,e.gd);return A(s,o.rotateLabels),s.node()}},{"../../lib":660,"../../lib/events":648,"../../lib/override_cursor":671,"../../lib/svg_text_utils":684,"../../plots/cartesian/axes":706,"../../registry":790,"../color":532,"../dragelement":554,"../drawing":557,"./constants":569,"./helpers":571,d3:131,"fast-isnumeric":197,tinycolor2:473}],573:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,i){r("hoverlabel.bgcolor",(i=i||{}).bgcolor),r("hoverlabel.bordercolor",i.bordercolor),r("hoverlabel.namelength",i.namelength),n.coerceFont(r,"hoverlabel.font",i.font)}},{"../../lib":660}],574:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../dragelement"),o=t("./helpers"),s=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:s},attributes:t("./attributes"),layoutAttributes:s,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:o.getDistanceFunction,getClosest:o.getClosest,inbox:o.inbox,quadrature:o.quadrature,appendArrayPointValue:o.appendArrayPointValue,castHoverOption:function(t,e,r){return i.castOption(t,e,"hoverlabel."+r)},castHoverinfo:function(t,e,r){return i.castOption(t,r,"hoverinfo",function(r){return i.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)})},hover:t("./hover").hover,unhover:a.unhover,loneHover:t("./hover").loneHover,loneUnhover:function(t){var e=i.isD3Selection(t)?t:n.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()},click:t("./click")}},{"../../lib":660,"../dragelement":554,"./attributes":566,"./calc":567,"./click":568,"./constants":569,"./defaults":570,"./helpers":571,"./hover":572,"./layout_attributes":575,"./layout_defaults":576,"./layout_global_defaults":577,d3:131}],575:[function(t,e,r){"use strict";var n=t("./constants"),i=t("../../plots/font_attributes")({editType:"none"});i.family.dflt=n.HOVERFONT,i.size.dflt=n.HOVERFONTSIZE,e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom",editType:"modebar"},hovermode:{valType:"enumerated",values:["x","y","closest",!1],editType:"modebar"},hoverdistance:{valType:"integer",min:-1,dflt:20,editType:"none"},spikedistance:{valType:"integer",min:-1,dflt:20,editType:"none"},hoverlabel:{bgcolor:{valType:"color",editType:"none"},bordercolor:{valType:"color",editType:"none"},font:i,namelength:{valType:"integer",min:-1,dflt:15,editType:"none"},editType:"none"},selectdirection:{valType:"enumerated",values:["h","v","d","any"],dflt:"any",editType:"none"}}},{"../../plots/font_attributes":732,"./constants":569}],576:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,r){function a(r,a){return n.coerce(t,e,i,r,a)}var o;"select"===a("dragmode")&&a("selectdirection"),e._has("cartesian")?(e._isHoriz=function(t){for(var e=!0,r=0;r1){f||h||p||"independent"===k("pattern")&&(f=!0),g._hasSubplotGrid=f;var y,x,b="top to bottom"===k("roworder"),_=f?.2:.1,w=f?.3:.1;d&&e._splomGridDflt&&(y=e._splomGridDflt.xside,x=e._splomGridDflt.yside),g._domains={x:c("x",k,_,y,v),y:c("y",k,w,x,m,b)},e.grid=g}}function k(t,e){return n.coerce(r,g,s,t,e)}},contentDefaults:function(t,e){var r=e.grid;if(r&&r._domains){var n,i,a,o,s,c,f,h=t.grid||{},p=e._subplots,d=r._hasSubplotGrid,g=r.rows,m=r.columns,v="independent"===r.pattern,y=r._axisMap={};if(d){var x=h.subplots||[];c=r.subplots=new Array(g);var b=1;for(n=0;n=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],585:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes");e.exports={bgcolor:{valType:"color",editType:"legend"},bordercolor:{valType:"color",dflt:i.defaultLine,editType:"legend"},borderwidth:{valType:"number",min:0,dflt:0,editType:"legend"},font:n({editType:"legend"}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v",editType:"legend"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"],editType:"legend"},tracegroupgap:{valType:"number",min:0,dflt:10,editType:"legend"},x:{valType:"number",min:-2,max:3,dflt:1.02,editType:"legend"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left",editType:"legend"},y:{valType:"number",min:-2,max:3,dflt:1,editType:"legend"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"legend"},editType:"legend"}},{"../../plots/font_attributes":732,"../color/attributes":531}],586:[function(t,e,r){"use strict";e.exports={scrollBarWidth:6,scrollBarMinHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],587:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,r){for(var l,c,u,f,h=t.legend||{},p={},d=0,g="normal",m=0;m1)){if(e.legend=p,y("bgcolor",e.paper_bgcolor),y("bordercolor"),y("borderwidth"),i.coerceFont(y,"font",e.font),y("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(l=0,u="left",c=1.1,f="bottom"):(l=0,u="left",c=-.1,f="top")}y("traceorder",g),s.isGrouped(e.legend)&&y("tracegroupgap"),y("x",l),y("xanchor",u),y("y",c),y("yanchor",f),i.noneOrAll(h,p,["x","y"])}}},{"../../lib":660,"../../plots/layout_attributes":759,"../../registry":790,"./attributes":585,"./helpers":591}],588:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../plots/plots"),o=t("../../registry"),s=t("../../lib/events"),l=t("../dragelement"),c=t("../drawing"),u=t("../color"),f=t("../../lib/svg_text_utils"),h=t("./handle_click"),p=t("./constants"),d=t("../../constants/interactions"),g=t("../../constants/alignment"),m=g.LINE_SPACING,v=g.FROM_TL,y=g.FROM_BR,x=t("./get_legend_data"),b=t("./style"),_=t("./helpers"),w=t("./anchor_utils"),k=d.DBLCLICKDELAY;function M(t,e,r,n,i){var a=r.data()[0][0].trace,o={event:i,node:r.node(),curveNumber:a.index,expandedIndex:a._expandedIndex,data:t.data,layout:t.layout,frames:t._transitionData._frames,config:t._context,fullData:t._fullData,fullLayout:t._fullLayout};if(a._group&&(o.group=a._group),"pie"===a.type&&(o.label=r.datum()[0].label),!1!==s.triggerHandler(t,"plotly_legendclick",o))if(1===n)e._clickTimeout=setTimeout(function(){h(r,t,n)},k);else if(2===n){e._clickTimeout&&clearTimeout(e._clickTimeout),t._legendMouseDownTime=0,!1!==s.triggerHandler(t,"plotly_legenddoubleclick",o)&&h(r,t,n)}}function A(t,e,r){var n=t.data()[0][0],a=e._fullLayout,s=n.trace,l=o.traceIs(s,"pie"),u=s.index,h=l?n.label:s.name,p=e._context.edits.legendText&&!l,d=i.ensureSingle(t,"text","legendtext");function g(r){f.convertToTspans(r,e,function(){!function(t,e){var r=t.data()[0][0];if(!r.trace.showlegend)return void t.remove();var n,i,a=t.select("g[class*=math-group]"),o=a.node(),s=e._fullLayout.legend.font.size*m;if(o){var l=c.bBox(o);n=l.height,i=l.width,c.setTranslate(a,0,n/4)}else{var u=t.select(".legendtext"),h=f.lineCount(u),p=u.node();n=s*h,i=p?c.bBox(p).width:0;var d=s*(.3+(1-h)/2);f.positionText(u,40,d)}n=Math.max(n,16)+3,r.height=n,r.width=i}(t,e)})}d.attr("text-anchor","start").classed("user-select-none",!0).call(c.font,a.legend.font).text(p?T(h,r):h),p?d.call(f.makeEditable,{gd:e,text:h}).call(g).on("edit",function(t){this.text(T(t,r)).call(g);var a=n.trace._fullInput||{},s={};if(o.hasTransform(a,"groupby")){var l=o.getTransformIndices(a,"groupby"),c=l[l.length-1],f=i.keyedContainer(a,"transforms["+c+"].styles","target","value.name");f.set(n.trace._group,t),s=f.constructUpdate()}else s.name=t;return o.call("restyle",e,s,u)}):g(d)}function T(t,e){var r=Math.max(4,e);if(t&&t.trim().length>=r/2)return t;for(var n=r-(t=t||"").length;n>0;n--)t+=" ";return t}function S(t,e){var r,a=1,o=i.ensureSingle(t,"rect","legendtoggle",function(t){t.style("cursor","pointer").attr("pointer-events","all").call(u.fill,"rgba(0,0,0,0)")});o.on("mousedown",function(){(r=(new Date).getTime())-e._legendMouseDownTimek&&(a=Math.max(a-1,1)),M(e,r,t,a,n.event)}})}function C(t,e,r){var i=t._fullLayout,a=i.legend,o=a.borderwidth,s=_.isGrouped(a),l=0;if(a._width=0,a._height=0,_.isVertical(a))s&&e.each(function(t,e){c.setTranslate(this,0,e*a.tracegroupgap)}),r.each(function(t){var e=t[0],r=e.height,n=e.width;c.setTranslate(this,o,5+o+a._height+r/2),a._height+=r,a._width=Math.max(a._width,n)}),a._width+=45+2*o,a._height+=10+2*o,s&&(a._height+=(a._lgroupsLength-1)*a.tracegroupgap),l=40;else if(s){for(var u=[a._width],f=e.data(),h=0,p=f.length;ho+w-k,r.each(function(t){var e=t[0],r=m?40+t[0].width:x;o+b+k+r>i.width-(i.margin.r+i.margin.l)&&(b=0,v+=y,a._height=a._height+y,y=0),c.setTranslate(this,o+b,5+o+e.height/2+v),a._width+=k+r,a._height=Math.max(a._height,e.height),b+=k+r,y=Math.max(e.height,y)}),a._width+=2*o,a._height+=10+2*o}a._width=Math.ceil(a._width),a._height=Math.ceil(a._height),r.each(function(e){var r=e[0],i=n.select(this).select(".legendtoggle");c.setRect(i,0,-r.height/2,(t._context.edits.legendText?0:a._width)+l,r.height)})}function E(t){var e=t._fullLayout.legend,r="left";w.isRightAnchor(e)?r="right":w.isCenterAnchor(e)&&(r="center");var n="top";w.isBottomAnchor(e)?n="bottom":w.isMiddleAnchor(e)&&(n="middle"),a.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*v[r],r:e._width*y[r],b:e._height*y[n],t:e._height*v[n]})}e.exports=function(t){var e=t._fullLayout,r="legend"+e._uid;if(e._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var s=e.legend,f=e.showlegend&&x(t.calcdata,s),h=e.hiddenlabels||[];if(!e.showlegend||!f.length)return e._infolayer.selectAll(".legend").remove(),e._topdefs.select("#"+r).remove(),void a.autoMargin(t,"legend");for(var d=0,g=0;gN?function(t){var e=t._fullLayout.legend,r="left";w.isRightAnchor(e)?r="right":w.isCenterAnchor(e)&&(r="center");a.autoMargin(t,"legend",{x:e.x,y:.5,l:e._width*v[r],r:e._width*y[r],b:0,t:0})}(t):E(t);var j=e._size,V=j.l+j.w*s.x,U=j.t+j.h*(1-s.y);w.isRightAnchor(s)?V-=s._width:w.isCenterAnchor(s)&&(V-=s._width/2),w.isBottomAnchor(s)?U-=s._height:w.isMiddleAnchor(s)&&(U-=s._height/2);var q=s._width,H=j.w;q>H?(V=j.l,q=H):(V+q>F&&(V=F-q),V<0&&(V=0),q=Math.min(F-V,s._width));var G,W,Y,X,Z=s._height,J=j.h;if(Z>J?(U=j.t,Z=J):(U+Z>N&&(U=N-Z),U<0&&(U=0),Z=Math.min(N-U,s._height)),c.setTranslate(z,V,U),I.on(".drag",null),z.on("wheel",null),s._height<=Z||t._context.staticPlot)D.attr({width:q-s.borderwidth,height:Z-s.borderwidth,x:s.borderwidth/2,y:s.borderwidth/2}),c.setTranslate(O,0,0),P.select("rect").attr({width:q-2*s.borderwidth,height:Z-2*s.borderwidth,x:s.borderwidth,y:s.borderwidth}),c.setClipUrl(O,r),c.setRect(I,0,0,0,0),delete s._scrollY;else{var K,Q,$=Math.max(p.scrollBarMinHeight,Z*Z/s._height),tt=Z-$-2*p.scrollBarMargin,et=s._height-Z,rt=tt/et,nt=Math.min(s._scrollY||0,et);D.attr({width:q-2*s.borderwidth+p.scrollBarWidth+p.scrollBarMargin,height:Z-s.borderwidth,x:s.borderwidth/2,y:s.borderwidth/2}),P.select("rect").attr({width:q-2*s.borderwidth+p.scrollBarWidth+p.scrollBarMargin,height:Z-2*s.borderwidth,x:s.borderwidth,y:s.borderwidth+nt}),c.setClipUrl(O,r),at(nt,$,rt),z.on("wheel",function(){at(nt=i.constrain(s._scrollY+n.event.deltaY/tt*et,0,et),$,rt),0!==nt&&nt!==et&&n.event.preventDefault()});var it=n.behavior.drag().on("dragstart",function(){K=n.event.sourceEvent.clientY,Q=nt}).on("drag",function(){var t=n.event.sourceEvent;2===t.buttons||t.ctrlKey||at(nt=i.constrain((t.clientY-K)/rt+Q,0,et),$,rt)});I.call(it)}if(t._context.edits.legendPosition)z.classed("cursor-move",!0),l.init({element:z.node(),gd:t,prepFn:function(){var t=c.getTranslate(z);Y=t.x,X=t.y},moveFn:function(t,e){var r=Y+t,n=X+e;c.setTranslate(z,r,n),G=l.align(r,0,j.l,j.l+j.w,s.xanchor),W=l.align(n,0,j.t+j.h,j.t,s.yanchor)},doneFn:function(){void 0!==G&&void 0!==W&&o.call("relayout",t,{"legend.x":G,"legend.y":W})},clickFn:function(r,n){var i=e._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return n.clientX>=t.left&&n.clientX<=t.right&&n.clientY>=t.top&&n.clientY<=t.bottom});i.size()>0&&M(t,z,i,r,n)}})}function at(e,r,n){s._scrollY=t._fullLayout.legend._scrollY=e,c.setTranslate(O,0,-e),c.setRect(I,q,p.scrollBarMargin+e*n,p.scrollBarWidth,r),P.select("rect").attr({y:s.borderwidth+e})}}},{"../../constants/alignment":632,"../../constants/interactions":636,"../../lib":660,"../../lib/events":648,"../../lib/svg_text_utils":684,"../../plots/plots":768,"../../registry":790,"../color":532,"../dragelement":554,"../drawing":557,"./anchor_utils":584,"./constants":586,"./get_legend_data":589,"./handle_click":590,"./helpers":591,"./style":593,d3:131}],589:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("./helpers");e.exports=function(t,e){var r,a,o={},s=[],l=!1,c={},u=0;function f(t,r){if(""!==t&&i.isGrouped(e))-1===s.indexOf(t)?(s.push(t),l=!0,o[t]=[[r]]):o[t].push([r]);else{var n="~~i"+u;s.push(n),o[n]=[[r]],u++}}for(r=0;rr[1])return r[1]}return i}function d(t){return t[0]}if(u||f||h){var g={},m={};u&&(g.mc=p("marker.color",d),g.mo=p("marker.opacity",a.mean,[.2,1]),g.ms=p("marker.size",a.mean,[2,16]),g.mlc=p("marker.line.color",d),g.mlw=p("marker.line.width",a.mean,[0,5]),m.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),h&&(m.line={width:p("line.width",d,[0,10])}),f&&(g.tx="Aa",g.tp=p("textposition",d),g.ts=10,g.tc=p("textfont.color",d),g.tf=p("textfont.family",d)),r=[a.minExtend(s,g)],(i=a.minExtend(c,m)).selectedpoints=null}var v=n.select(this).select("g.legendpoints"),y=v.selectAll("path.scatterpts").data(u?r:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,i,e),u&&(r[0].mrc=3);var x=v.selectAll("g.pointtext").data(f?r:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(o.textPointStyle,i,e)}).each(function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data("candlestick"===e.type&&e.visible?[t,t]:[]);r.enter().append("path").classed("legendcandle",!0).attr("d",function(t,e){return e?"M-15,0H-8M-8,6V-6H8Z":"M15,0H8M8,-6V6H-8Z"}).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each(function(t,r){var i=e[r?"increasing":"decreasing"],a=i.line.width,o=n.select(this);o.style("stroke-width",a+"px").call(s.fill,i.fillcolor),a&&s.stroke(o,i.line.color)})}).each(function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data("ohlc"===e.type&&e.visible?[t,t]:[]);r.enter().append("path").classed("legendohlc",!0).attr("d",function(t,e){return e?"M-15,0H0M-8,-6V0":"M15,0H0M8,6V0"}).attr("transform","translate(20,0)").style("stroke-miterlimit",1),r.exit().remove(),r.each(function(t,r){var i=e[r?"increasing":"decreasing"],a=i.line.width,l=n.select(this);l.style("fill","none").call(o.dashLine,i.line.dash,a),a&&s.stroke(l,i.line.color)})})}},{"../../lib":660,"../../registry":790,"../../traces/pie/style_one":976,"../../traces/scatter/subtypes":1012,"../color":532,"../drawing":557,d3:131}],594:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/plots"),a=t("../../plots/cartesian/axis_ids"),o=t("../../lib"),s=t("../../../build/ploticon"),l=o._,c=e.exports={};function u(t,e){var r,i,o=e.currentTarget,s=o.getAttribute("data-attr"),l=o.getAttribute("data-val")||!0,c=t._fullLayout,u={},f=a.list(t,null,!0),h="on";if("zoom"===s){var p,d="in"===l?.5:2,g=(1+d)/2,m=(1-d)/2;for(i=0;i1?(_=["toggleHover"],w=["resetViews"]):f?(b=["zoomInGeo","zoomOutGeo"],_=["hoverClosestGeo"],w=["resetGeo"]):u?(_=["hoverClosest3d"],w=["resetCameraDefault3d","resetCameraLastSave3d"]):g?(_=["toggleHover"],w=["resetViewMapbox"]):_=p?["hoverClosestGl2d"]:h?["hoverClosestPie"]:["toggleHover"];c&&(_=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]);!c&&!p||v||(b=["zoomIn2d","zoomOut2d","autoScale2d"],"resetViews"!==w[0]&&(w=["resetScale2d"]));u?k=["zoom3d","pan3d","orbitRotation","tableRotation"]:(c||p)&&!v||d?k=["zoom2d","pan2d"]:g||f?k=["pan2d"]:m&&(k=["zoom2d"]);(function(t){for(var e=!1,r=0;r0)){var p=function(t,e,r){for(var n=r.filter(function(r){return e[r].anchor===t._id}),i=0,a=0;a0?h+c:c;return{ppad:c,ppadplus:u?d:g,ppadminus:u?g:d}}return{ppad:c}}function u(t,e,r,n,i){var s="category"===t.type?t.r2c:t.d2c;if(void 0!==e)return[s(e),s(r)];if(n){var l,c,u,f,h=1/0,p=-1/0,d=n.match(a.segmentRE);for("date"===t.type&&(s=o.decodeDate(s)),l=0;lp&&(p=f)));return p>=h?[h,p]:void 0}}e.exports=function(t){var e=t._fullLayout,r=n.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var o=0;o10?t/2:10;return n.append("circle").attr({"data-line-point":"start-point",cx:W?Q(r.xanchor)+r.x0:Q(r.x0),cy:Y?$(r.yanchor)-r.y0:$(r.y0),r:a}).style(i).classed("cursor-grab",!0),n.append("circle").attr({"data-line-point":"end-point",cx:W?Q(r.xanchor)+r.x1:Q(r.x1),cy:Y?$(r.yanchor)-r.y1:$(r.y1),r:a}).style(i).classed("cursor-grab",!0),n}():e,nt={element:rt.node(),gd:t,prepFn:function(n){var i="shapes["+o+"]";W&&(_=Q(r.xanchor),S=i+".xanchor");Y&&(w=$(r.yanchor),C=i+".yanchor");"path"===r.type?(V=r.path,U=i+".path"):(v=W?r.x0:Q(r.x0),y=Y?r.y0:$(r.y0),x=W?r.x1:Q(r.x1),b=Y?r.y1:$(r.y1),k=i+".x0",M=i+".y0",A=i+".x1",T=i+".y1");vb?(E=y,D=i+".y0",B="y0",L=b,O=i+".y1",F="y1"):(E=b,D=i+".y1",B="y1",L=y,O=i+".y0",F="y0");m={},it(n),st(h,r),function(t,e,r){var n=e.xref,i=e.yref,o=a.getFromId(r,n),l=a.getFromId(r,i),c="";"paper"===n||o.autorange||(c+=n);"paper"===i||l.autorange||(c+=i);t.call(s.setClipUrl,c?"clip"+r._fullLayout._uid+c:null)}(e,r,t),nt.moveFn="move"===q?at:ot},doneFn:function(){c(e),lt(h),p(e,t,r),n.call("relayout",t,m)},clickFn:function(){lt(h)}};function it(t){if(X)q="path"===t.target.tagName?"move":"start-point"===t.target.attributes["data-line-point"].value?"resize-over-start-point":"resize-over-end-point";else{var r=nt.element.getBoundingClientRect(),n=r.right-r.left,i=r.bottom-r.top,a=t.clientX-r.left,o=t.clientY-r.top,s=!Z&&n>H&&i>G&&!t.shiftKey?l.getCursor(a/n,1-o/i):"move";c(e,s),q=s.split("-")[0]}}function at(n,i){if("path"===r.type){var a=function(t){return t},o=a,s=a;W?m[S]=r.xanchor=tt(_+n):(o=function(t){return tt(Q(t)+n)},J&&"date"===J.type&&(o=f.encodeDate(o))),Y?m[C]=r.yanchor=et(w+i):(s=function(t){return et($(t)+i)},K&&"date"===K.type&&(s=f.encodeDate(s))),r.path=g(V,o,s),m[U]=r.path}else W?m[S]=r.xanchor=tt(_+n):(m[k]=r.x0=tt(v+n),m[A]=r.x1=tt(x+n)),Y?m[C]=r.yanchor=et(w+i):(m[M]=r.y0=et(y+i),m[T]=r.y1=et(b+i));e.attr("d",d(t,r)),st(h,r)}function ot(n,i){if(Z){var a=function(t){return t},o=a,s=a;W?m[S]=r.xanchor=tt(_+n):(o=function(t){return tt(Q(t)+n)},J&&"date"===J.type&&(o=f.encodeDate(o))),Y?m[C]=r.yanchor=et(w+i):(s=function(t){return et($(t)+i)},K&&"date"===K.type&&(s=f.encodeDate(s))),r.path=g(V,o,s),m[U]=r.path}else if(X){if("resize-over-start-point"===q){var l=v+n,c=Y?y-i:y+i;m[k]=r.x0=W?l:tt(l),m[M]=r.y0=Y?c:et(c)}else if("resize-over-end-point"===q){var u=x+n,p=Y?b-i:b+i;m[A]=r.x1=W?u:tt(u),m[T]=r.y1=Y?p:et(p)}}else{var rt=~q.indexOf("n")?E+i:E,nt=~q.indexOf("s")?L+i:L,it=~q.indexOf("w")?z+n:z,at=~q.indexOf("e")?P+n:P;~q.indexOf("n")&&Y&&(rt=E-i),~q.indexOf("s")&&Y&&(nt=L-i),(!Y&&nt-rt>G||Y&&rt-nt>G)&&(m[D]=r[B]=Y?rt:et(rt),m[O]=r[F]=Y?nt:et(nt)),at-it>H&&(m[I]=r[N]=W?it:tt(it),m[R]=r[j]=W?at:tt(at))}e.attr("d",d(t,r)),st(h,r)}function st(t,e){(W||Y)&&function(){var r="path"!==e.type,n=t.selectAll(".visual-cue").data([0]);n.enter().append("path").attr({fill:"#fff","fill-rule":"evenodd",stroke:"#000","stroke-width":1}).classed("visual-cue",!0);var a=Q(W?e.xanchor:i.midRange(r?[e.x0,e.x1]:f.extractPathCoords(e.path,u.paramIsX))),o=$(Y?e.yanchor:i.midRange(r?[e.y0,e.y1]:f.extractPathCoords(e.path,u.paramIsY)));if(a=f.roundPositionForSharpStrokeRendering(a,1),o=f.roundPositionForSharpStrokeRendering(o,1),W&&Y){var s="M"+(a-1-1)+","+(o-1-1)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",s)}else if(W){var l="M"+(a-1-1)+","+(o-9-1)+"v18 h2 v-18 Z";n.attr("d",l)}else{var c="M"+(a-9-1)+","+(o-1-1)+"h18 v2 h-18 Z";n.attr("d",c)}}()}function lt(t){t.selectAll(".visual-cue").remove()}l.init(nt),rt.node().onmousemove=it}(t,y,h,e,r)}}function p(t,e,r){var n=(r.xref+r.yref).replace(/paper/g,"");t.call(s.setClipUrl,n?"clip"+e._fullLayout._uid+n:null)}function d(t,e){var r,n,o,s,l,c,h,p,d=e.type,g=a.getFromId(t,e.xref),m=a.getFromId(t,e.yref),v=t._fullLayout._size;if(g?(r=f.shapePositionToRange(g),n=function(t){return g._offset+g.r2p(r(t,!0))}):n=function(t){return v.l+v.w*t},m?(o=f.shapePositionToRange(m),s=function(t){return m._offset+m.r2p(o(t,!0))}):s=function(t){return v.t+v.h*(1-t)},"path"===d)return g&&"date"===g.type&&(n=f.decodeDate(n)),m&&"date"===m.type&&(s=f.decodeDate(s)),function(t,e,r){var n=t.path,a=t.xsizemode,o=t.ysizemode,s=t.xanchor,l=t.yanchor;return n.replace(u.segmentRE,function(t){var n=0,c=t.charAt(0),f=u.paramIsX[c],h=u.paramIsY[c],p=u.numParams[c],d=t.substr(1).replace(u.paramRE,function(t){return f[n]?t="pixel"===a?e(s)+Number(t):e(t):h[n]&&(t="pixel"===o?r(l)-Number(t):r(t)),++n>p&&(t="X"),t});return n>p&&(d=d.replace(/[\s,]*X.*/,""),i.log("Ignoring extra params in segment "+t)),c+d})}(e,n,s);if("pixel"===e.xsizemode){var y=n(e.xanchor);l=y+e.x0,c=y+e.x1}else l=n(e.x0),c=n(e.x1);if("pixel"===e.ysizemode){var x=s(e.yanchor);h=x-e.y0,p=x-e.y1}else h=s(e.y0),p=s(e.y1);if("line"===d)return"M"+l+","+h+"L"+c+","+p;if("rect"===d)return"M"+l+","+h+"H"+c+"V"+p+"H"+l+"Z";var b=(l+c)/2,_=(h+p)/2,w=Math.abs(b-l),k=Math.abs(_-h),M="A"+w+","+k,A=b+w+","+_;return"M"+A+M+" 0 1,1 "+(b+","+(_-k))+M+" 0 0,1 "+A+"Z"}function g(t,e,r){return t.replace(u.segmentRE,function(t){var n=0,i=t.charAt(0),a=u.paramIsX[i],o=u.paramIsY[i],s=u.numParams[i];return i+t.substr(1).replace(u.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}e.exports={draw:function(t){var e=t._fullLayout;for(var r in e._shapeUpperLayer.selectAll("path").remove(),e._shapeLowerLayer.selectAll("path").remove(),e._plots){var n=e._plots[r].shapelayer;n&&n.selectAll("path").remove()}for(var i=0;i0)&&(i("active"),i("x"),i("y"),n.noneOrAll(t,e,["x","y"]),i("xanchor"),i("yanchor"),i("len"),i("lenmode"),i("pad.t"),i("pad.r"),i("pad.b"),i("pad.l"),n.coerceFont(i,"font",r.font),i("currentvalue.visible")&&(i("currentvalue.xanchor"),i("currentvalue.prefix"),i("currentvalue.suffix"),i("currentvalue.offset"),n.coerceFont(i,"currentvalue.font",e.font)),i("transition.duration"),i("transition.easing"),i("bgcolor"),i("activebgcolor"),i("bordercolor"),i("borderwidth"),i("ticklen"),i("tickwidth"),i("tickcolor"),i("minorticklen"))}e.exports=function(t,e){i(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":660,"../../plots/array_container_defaults":702,"./attributes":620,"./constants":621}],623:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plots/plots"),a=t("../color"),o=t("../drawing"),s=t("../../lib"),l=t("../../lib/svg_text_utils"),c=t("../legend/anchor_utils"),u=t("./constants"),f=t("../../constants/alignment"),h=f.LINE_SPACING,p=f.FROM_TL,d=f.FROM_BR;function g(t){return t._index}function m(t,e){var r=o.tester.selectAll("g."+u.labelGroupClass).data(e.steps);r.enter().append("g").classed(u.labelGroupClass,!0);var a=0,s=0;r.each(function(t){var r=x(n.select(this),{step:t},e).node();if(r){var i=o.bBox(r);s=Math.max(s,i.height),a=Math.max(a,i.width)}}),r.remove();var f=e._dims={};f.inputAreaWidth=Math.max(u.railWidth,u.gripHeight);var h=t._fullLayout._size;f.lx=h.l+h.w*e.x,f.ly=h.t+h.h*(1-e.y),"fraction"===e.lenmode?f.outerLength=Math.round(h.w*e.len):f.outerLength=e.len,f.inputAreaStart=0,f.inputAreaLength=Math.round(f.outerLength-e.pad.l-e.pad.r);var g=(f.inputAreaLength-2*u.stepInset)/(e.steps.length-1),m=a+u.labelPadding;if(f.labelStride=Math.max(1,Math.ceil(m/g)),f.labelHeight=s,f.currentValueMaxWidth=0,f.currentValueHeight=0,f.currentValueTotalHeight=0,f.currentValueMaxLines=1,e.currentvalue.visible){var y=o.tester.append("g");r.each(function(t){var r=v(y,e,t.label),n=r.node()&&o.bBox(r.node())||{width:0,height:0},i=l.lineCount(r);f.currentValueMaxWidth=Math.max(f.currentValueMaxWidth,Math.ceil(n.width)),f.currentValueHeight=Math.max(f.currentValueHeight,Math.ceil(n.height)),f.currentValueMaxLines=Math.max(f.currentValueMaxLines,i)}),f.currentValueTotalHeight=f.currentValueHeight+e.currentvalue.offset,y.remove()}f.height=f.currentValueTotalHeight+u.tickOffset+e.ticklen+u.labelOffset+f.labelHeight+e.pad.t+e.pad.b;var b="left";c.isRightAnchor(e)&&(f.lx-=f.outerLength,b="right"),c.isCenterAnchor(e)&&(f.lx-=f.outerLength/2,b="center");var _="top";c.isBottomAnchor(e)&&(f.ly-=f.height,_="bottom"),c.isMiddleAnchor(e)&&(f.ly-=f.height/2,_="middle"),f.outerLength=Math.ceil(f.outerLength),f.height=Math.ceil(f.height),f.lx=Math.round(f.lx),f.ly=Math.round(f.ly),i.autoMargin(t,u.autoMarginIdRoot+e._index,{x:e.x,y:e.y,l:f.outerLength*p[b],r:f.outerLength*d[b],b:f.height*d[_],t:f.height*p[_]})}function v(t,e,r){if(e.currentvalue.visible){var n,i,a=e._dims;switch(e.currentvalue.xanchor){case"right":n=a.inputAreaLength-u.currentValueInset-a.currentValueMaxWidth,i="left";break;case"center":n=.5*a.inputAreaLength,i="middle";break;default:n=u.currentValueInset,i="left"}var c=s.ensureSingle(t,"text",u.labelClass,function(t){t.classed("user-select-none",!0).attr({"text-anchor":i,"data-notex":1})}),f=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)f+=r;else f+=e.steps[e.active].label;e.currentvalue.suffix&&(f+=e.currentvalue.suffix),c.call(o.font,e.currentvalue.font).text(f).call(l.convertToTspans,e._gd);var p=l.lineCount(c),d=(a.currentValueMaxLines+1-p)*e.currentvalue.font.size*h;return l.positionText(c,n,d),c}}function y(t,e,r){s.ensureSingle(t,"rect",u.gripRectClass,function(n){n.call(k,e,t,r).style("pointer-events","all")}).attr({width:u.gripWidth,height:u.gripHeight,rx:u.gripRadius,ry:u.gripRadius}).call(a.stroke,r.bordercolor).call(a.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function x(t,e,r){var n=s.ensureSingle(t,"text",u.labelClass,function(t){t.classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1})});return n.call(o.font,r.font).text(e.step.label).call(l.convertToTspans,r._gd),n}function b(t,e){var r=s.ensureSingle(t,"g",u.labelsClass),i=e._dims,a=r.selectAll("g."+u.labelGroupClass).data(i.labelSteps);a.enter().append("g").classed(u.labelGroupClass,!0),a.exit().remove(),a.each(function(t){var r=n.select(this);r.call(x,t,e),o.setTranslate(r,T(e,t.fraction),u.tickOffset+e.ticklen+e.font.size*h+u.labelOffset+i.currentValueTotalHeight)})}function _(t,e,r,n,i){var a=Math.round(n*(r.steps.length-1));a!==r.active&&w(t,e,r,a,!0,i)}function w(t,e,r,n,a,o){var s=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(A,r,r.active/(r.steps.length-1),o),e.call(v,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:s}),l&&l.method&&a&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:l,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&i.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function k(t,e,r){var i=r.node(),o=n.select(e);function s(){return r.data()[0]}t.on("mousedown",function(){var t=s();e.emit("plotly_sliderstart",{slider:t});var l=r.select("."+u.gripRectClass);n.event.stopPropagation(),n.event.preventDefault(),l.call(a.fill,t.activebgcolor);var c=S(t,n.mouse(i)[0]);_(e,r,t,c,!0),t._dragging=!0,o.on("mousemove",function(){var t=s(),a=S(t,n.mouse(i)[0]);_(e,r,t,a,!1)}),o.on("mouseup",function(){var t=s();t._dragging=!1,l.call(a.fill,t.bgcolor),o.on("mouseup",null),o.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function M(t,e){var r=t.selectAll("rect."+u.tickRectClass).data(e.steps),i=e._dims;r.enter().append("rect").classed(u.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var s=r%i.labelStride==0,l=n.select(this);l.attr({height:s?e.ticklen:e.minorticklen}).call(a.fill,e.tickcolor),o.setTranslate(l,T(e,r/(e.steps.length-1))-.5*e.tickwidth,(s?u.tickOffset:u.minorTickOffset)+i.currentValueTotalHeight)})}function A(t,e,r,n){var i=t.select("rect."+u.gripRectClass),a=T(e,r);if(!e._invokingCommand){var o=i;n&&e.transition.duration>0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*u.gripWidth)+","+e._dims.currentValueTotalHeight+")")}}function T(t,e){var r=t._dims;return r.inputAreaStart+u.stepInset+(r.inputAreaLength-2*u.stepInset)*Math.min(1,Math.max(0,e))}function S(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-u.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*u.stepInset-2*r.inputAreaStart)))}function C(t,e,r){var n=r._dims,i=s.ensureSingle(t,"rect",u.railTouchRectClass,function(n){n.call(k,e,t,r).style("pointer-events","all")});i.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,u.tickOffset+r.ticklen+n.labelHeight)}).call(a.fill,r.bgcolor).attr("opacity",0),o.setTranslate(i,0,n.currentValueTotalHeight)}function E(t,e){var r=e._dims,n=r.inputAreaLength-2*u.railInset,i=s.ensureSingle(t,"rect",u.railRectClass);i.attr({width:n,height:u.railWidth,rx:u.railRadius,ry:u.railRadius,"shape-rendering":"crispEdges"}).call(a.stroke,e.bordercolor).call(a.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),o.setTranslate(i,u.railInset,.5*(r.inputAreaWidth-u.railWidth)+r.currentValueTotalHeight)}e.exports=function(t){var e=t._fullLayout,r=function(t,e){for(var r=t[u.name],n=[],i=0;i0?[0]:[]);if(a.enter().append("g").classed(u.containerClassName,!0).style("cursor","ew-resize"),a.exit().remove(),a.exit().size()&&function(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n=r.steps.length&&(r.active=0);e.call(v,r).call(E,r).call(b,r).call(M,r).call(C,t,r).call(y,t,r);var n=r._dims;o.setTranslate(e,n.lx+r.pad.l,n.ly+r.pad.t),e.call(A,r,r.active/(r.steps.length-1),!1),e.call(v,r)}(t,n.select(this),e)}})}}},{"../../constants/alignment":632,"../../lib":660,"../../lib/svg_text_utils":684,"../../plots/plots":768,"../color":532,"../drawing":557,"../legend/anchor_utils":584,"./constants":621,d3:131}],624:[function(t,e,r){"use strict";var n=t("./constants");e.exports={moduleType:"component",name:n.name,layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),draw:t("./draw")}},{"./attributes":620,"./constants":621,"./defaults":622,"./draw":623}],625:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../../plots/plots"),o=t("../../registry"),s=t("../../lib"),l=t("../drawing"),c=t("../color"),u=t("../../lib/svg_text_utils"),f=t("../../constants/interactions");e.exports={draw:function(t,e,r){var p,d=r.propContainer,g=r.propName,m=r.placeholder,v=r.traceIndex,y=r.avoid||{},x=r.attributes,b=r.transform,_=r.containerGroup,w=t._fullLayout,k=d.titlefont||{},M=k.family,A=k.size,T=k.color,S=1,C=!1,E=(d.title||"").trim();"title"===g?p="titleText":-1!==g.indexOf("axis")?p="axisTitleText":g.indexOf(!0)&&(p="colorbarTitleText");var L=t._context.edits[p];""===E?S=0:E.replace(h," % ")===m.replace(h," % ")&&(S=.2,C=!0,L||(E=""));var z=E||L;_||(_=s.ensureSingle(w._infolayer,"g","g-"+e));var P=_.selectAll("text").data(z?[0]:[]);if(P.enter().append("text"),P.text(E).attr("class",e),P.exit().remove(),!z)return _;function D(t){s.syncOrAsync([O,I],t)}function O(e){var r;return b?(r="",b.rotate&&(r+="rotate("+[b.rotate,x.x,x.y]+")"),b.offset&&(r+="translate(0, "+b.offset+")")):r=null,e.attr("transform",r),e.style({"font-family":M,"font-size":n.round(A,2)+"px",fill:c.rgb(T),opacity:S*c.opacity(T),"font-weight":a.fontWeight}).attr(x).call(u.convertToTspans,t),a.previousPromises(t)}function I(t){var e=n.select(t.node().parentNode);if(y&&y.selection&&y.side&&E){e.attr("transform",null);var r=0,a={left:"right",right:"left",top:"bottom",bottom:"top"}[y.side],o=-1!==["left","top"].indexOf(y.side)?-1:1,c=i(y.pad)?y.pad:2,u=l.bBox(e.node()),f={left:0,top:0,right:w.width,bottom:w.height},h=y.maxShift||(f[y.side]-u[y.side])*("left"===y.side||"top"===y.side?-1:1);if(h<0)r=h;else{var p=y.offsetLeft||0,d=y.offsetTop||0;u.left-=p,u.right-=p,u.top-=d,u.bottom-=d,y.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(u,t,c)&&(r=Math.max(r,o*(t[y.side]-u[a])+c))}),r=Math.min(h,r)}if(r>0||h<0){var g={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[y.side];e.attr("transform","translate("+g+")")}}}P.call(D),L&&(E?P.on(".opacity",null):(S=0,C=!0,P.text(m).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})),P.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==v?o.call("restyle",t,g,e,v):o.call("relayout",t,g,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(D)}).on("input",function(t){this.text(t||" ").call(u.positionText,x.x,x.y)}));return P.classed("js-placeholder",C),_}};var h=/ [XY][0-9]* /},{"../../constants/interactions":636,"../../lib":660,"../../lib/svg_text_utils":684,"../../plots/plots":768,"../../registry":790,"../color":532,"../drawing":557,d3:131,"fast-isnumeric":197}],626:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plot_api/edit_types").overrideAll,s=t("../../plots/pad_attributes");e.exports=o({_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:{_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}},x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},pad:a({},s,{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}},"arraydraw","from-root")},{"../../lib/extend":649,"../../plot_api/edit_types":691,"../../plots/font_attributes":732,"../../plots/pad_attributes":767,"../color/attributes":531}],627:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],628:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/array_container_defaults"),a=t("./attributes"),o=t("./constants").name,s=a.buttons;function l(t,e,r){function i(r,i){return n.coerce(t,e,a,r,i)}i("visible",function(t,e){var r,i,a=t.buttons||[],o=e.buttons=[];function l(t,e){return n.coerce(r,i,s,t,e)}for(var c=0;c0)&&(i("active"),i("direction"),i("type"),i("showactive"),i("x"),i("y"),n.noneOrAll(t,e,["x","y"]),i("xanchor"),i("yanchor"),i("pad.t"),i("pad.r"),i("pad.b"),i("pad.l"),n.coerceFont(i,"font",r.font),i("bgcolor",r.paper_bgcolor),i("bordercolor"),i("borderwidth"))}e.exports=function(t,e){i(t,e,{name:o,handleItemDefaults:l})}},{"../../lib":660,"../../plots/array_container_defaults":702,"./attributes":626,"./constants":627}],629:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plots/plots"),a=t("../color"),o=t("../drawing"),s=t("../../lib"),l=t("../../lib/svg_text_utils"),c=t("../legend/anchor_utils"),u=t("../../constants/alignment").LINE_SPACING,f=t("./constants"),h=t("./scrollbox");function p(t){return t._index}function d(t,e){return+t.attr(f.menuIndexAttrName)===e._index}function g(t,e,r,n,i,a,o,s){e._input.active=e.active=o,"buttons"===e.type?v(t,n,null,null,e):"dropdown"===e.type&&(i.attr(f.menuIndexAttrName,"-1"),m(t,n,i,a,e),s||v(t,n,i,a,e))}function m(t,e,r,n,i){var a=s.ensureSingle(e,"g",f.headerClassName,function(t){t.style("pointer-events","all")}),l=i._dims,c=i.active,u=i.buttons[c]||f.blankHeaderOpts,h={y:i.pad.t,yPad:0,x:i.pad.l,xPad:0,index:0},p={width:l.headerWidth,height:l.headerHeight};a.call(y,i,u,t).call(A,i,h,p),s.ensureSingle(e,"text",f.headerArrowClassName,function(t){t.classed("user-select-none",!0).attr("text-anchor","end").call(o.font,i.font).text(f.arrowSymbol[i.direction])}).attr({x:l.headerWidth-f.arrowOffsetX+i.pad.l,y:l.headerHeight/2+f.textOffsetY+i.pad.t}),a.on("click",function(){r.call(T),r.attr(f.menuIndexAttrName,d(r,i)?-1:String(i._index)),v(t,e,r,n,i)}),a.on("mouseover",function(){a.call(w)}),a.on("mouseout",function(){a.call(k,i)}),o.setTranslate(e,l.lx,l.ly)}function v(t,e,r,a,o){r||(r=e).attr("pointer-events","all");var s=function(t){return-1==+t.attr(f.menuIndexAttrName)}(r)&&"buttons"!==o.type?[]:o.buttons,l="dropdown"===o.type?f.dropdownButtonClassName:f.buttonClassName,c=r.selectAll("g."+l).data(s),u=c.enter().append("g").classed(l,!0),h=c.exit();"dropdown"===o.type?(u.attr("opacity","0").transition().attr("opacity","1"),h.transition().attr("opacity","0").remove()):h.remove();var p=0,d=0,m=o._dims,v=-1!==["up","down"].indexOf(o.direction);"dropdown"===o.type&&(v?d=m.headerHeight+f.gapButtonHeader:p=m.headerWidth+f.gapButtonHeader),"dropdown"===o.type&&"up"===o.direction&&(d=-f.gapButtonHeader+f.gapButton-m.openHeight),"dropdown"===o.type&&"left"===o.direction&&(p=-f.gapButtonHeader+f.gapButton-m.openWidth);var x={x:m.lx+p+o.pad.l,y:m.ly+d+o.pad.t,yPad:f.gapButton,xPad:f.gapButton,index:0},b={l:x.x+o.borderwidth,t:x.y+o.borderwidth};c.each(function(s,l){var u=n.select(this);u.call(y,o,s,t).call(A,o,x),u.on("click",function(){n.event.defaultPrevented||(g(t,o,0,e,r,a,l),s.execute&&i.executeAPICommand(t,s.method,s.args),t.emit("plotly_buttonclicked",{menu:o,button:s,active:o.active}))}),u.on("mouseover",function(){u.call(w)}),u.on("mouseout",function(){u.call(k,o),c.call(_,o)})}),c.call(_,o),v?(b.w=Math.max(m.openWidth,m.headerWidth),b.h=x.y-b.t):(b.w=x.x-b.l,b.h=Math.max(m.openHeight,m.headerHeight)),b.direction=o.direction,a&&(c.size()?function(t,e,r,n,i,a){var o,s,l,c=i.direction,u="up"===c||"down"===c,h=i._dims,p=i.active;if(u)for(s=0,l=0;l0?[0]:[]);if(a.enter().append("g").classed(f.containerClassName,!0).style("cursor","pointer"),a.exit().remove(),a.exit().size()&&function(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;nw,A=s.barLength+2*s.barPad,T=s.barWidth+2*s.barPad,S=d,C=m+v;C+T>c&&(C=c-T);var E=this.container.selectAll("rect.scrollbar-horizontal").data(M?[0]:[]);E.exit().on(".drag",null).remove(),E.enter().append("rect").classed("scrollbar-horizontal",!0).call(i.fill,s.barColor),M?(this.hbar=E.attr({rx:s.barRadius,ry:s.barRadius,x:S,y:C,width:A,height:T}),this._hbarXMin=S+A/2,this._hbarTranslateMax=w-A):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var L=v>k,z=s.barWidth+2*s.barPad,P=s.barLength+2*s.barPad,D=d+g,O=m;D+z>l&&(D=l-z);var I=this.container.selectAll("rect.scrollbar-vertical").data(L?[0]:[]);I.exit().on(".drag",null).remove(),I.enter().append("rect").classed("scrollbar-vertical",!0).call(i.fill,s.barColor),L?(this.vbar=I.attr({rx:s.barRadius,ry:s.barRadius,x:D,y:O,width:z,height:P}),this._vbarYMin=O+P/2,this._vbarTranslateMax=k-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var R=this.id,B=u-.5,F=L?f+z+.5:f+.5,N=h-.5,j=M?p+T+.5:p+.5,V=o._topdefs.selectAll("#"+R).data(M||L?[0]:[]);if(V.exit().remove(),V.enter().append("clipPath").attr("id",R).append("rect"),M||L?(this._clipRect=V.select("rect").attr({x:Math.floor(B),y:Math.floor(N),width:Math.ceil(F)-Math.floor(B),height:Math.ceil(j)-Math.floor(N)}),this.container.call(a.setClipUrl,R),this.bg.attr({x:d,y:m,width:g,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(a.setClipUrl,null),delete this._clipRect),M||L){var U=n.behavior.drag().on("dragstart",function(){n.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(U);var q=n.behavior.drag().on("dragstart",function(){n.event.sourceEvent.preventDefault(),n.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));M&&this.hbar.on(".drag",null).call(q),L&&this.vbar.on(".drag",null).call(q)}this.setTranslate(e,r)},s.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(a.setClipUrl,null),delete this._clipRect),this.hbar&&(this.hbar.on(".drag",null),this.hbar.remove(),delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax),this.vbar&&(this.vbar.on(".drag",null),this.vbar.remove(),delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax)},s.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=n.event.dx),this.vbar&&(e-=n.event.dy),this.setTranslate(t,e)},s.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=n.event.deltaY),this.vbar&&(e+=n.event.deltaY),this.setTranslate(t,e)},s.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,i=r+this._hbarTranslateMax;t=(o.constrain(n.event.x,r,i)-r)/(i-r)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,s=a+this._vbarTranslateMax;e=(o.constrain(n.event.y,a,s)-a)/(s-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},s.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=o.constrain(t||0,0,r),e=o.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(a.setTranslate,this._box.l-this.position.l-t,this._box.t-this.position.t-e),this._clipRect&&this._clipRect.attr({x:Math.floor(this.position.l+t-.5),y:Math.floor(this.position.t+e-.5)}),this.hbar){var i=t/r;this.hbar.call(a.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var s=e/n;this.vbar.call(a.setTranslate,t,e+s*this._vbarTranslateMax)}}},{"../../lib":660,"../color":532,"../drawing":557,d3:131}],632:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},FROM_BR:{left:1,center:.5,right:0,bottom:0,middle:.5,top:1},LINE_SPACING:1.3,MID_SHIFT:.35,OPPOSITE_SIDE:{left:"right",right:"left",top:"bottom",bottom:"top"}}},{}],633:[function(t,e,r){"use strict";e.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}},{}],634:[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]}},{}],635:[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"}},{}],636:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],637:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6,MINUS_SIGN:"\u2212"}},{}],638:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],639:[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}},{}],640:[function(t,e,r){"use strict";r.version="1.38.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config");for(var n=t("./registry"),i=r.register=n.register,a=t("./plot_api"),o=Object.keys(a),s=0;s180&&(t-=360*Math.round(t/360)),t}},{}],643:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),n(t)?Number(t):i}},{"../constants/numerical":637,"fast-isnumeric":197}],644:[function(t,e,r){"use strict";e.exports=function(t){var e=t._fullLayout;e._glcanvas&&e._glcanvas.size()&&e._glcanvas.each(function(t){t.regl&&t.regl.clear({color:!0,depth:!0})})}},{}],645:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=t("./regex").counter,c=t("../constants/interactions").DESELECTDIM,u=t("./angles").wrap180,f=t("./is_array").isArrayOrTypedArray;r.valObjectMeta={data_array:{coerceFunction:function(t,e,r){f(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;ni.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;!0!==n.strict&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorlist:{coerceFunction:function(t,e,r){Array.isArray(t)&&t.length&&t.every(function(t){return i(t).isValid()})?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(o(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?e.set(u(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r,n){var i=n.regex||l(r);"string"==typeof t&&i.test(t)?e.set(t):e.set(r)},validateFunction:function(t,e){var r=e.dflt;return t===r||"string"==typeof t&&!!l(r).test(t)}},flaglist:{coerceFunction:function(t,e,r,n){if("string"==typeof t)if(-1===(n.extras||[]).indexOf(t)){for(var i=t.split("+"),a=0;a=n&&t<=i?t:u;if("string"!=typeof t&&"number"!=typeof t)return u;t=String(t);var a=_(e),o=t.charAt(0);!a||"G"!==o&&"g"!==o||(t=t.substr(1),e="");var s=a&&"chinese"===e.substr(0,7),l=t.match(s?x:y);if(!l)return u;var c=l[1],v=l[3]||"1",w=Number(l[5]||1),k=Number(l[7]||0),M=Number(l[9]||0),A=Number(l[11]||0);if(a){if(2===c.length)return u;var T;c=Number(c);try{var S=m.getComponentMethod("calendars","getCal")(e);if(s){var C="i"===v.charAt(v.length-1);v=parseInt(v,10),T=S.newDate(c,S.toMonthIndex(c,v,C),w)}else T=S.newDate(c,Number(v),w)}catch(t){return u}return T?(T.toJD()-g)*f+k*h+M*p+A*d:u}c=2===c.length?(Number(c)+2e3-b)%100+b:Number(c),v-=1;var E=new Date(Date.UTC(2e3,v,w,k,M));return E.setUTCFullYear(c),E.getUTCMonth()!==v?u:E.getUTCDate()!==w?u:E.getTime()+A*d},n=r.MIN_MS=r.dateTime2ms("-9999"),i=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==u};var k=90*f,M=3*h,A=5*p;function T(t,e,r,n,i){if((e||r||n||i)&&(t+=" "+w(e,2)+":"+w(r,2),(n||i)&&(t+=":"+w(n,2),i))){for(var a=4;i%10==0;)a-=1,i/=10;t+="."+w(i,a)}return t}r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=n&&t<=i))return u;e||(e=0);var a,o,s,c,y,x,b=Math.floor(10*l(t+.05,1)),w=Math.round(t-b/10);if(_(r)){var S=Math.floor(w/f)+g,C=Math.floor(l(t,f));try{a=m.getComponentMethod("calendars","getCal")(r).fromJD(S).formatDate("yyyy-mm-dd")}catch(t){a=v("G%Y-%m-%d")(new Date(w))}if("-"===a.charAt(0))for(;a.length<11;)a="-0"+a.substr(1);else for(;a.length<10;)a="0"+a;o=e=n+f&&t<=i-f))return u;var e=Math.floor(10*l(t+.05,1)),r=new Date(Math.round(t-e/10));return T(a.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,n){if(r.isJSDate(t)||"number"==typeof t){if(_(n))return s.error("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=r.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!r.isDateTime(t,n))return s.error("unrecognized date",t),e;return t};var S=/%\d?f/g;function C(t,e,r,n){t=t.replace(S,function(t){var r=Math.min(+t.charAt(1)||6,6);return(e/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"});var i=new Date(Math.floor(e+.05));if(_(n))try{t=m.getComponentMethod("calendars","worldCalFmt")(t,e,n)}catch(t){return"Invalid"}return r(t)(i)}var E=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(t,e,r,n,i,a){if(i=_(i)&&i,!e)if("y"===r)e=a.year;else if("m"===r)e=a.month;else{if("d"!==r)return function(t,e){var r=l(t+.05,f),n=w(Math.floor(r/h),2)+":"+w(l(Math.floor(r/p),60),2);if("M"!==e){o(e)||(e=0);var i=(100+Math.min(l(t/d,60),E[e])).toFixed(e).substr(1);e>0&&(i=i.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+i}return n}(t,r)+"\n"+C(a.dayMonthYear,t,n,i);e=a.dayMonth+"\n"+a.year}return C(e,t,n,i)};var L=3*f;r.incrementMonth=function(t,e,r){r=_(r)&&r;var n=l(t,f);if(t=Math.round(t-n),r)try{var i=Math.round(t/f)+g,a=m.getComponentMethod("calendars","getCal")(r),o=a.fromJD(i);return e%12?a.add(o,e,"m"):a.add(o,e/12,"y"),(o.toJD()-g)*f+n}catch(e){s.error("invalid ms "+t+" in calendar "+r)}var c=new Date(t+L);return c.setUTCMonth(c.getUTCMonth()+e)+n-L},r.findExactDates=function(t,e){for(var r,n,i=0,a=0,s=0,l=0,c=_(e)&&m.getComponentMethod("calendars","getCal")(e),u=0;u0&&(r.push(i),i=[])}return i.length>0&&r.push(i),r},r.makeLine=function(t){return 1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}},r.makePolygon=function(t){if(1===t.length)return{type:"Polygon",coordinates:t};for(var e=new Array(t.length),r=0;r1||g<0||g>1?null:{x:t+l*g,y:e+f*g}}function l(t,e,r,n,i){var a=n*t+i*e;if(a<0)return n*n+i*i;if(a>r){var o=n-t,s=i-e;return o*o+s*s}var l=n*e-i*t;return l*l/r}r.segmentsIntersect=s,r.segmentDistance=function(t,e,r,n,i,a,o,c){if(s(t,e,r,n,i,a,o,c))return 0;var u=r-t,f=n-e,h=o-i,p=c-a,d=u*u+f*f,g=h*h+p*p,m=Math.min(l(u,f,d,i-t,a-e),l(u,f,d,o-t,c-e),l(h,p,g,t-i,e-a),l(h,p,g,r-i,n-a));return Math.sqrt(m)},r.getTextLocation=function(t,e,r,s){if(t===i&&s===a||(n={},i=t,a=s),n[r])return n[r];var l=t.getPointAtLength(o(r-s/2,e)),c=t.getPointAtLength(o(r+s/2,e)),u=Math.atan((c.y-l.y)/(c.x-l.x)),f=t.getPointAtLength(o(r,e)),h={x:(4*f.x+l.x+c.x)/6,y:(4*f.y+l.y+c.y)/6,theta:u};return n[r]=h,h},r.clearLocationCache=function(){i=null},r.getVisibleSegment=function(t,e,r){var n,i,a=e.left,o=e.right,s=e.top,l=e.bottom,c=0,u=t.getTotalLength(),f=u;function h(e){var r=t.getPointAtLength(e);0===e?n=r:e===u&&(i=r);var c=r.xo?r.x-o:0,f=r.yl?r.y-l:0;return Math.sqrt(c*c+f*f)}for(var p=h(c);p;){if((c+=p+r)>f)return;p=h(c)}for(p=h(f);p;){if(c>(f-=p+r))return;p=h(f)}return{min:c,max:f,len:f-c,total:u,isClosed:0===c&&f===u&&Math.abs(n.x-i.x)<.1&&Math.abs(n.y-i.y)<.1}},r.findPointOnPath=function(t,e,r,n){for(var i,a,o,s=(n=n||{}).pathLength||t.getTotalLength(),l=n.tolerance||.001,c=n.iterationLimit||30,u=t.getPointAtLength(0)[r]>t.getPointAtLength(s)[r]?-1:1,f=0,h=0,p=s;f0?p=i:h=i,f++}return a}},{"./mod":667}],655:[function(t,e,r){"use strict";e.exports=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))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}},{}],656:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("color-normalize"),o=t("../components/colorscale"),s=t("../components/color/attributes").defaultLine,l=t("./is_array").isArrayOrTypedArray,c=a(s),u=1;function f(t,e){var r=t;return r[3]*=e,r}function h(t){if(n(t))return c;var e=a(t);return e.length?e:c}function p(t){return n(t)?t:u}e.exports={formatColor:function(t,e,r){var n,i,s,d,g,m=t.color,v=l(m),y=l(e),x=[];if(n=void 0!==t.colorscale?o.makeColorScaleFunc(o.extractScale(t.colorscale,t.cmin,t.cmax)):h,i=v?function(t,e){return void 0===t[e]?c:a(n(t[e]))}:h,s=y?function(t,e){return void 0===t[e]?u:p(t[e])}:p,v||y)for(var b=0;b=0;){var n=t.indexOf(";",r);if(n/g,"")}(function(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n"))))}},{"../constants/string_mappings":638,"superscript-text":466}],659:[function(t,e,r){"use strict";e.exports=function(t){return t}},{}],660:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../constants/numerical"),o=a.FP_SAFE,s=a.BADNUM,l=e.exports={};l.nestedProperty=t("./nested_property"),l.keyedContainer=t("./keyed_container"),l.relativeAttr=t("./relative_attr"),l.isPlainObject=t("./is_plain_object"),l.mod=t("./mod"),l.toLogRange=t("./to_log_range"),l.relinkPrivateKeys=t("./relink_private"),l.ensureArray=t("./ensure_array");var c=t("./is_array");l.isTypedArray=c.isTypedArray,l.isArrayOrTypedArray=c.isArrayOrTypedArray,l.isArray1D=c.isArray1D;var u=t("./coerce");l.valObjectMeta=u.valObjectMeta,l.coerce=u.coerce,l.coerce2=u.coerce2,l.coerceFont=u.coerceFont,l.coerceHoverinfo=u.coerceHoverinfo,l.coerceSelectionMarkerOpacity=u.coerceSelectionMarkerOpacity,l.validate=u.validate;var f=t("./dates");l.dateTime2ms=f.dateTime2ms,l.isDateTime=f.isDateTime,l.ms2DateTime=f.ms2DateTime,l.ms2DateTimeLocal=f.ms2DateTimeLocal,l.cleanDate=f.cleanDate,l.isJSDate=f.isJSDate,l.formatDate=f.formatDate,l.incrementMonth=f.incrementMonth,l.dateTick0=f.dateTick0,l.dfltRange=f.dfltRange,l.findExactDates=f.findExactDates,l.MIN_MS=f.MIN_MS,l.MAX_MS=f.MAX_MS;var h=t("./search");l.findBin=h.findBin,l.sorterAsc=h.sorterAsc,l.sorterDes=h.sorterDes,l.distinctVals=h.distinctVals,l.roundUp=h.roundUp;var p=t("./stats");l.aggNums=p.aggNums,l.len=p.len,l.mean=p.mean,l.midRange=p.midRange,l.variance=p.variance,l.stdev=p.stdev,l.interp=p.interp;var d=t("./matrix");l.init2dArray=d.init2dArray,l.transposeRagged=d.transposeRagged,l.dot=d.dot,l.translationMatrix=d.translationMatrix,l.rotationMatrix=d.rotationMatrix,l.rotationXYMatrix=d.rotationXYMatrix,l.apply2DTransform=d.apply2DTransform,l.apply2DTransform2=d.apply2DTransform2;var g=t("./angles");l.deg2rad=g.deg2rad,l.rad2deg=g.rad2deg,l.wrap360=g.wrap360,l.wrap180=g.wrap180;var m=t("./geometry2d");l.segmentsIntersect=m.segmentsIntersect,l.segmentDistance=m.segmentDistance,l.getTextLocation=m.getTextLocation,l.clearLocationCache=m.clearLocationCache,l.getVisibleSegment=m.getVisibleSegment,l.findPointOnPath=m.findPointOnPath;var v=t("./extend");l.extendFlat=v.extendFlat,l.extendDeep=v.extendDeep,l.extendDeepAll=v.extendDeepAll,l.extendDeepNoArrays=v.extendDeepNoArrays;var y=t("./loggers");l.log=y.log,l.warn=y.warn,l.error=y.error;var x=t("./regex");l.counterRegex=x.counter;var b=t("./throttle");l.throttle=b.throttle,l.throttleDone=b.done,l.clearThrottle=b.clear,l.getGraphDiv=t("./get_graph_div"),l._=t("./localize"),l.notifier=t("./notifier"),l.filterUnique=t("./filter_unique"),l.filterVisible=t("./filter_visible"),l.pushUnique=t("./push_unique"),l.cleanNumber=t("./clean_number"),l.ensureNumber=function(t){return i(t)?(t=Number(t))<-o||t>o?s:i(t)?Number(t):s:s},l.isIndex=function(t,e){return!(void 0!==e&&t>=e)&&(i(t)&&t>=0&&t%1==0)},l.noop=t("./noop"),l.identity=t("./identity"),l.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var i=0;ir?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},l.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},l.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):s},l.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={optionList:[],_newoption:function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)}};return r["_"+e]=t,r},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,c=new Array(l),u=new Array(o);for(r=0;r=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*c[n];u[r]=a}return u},l.syncOrAsync=function(t,e,r){var n;function i(){return l.syncOrAsync(t,e,r)}for(;t.length;)if((n=(0,t.splice(0,1)[0])(e))&&n.then)return n.then(i).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,i,a=!1,o=!0;for(n=0;n1?i+o[1]:"";if(a&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+a+"$2");return s+l};var k=/%{([^\s%{}]*)}/g,M=/^\w*$/;l.templateString=function(t,e){var r={};return t.replace(k,function(t,n){return M.test(n)?e[n]||"":(r[n]=r[n]||l.nestedProperty(e,n).get,r[n]()||"")})};l.subplotSort=function(t,e){for(var r=Math.min(t.length,e.length)+1,n=0,i=0,a=0;a=48&&o<=57,c=s>=48&&s<=57;if(l&&(n=10*n+o-48),c&&(i=10*i+s-48),!l||!c){if(n!==i)return n-i;if(o!==s)return o-s}}return i-n};var A=2e9;l.seedPseudoRandom=function(){A=2e9},l.pseudoRandom=function(){var t=A;return A=(69069*A+1)%4294967296,Math.abs(A-t)<429496729?l.pseudoRandom():A/4294967296}},{"../constants/numerical":637,"./angles":642,"./clean_number":643,"./coerce":645,"./dates":646,"./ensure_array":647,"./extend":649,"./filter_unique":650,"./filter_visible":651,"./geometry2d":654,"./get_graph_div":655,"./identity":659,"./is_array":661,"./is_plain_object":662,"./keyed_container":663,"./localize":664,"./loggers":665,"./matrix":666,"./mod":667,"./nested_property":668,"./noop":669,"./notifier":670,"./push_unique":674,"./regex":676,"./relative_attr":677,"./relink_private":678,"./search":679,"./stats":682,"./throttle":685,"./to_log_range":686,d3:131,"fast-isnumeric":197}],661:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}},i="undefined"==typeof DataView?function(){}:DataView;function a(t){return n.isView(t)&&!(t instanceof i)}function o(t){return Array.isArray(t)||a(t)}e.exports={isTypedArray:a,isArrayOrTypedArray:o,isArray1D:function(t){return!o(t[0])}}},{}],662:[function(t,e,r){"use strict";e.exports=function(t){return window&&window.process&&window.process.versions?"[object Object]"===Object.prototype.toString.call(t):"[object Object]"===Object.prototype.toString.call(t)&&Object.getPrototypeOf(t)===Object.prototype}},{}],663:[function(t,e,r){"use strict";var n=t("./nested_property"),i=/^\w*$/;e.exports=function(t,e,r,a){var o,s,l;r=r||"name",a=a||"value";var c={};e&&e.length?(l=n(t,e),s=l.get()):s=t,e=e||"";var u={};if(s)for(o=0;o2)return c[e]=2|c[e],h.set(t,null);if(f){for(o=e;o1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e/g),o=0;oo||a===i||al||e&&c(t))}:function(t,e){var a=t[0],c=t[1];if(a===i||ao||c===i||cl)return!1;var u,f,h,p,d,g=r.length,m=r[0][0],v=r[0][1],y=0;for(u=1;uMath.max(f,m)||c>Math.max(h,v)))if(cu||Math.abs(n(o,h))>i)return!0;return!1};a.filter=function(t,e){var r=[t[0]],n=0,i=0;function a(a){t.push(a);var s=r.length,l=n;r.splice(i+1);for(var c=l+1;c1&&a(t.pop());return{addPt:a,raw:t,filtered:r}}},{"../constants/numerical":637,"./matrix":666}],673:[function(t,e,r){(function(r){"use strict";var n=t("regl");e.exports=function(t,e){t._fullLayout._glcanvas.each(function(i){i.regl||(i.regl=n({canvas:this,attributes:{antialias:!i.pick,preserveDrawingBuffer:!0},pixelRatio:t._context.plotGlPixelRatio||r.devicePixelRatio,extensions:e||[]}))})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{regl:438}],674:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ri.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--))},startSequence:function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},stopSequence:function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},undo:function(t){var e,r;if(t.framework&&t.framework.isPolar)t.framework.undo();else if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;re}function l(t,e){return t>=e}r.findBin=function(t,e,r){if(n(e.start))return r?Math.ceil((t-e.start)/e.size-1e-9)-1:Math.floor((t-e.start)/e.size+1e-9);var c,u,f=0,h=e.length,p=0,d=h>1?(e[h-1]-e[0])/(h-1):1;for(u=d>=0?r?a:o:r?l:s,t+=1e-9*d*(r?-1:1)*(d>=0?1:-1);f90&&i.log("Long binary search..."),f-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,a=i/(n||1)/1e4,o=[e[0]],s=0;se[s]+a&&(i=Math.min(i,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,a=e.length-1,o=0,s=r?0:1,l=r?1:0,c=r?Math.ceil:Math.floor;ia.length)&&(o=a.length),n(e)||(e=!1),i(a[0])){for(l=new Array(o),s=0;st.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"./is_array":661,"fast-isnumeric":197}],683:[function(t,e,r){"use strict";var n=t("color-normalize");e.exports=function(t){return t?n(t):[0,0,0,1]}},{"color-normalize":101}],684:[function(t,e,r){"use strict";var n=t("d3"),i=t("../lib"),a=t("../constants/xmlns_namespaces"),o=t("../constants/string_mappings"),s=t("../constants/alignment").LINE_SPACING;function l(t,e){return t.node().getBoundingClientRect()[e]}var c=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,o){var v=t.text(),E=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&v.match(c),L=n.select(t.node().parentNode);if(!L.empty()){var z=t.attr("class")?t.attr("class").split(" ")[0]:"text";return z+="-math",L.selectAll("svg."+z).remove(),L.selectAll("g."+z+"-group").remove(),t.style("display",null).attr({"data-unformatted":v,"data-math":"N"}),E?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10),a={fontSize:r};!function(t,e,r){var a="math-output-"+i.randstr([],64),o=n.select("body").append("div").attr({id:a}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text((s=t,s.replace(u,"\\lt ").replace(f,"\\gt ")));var s;MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=n.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node())i.log("There was an error in the tex syntax.",t),r();else{var a=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,a)}o.remove()})}(E[2],a,function(n,i,a){L.selectAll("svg."+z).remove(),L.selectAll("g."+z+"-group").remove();var s=n&&n.select("svg");if(!s||!s.node())return P(),void e();var c=L.append("g").classed(z+"-group",!0).attr({"pointer-events":"none","data-unformatted":v,"data-math":"Y"});c.node().appendChild(s.node()),i&&i.node()&&s.node().insertBefore(i.node().cloneNode(!0),s.node().firstChild),s.attr({class:z,height:a.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var u=t.node().style.fill||"black";s.select("g").attr({fill:u,stroke:u});var f=l(s,"width"),h=l(s,"height"),p=+t.attr("x")-f*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],d=-(r||l(t,"height"))/4;"y"===z[0]?(c.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-f/2,d-h/2]+")"}),s.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===z[0]?s.attr({x:t.attr("x"),y:d-h/2}):"a"===z[0]?s.attr({x:0,y:d}):s.attr({x:p,y:+t.attr("y")+d-h/2}),o&&o.call(t,c),e(c)})})):P(),t}function P(){L.empty()||(z=t.attr("class")+"-math",L.select("svg."+z).remove()),t.text("").style("white-space","pre"),function(t,e){e=(r=e,function(t,e){if(!t)return"";for(var r=0;r1)for(var i=1;i doesnt match end tag <"+t+">. Pretending it did match.",e),o=c[c.length-1].node}else i.log("Ignoring unexpected end tag .",e)}w.test(e)?f():(o=t,c=[{node:t}]);for(var z=e.split(b),P=0;P|>|>)/g;var h={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"},p={sub:"0.3em",sup:"-0.6em"},d={sub:"-0.21em",sup:"0.42em"},g="\u200b",m=["http:","https:","mailto:","",void 0,":"],v=new RegExp("]*)?/?>","g"),y=Object.keys(o.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:o.entityToUnicode[t]}}),x=/(\r\n?|\n)/g,b=/(<[^<>]*>)/,_=/<(\/?)([^ >]*)(\s+(.*))?>/i,w=//i,k=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,M=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,A=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,T=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function S(t,e){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}var C=/(^|;)\s*color:/;function E(t,e,r){var n,i,a,o=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},a="right"===o?function(){return l.right-n.width}:"center"===o?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:a()-c.left+"px","z-index":1e3}),this}}r.plainText=function(t){return(t||"").replace(v," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){var t=n.select(this);function i(e,r){return void 0===r?null===(r=t.attr(e))&&(t.attr(e,0),r=0):t.attr(e,r),r}var a=i("x",e),o=i("y",r);"text"===this.nodeName&&t.selectAll("tspan.line").attr({x:a,y:o})})},r.makeEditable=function(t,e){var r=e.gd,i=e.delegate,a=n.dispatch("edit","input","cancel"),o=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");function s(){!function(){var i=n.select(r).select(".svg-container"),o=i.append("div"),s=t.node().style,c=parseFloat(s.fontSize||12),u=e.text;void 0===u&&(u=t.attr("data-unformatted"));o.classed("plugin-editable editable",!0).style({position:"absolute","font-family":s.fontFamily||"Arial","font-size":c,color:e.fill||s.fill||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-c/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(u).call(E(t,i,e)).on("blur",function(){r._editing=!1,t.text(this.textContent).style({opacity:1});var e,i=n.select(this).attr("class");(e=i?"."+i.split(" ")[0]+"-math-group":"[class*=-math-group]")&&n.select(t.node().parentNode).select(e).style({opacity:0});var o=this.textContent;n.select(this).transition().duration(0).remove(),n.select(document).on("mouseup",null),a.edit.call(t,o)}).on("focus",function(){var t=this;r._editing=!0,n.select(document).on("mouseup",function(){if(n.event.target===t)return!1;document.activeElement===o.node()&&o.node().blur()})}).on("keyup",function(){27===n.event.which?(r._editing=!1,t.style({opacity:1}),n.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),a.cancel.call(t,this.textContent)):(a.input.call(t,this.textContent),n.select(this).call(E(t,i,e)))}).on("keydown",function(){13===n.event.which&&this.blur()}).call(l)}(),t.style({opacity:0});var i,s=o.attr("class");(i=s?"."+s.split(" ")[0]+"-math-group":"[class*=-math-group]")&&n.select(t.node().parentNode).select(i).style({opacity:0})}function l(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}return e.immediate?s():o.on("click",s),n.rebind(t,a,"on")}},{"../constants/alignment":632,"../constants/string_mappings":638,"../constants/xmlns_namespaces":639,"../lib":660,d3:131}],685:[function(t,e,r){"use strict";var n={};function i(t){t&&null!==t.timer&&(clearTimeout(t.timer),t.timer=null)}r.throttle=function(t,e,r){var a=n[t],o=Date.now();if(!a){for(var s in n)n[s].tsa.ts+e?l():a.timer=setTimeout(function(){l(),a.timer=null},e)},r.done=function(t){var e=n[t];return e&&e.timer?new Promise(function(t){var r=e.onDone;e.onDone=function(){r&&r(),t(),e.onDone=null}}):Promise.resolve()},r.clear=function(t){if(t)i(n[t]),delete n[t];else for(var e in n)r.clear(e)}},{}],686:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var r=Math.log(Math.min(e[0],e[1]))/Math.LN10;return n(r)||(r=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),r}},{"fast-isnumeric":197}],687:[function(t,e,r){"use strict";var n=e.exports={},i=t("../plots/geo/constants").locationmodeToLayer,a=t("topojson-client").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 a(e,n).features}},{"../plots/geo/constants":734,"topojson-client":476}],688:[function(t,e,r){"use strict";e.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],689:[function(t,e,r){"use strict";e.exports={moduleType:"locale",name:"en",dictionary:{"Click to enter Colorscale title":"Click to enter Colourscale title"},format:{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"],periods:["AM","PM"],dateTime:"%a %b %e %X %Y",date:"%d/%m/%Y",time:"%H:%M:%S",decimal:".",thousands:",",grouping:[3],currency:["$",""],year:"%Y",month:"%b %Y",dayMonth:"%b %-d",dayMonthYear:"%b %-d, %Y"}}},{}],690:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,i=n.layoutArrayContainers,a=n.layoutArrayRegexes,o=t.split("[")[0],s=0;s0&&o.log("Clearing previous rejected promises from queue."),t._promises=[]},r.cleanLayout=function(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),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var n=(s.subplotsRegistry.cartesian||{}).attrRegex,a=(s.subplotsRegistry.gl3d||{}).attrRegex,l=Object.keys(t);for(e=0;e3?(T.x=1.02,T.xanchor="left"):T.x<-2&&(T.x=-.02,T.xanchor="right"),T.y>3?(T.y=1.02,T.yanchor="bottom"):T.y<-2&&(T.y=-.02,T.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),f.clean(t),t},r.cleanData=function(t,e){for(var n=[],i=t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid}),l=0;l0)return t.substr(0,e)}r.hasParent=function(t,e){for(var r=y(e);r;){if(r in t)return!0;r=y(r)}return!1};var x=["x","y","z"];r.clearAxisTypes=function(t,e,r){for(var n=0;n1&&o.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!g&&(h(m,v),p(t),!0)}var x,b,_,w,k,M,A,T=Object.keys(r).map(Number).sort(s),S=e.get(),C=S||[],E=n(v,f).get(),L=[],z=-1,P=C.length;for(x=0;xC.length-(A?0:1))o.warn("index out of range",f,_);else if(void 0!==M)k.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(M)?L.push(_):A?("add"===M&&(M={}),C.splice(_,0,M),E&&E.splice(_,0,{})):o.warn("Unrecognized full object edit value",f,_,M),-1===z&&(z=_);else for(b=0;b=0;x--)C.splice(L[x],1),E&&E.splice(L[x],1);if(C.length?S||e.set(C):e.set(null),g)return!1;if(h(m,v),d!==a){var D;if(-1===z)D=T;else{for(P=Math.max(C.length,P),D=[],x=0;x=z);x++)D.push(_);for(x=z;x=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||i<0&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function z(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),L(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&L(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function P(t,e,r,n,a){!function(t,e,r,n){var i=o.isPlainObject(n);if(!Array.isArray(t.data))throw new Error("gd.data must be an array");if(!o.isPlainObject(e))throw new Error("update must be a key:value object");if(void 0===r)throw new Error("indices must be an integer or array of integers");for(var a in L(t,r,"indices"),e){if(!Array.isArray(e[a])||e[a].length!==r.length)throw new Error("attribute "+a+" must be an array of length equal to indices array length");if(i&&(!(a in n)||!Array.isArray(n[a])||n[a].length!==e[a].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")}}(t,e,r,n);for(var s=function(t,e,r,n){var a,s,l,c,u,f=o.isPlainObject(n),h=[];for(var p in Array.isArray(r)||(r=[r]),r=E(r,t.data.length-1),e)for(var d=0;d=0&&r=0&&r0&&"string"!=typeof E.parts[z];)z--;var P=E.parts[z],D=E.parts[z-1]+"."+P,I=E.parts.slice(0,z).join("."),N=o.nestedProperty(t.layout,I).get(),U=o.nestedProperty(s,I).get(),q=E.get();if(void 0!==L){y[C]=L,x[C]="reverse"===P?L:O(q);var H=u.getLayoutValObject(s,E.parts);if(H&&H.impliedEdits&&null!==L)for(var G in H.impliedEdits)w(o.relativeAttr(C,G),H.impliedEdits[G]);if(-1!==["width","height"].indexOf(C)&&null===L)s[C]=t._initialAutoSize[C];else if(D.match(R))S(D),o.nestedProperty(s,I+"._inputRange").set(null);else if(D.match(B)){S(D),o.nestedProperty(s,I+"._inputRange").set(null);var W=o.nestedProperty(s,I).get();W._inputDomain&&(W._input.domain=W._inputDomain.slice())}else D.match(F)&&o.nestedProperty(s,I+"._inputDomain").set(null);if("type"===P){var Y=N,X="linear"===U.type&&"log"===L,Z="log"===U.type&&"linear"===L;if(X||Z){if(Y&&Y.range)if(U.autorange)X&&(Y.range=Y.range[1]>Y.range[0]?[1,2]:[2,1]);else{var J=Y.range[0],K=Y.range[1];X?(J<=0&&K<=0&&w(I+".autorange",!0),J<=0?J=K/1e6:K<=0&&(K=J/1e6),w(I+".range[0]",Math.log(J)/Math.LN10),w(I+".range[1]",Math.log(K)/Math.LN10)):(w(I+".range[0]",Math.pow(10,J)),w(I+".range[1]",Math.pow(10,K)))}else w(I+".autorange",!0);Array.isArray(s._subplots.polar)&&s._subplots.polar.length&&s[E.parts[0]]&&"radialaxis"===E.parts[1]&&delete s[E.parts[0]]._subplot.viewInitial["radialaxis.range"],c.getComponentMethod("annotations","convertCoords")(t,U,L,w),c.getComponentMethod("images","convertCoords")(t,U,L,w)}else w(I+".autorange",!0),w(I+".range",null);o.nestedProperty(s,I+"._inputRange").set(null)}else if(P.match(M)){var Q=o.nestedProperty(s,C).get(),$=(L||{}).type;$&&"-"!==$||($="linear"),c.getComponentMethod("annotations","convertCoords")(t,Q,$,w),c.getComponentMethod("images","convertCoords")(t,Q,$,w)}var tt=b.containerArrayMatch(C);if(tt){r=tt.array,n=tt.index;var et=tt.property,rt=(o.nestedProperty(a,r)||[])[n]||{},nt=rt,it=H||{editType:"calc"},at=-1!==it.editType.indexOf("calcIfAutorange");""===n?(at?v.calc=!0:k.update(v,it),at=!1):""===et&&(nt=L,b.isAddVal(L)?x[C]=null:b.isRemoveVal(L)?(x[C]=rt,nt=rt):o.warn("unrecognized full object value",e)),at&&(V(t,nt,"x")||V(t,nt,"y"))?v.calc=!0:k.update(v,it),h[r]||(h[r]={});var ot=h[r][n];ot||(ot=h[r][n]={}),ot[et]=L,delete e[C]}else"reverse"===P?(N.range?N.range.reverse():(w(I+".autorange",!0),N.range=[1,0]),U.autorange?v.calc=!0:v.plot=!0):(s._has("scatter-like")&&s._has("regl")&&"dragmode"===C&&("lasso"===L||"select"===L)&&"lasso"!==q&&"select"!==q?v.plot=!0:H?k.update(v,H):v.calc=!0,E.set(L))}}for(r in h){b.applyContainerArrayChanges(t,o.nestedProperty(a,r),h[r],v)||(v.plot=!0)}var st=s._axisConstraintGroups||[];for(A in T)for(n=0;n=i.length?i[0]:i[t]:i}function l(t){return Array.isArray(a)?t>=a.length?a[0]:a[t]:a}function c(t,e){var r=0;return function(){if(t&&++r===e)return t()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise(function(a,u){function h(){n._currentFrame&&n._currentFrame.onComplete&&n._currentFrame.onComplete();var e=n._currentFrame=n._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,n._lastFrameAt=Date.now(),n._timeToNext=e.frameOpts.duration,f.transition(t,e.frame.data,e.frame.layout,_.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else t.emit("plotly_animated"),window.cancelAnimationFrame(n._animationRaf),n._animationRaf=null}function p(){t.emit("plotly_animating"),n._lastFrameAt=-1/0,n._timeToNext=0,n._runningTransitions=0,n._currentFrame=null;var e=function(){n._animationRaf=window.requestAnimationFrame(e),Date.now()-n._lastFrameAt>n._timeToNext&&h()};e()}var d,g,m=0;function v(t){return Array.isArray(i)?m>=i.length?t.transitionOpts=i[m]:t.transitionOpts=i[0]:t.transitionOpts=i,m++,t}var y=[],x=void 0===e||null===e,b=Array.isArray(e);if(!x&&!b&&o.isPlainObject(e))y.push({type:"object",data:v(o.extendFlat({},e))});else if(x||-1!==["string","number"].indexOf(typeof e))for(d=0;d0&&MM)&&A.push(g);y=A}}y.length>0?function(e){if(0!==e.length){for(var i=0;i=0;n--)if(o.isPlainObject(e[n])){var g=e[n].name,m=(u[g]||d[g]||{}).name,v=e[n].name,y=u[m]||d[m];m&&v&&"number"==typeof v&&y&&A<5&&(A++,o.warn('addFrames: overwriting frame "'+(u[m]||d[m]).name+'" with a frame whose name of type "number" also equates to "'+m+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),5===A&&o.warn("addFrames: This API call has yielded too many of these warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),d[g]={name:g},p.push({frame:f.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:h+n})}p.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if("number"==typeof(i=p[n].frame).name&&o.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!i.name)for(;u[i.name="frame "+t._transitionData._counter++];);if(u[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),s.unshift({type:"insert",index:n,value:i[n]});var c=f.modifyFrames,u=f.modifyFrames,h=[t,s],p=[t,a];return l&&l.add(t,c,h,u,p),f.modifyFrames(t,a)},r.purge=function(t){var e=(t=o.getGraphDiv(t))._fullLayout||{},r=t._fullData||[],n=t.calcdata||[];return f.cleanPlot([],{},r,e,n),f.purge(t),s.purge(t),e._container&&e._container.remove(),delete t._context,t}},{"../components/color":532,"../components/drawing":557,"../constants/xmlns_namespaces":639,"../lib":660,"../lib/events":648,"../lib/queue":675,"../lib/svg_text_utils":684,"../plots/cartesian/axes":706,"../plots/cartesian/constants":711,"../plots/cartesian/graph_interact":715,"../plots/plots":768,"../plots/polar/legacy":776,"../registry":790,"./edit_types":691,"./helpers":692,"./manage_arrays":694,"./plot_config":696,"./plot_schema":697,"./subroutines":698,d3:131,"fast-isnumeric":197,"has-hover":354}],696:[function(t,e,r){"use strict";e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,toImageButtonOptions:{},displaylogo:!0,plotGlPixelRatio:2,setBackground:"transparent",topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:1,globalTransforms:[],locale:"en-US",locales:{}}},{}],697:[function(t,e,r){"use strict";var n=t("../registry"),i=t("../lib"),a=t("../plots/attributes"),o=t("../plots/layout_attributes"),s=t("../plots/frame_attributes"),l=t("../plots/animation_attributes"),c=t("../plots/polar/legacy/area_attributes"),u=t("../plots/polar/legacy/axis_attributes"),f=t("./edit_types"),h=i.extendFlat,p=i.extendDeepAll,d=i.isPlainObject,g="_isSubplotObj",m="_isLinkedToArray",v=[g,m,"_arrayAttrRegexps","_deprecated"];function y(t,e,r){if(!t)return!1;if(t._isLinkedToArray)if(x(e[r]))r++;else if(r=a.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!x(o))return!1;t=a[i][o]}else t=a[i]}else t=a}}return t}function x(t){return t===Math.round(t)&&t>=0}function b(t){return function(t){r.crawl(t,function(t,e,n){r.isValObject(t)?"data_array"===t.valType?(t.role="data",n[e+"src"]={valType:"string",editType:"none"}):!0===t.arrayOk&&(n[e+"src"]={valType:"string",editType:"none"}):d(t)&&(t.role="object")})}(t),function(t){r.crawl(t,function(t,e,r){if(!t)return;var n=t[m];if(!n)return;delete t[m],r[e]={items:{}},r[e].items[n]=t,r[e].role="object"})}(t),function(t){!function t(e){for(var r in e)if(d(e[r]))t(e[r]);else if(Array.isArray(e[r]))for(var n=0;n=l.length)return!1;i=(r=(n.transformsRegistry[l[u].type]||{}).attributes)&&r[e[2]],s=3}else if("area"===t.type)i=c[o];else{var f=t._module;if(f||(f=(n.modules[t.type||a.type.dflt]||{})._module),!f)return!1;if(!(i=(r=f.attributes)&&r[o])){var h=f.basePlotModule;h&&h.attributes&&(i=h.attributes[o])}i||(i=a[o])}return y(i,e,s)},r.getLayoutValObject=function(t,e){return y(function(t,e){var r,i,a,s,l=t._basePlotModules;if(l){var c;for(r=0;r=t[1]||i[1]<=t[0])&&a[0]e[0])return!0}return!1}(r,n,k)){var s=a.node(),l=e.bg=o.ensureSingle(a,"rect","bg");s.insertBefore(l.node(),s.childNodes[0])}else a.select("rect.bg").remove(),w.push(t),k.push([r,n])});var M=i._bgLayer.selectAll(".bg").data(w);return M.enter().append("rect").classed("bg",!0),M.exit().remove(),M.each(function(t){i._plots[t].bg=n.select(this)}),b.each(function(t){var e=i._plots[t],r=e.xaxis,n=e.yaxis;e.bg&&d&&e.bg.call(c.setRect,r._offset-s,n._offset-s,r._length+2*s,n._length+2*s).call(l.fill,i.plot_bgcolor).style("stroke-width",0);var a,f,h=e.clipId="clip"+i._uid+t+"plot",p=o.ensureSingleById(i._clips,"clipPath",h,function(t){t.classed("plotclip",!0).append("rect")});if(e.clipRect=p.select("rect").attr({width:r._length,height:n._length}),c.setTranslate(e.plot,r._offset,n._offset),e._hasClipOnAxisFalse?(a=null,f=h):(a=h,f=null),c.setClipUrl(e.plot,a),e.layerClipId=f,d){var m,v,y,b,w,k,M,A,T,S,C,E,L,z="M0,0";x(r,t)&&(w=_(r,"left",n,u),m=r._offset-(w?s+w:0),k=_(r,"right",n,u),v=r._offset+r._length+(k?s+k:0),y=g(r,n,"bottom"),b=g(r,n,"top"),(L=!r._anchorAxis||t!==r._mainSubplot)&&r.ticks&&"allticks"===r.mirror&&(r._linepositions[t]=[y,b]),z=I(r,D,function(t){return"M"+r._offset+","+t+"h"+r._length}),L&&r.showline&&("all"===r.mirror||"allticks"===r.mirror)&&(z+=D(y)+D(b)),e.xlines.style("stroke-width",r._lw+"px").call(l.stroke,r.showline?r.linecolor:"rgba(0,0,0,0)")),e.xlines.attr("d",z);var P="M0,0";x(n,t)&&(C=_(n,"bottom",r,u),M=n._offset+n._length+(C?s:0),E=_(n,"top",r,u),A=n._offset-(E?s:0),T=g(n,r,"left"),S=g(n,r,"right"),(L=!n._anchorAxis||t!==r._mainSubplot)&&n.ticks&&"allticks"===n.mirror&&(n._linepositions[t]=[T,S]),P=I(n,O,function(t){return"M"+t+","+n._offset+"v"+n._length}),L&&n.showline&&("all"===n.mirror||"allticks"===n.mirror)&&(P+=O(T)+O(S)),e.ylines.style("stroke-width",n._lw+"px").call(l.stroke,n.showline?n.linecolor:"rgba(0,0,0,0)")),e.ylines.attr("d",P)}function D(t){return"M"+m+","+t+"H"+v}function O(t){return"M"+t+","+A+"V"+M}function I(e,r,n){if(!e.showline||t!==e._mainSubplot)return"";if(!e._anchorAxis)return n(e._mainLinePosition);var i=r(e._mainLinePosition);return e.mirror&&(i+=r(e._mainMirrorPosition)),i}}),h.makeClipPaths(t),r.drawMainTitle(t),f.manage(t),t._promises.length&&Promise.all(t._promises)},r.drawMainTitle=function(t){var e=t._fullLayout;u.draw(t,"gtitle",{propContainer:e,propName:"title",placeholder:e._dfltTitle.plot,attributes:{x:e.width/2,y:e._size.t/2,"text-anchor":"middle"}})},r.doTraceStyle=function(t){for(var e=0;ex.length&&i.push(p("unused",a,v.concat(x.length)));var M,A,T,S,C,E=x.length,L=Array.isArray(k);if(L&&(E=Math.min(E,k.length)),2===b.dimensions)for(A=0;Ax[A].length&&i.push(p("unused",a,v.concat(A,x[A].length)));var z=x[A].length;for(M=0;M<(L?Math.min(z,k[A].length):z);M++)T=L?k[A][M]:k,S=y[A][M],C=x[A][M],n.validate(S,T)?C!==S&&C!==+S&&i.push(p("dynamic",a,v.concat(A,M),S,C)):i.push(p("value",a,v.concat(A,M),S))}else i.push(p("array",a,v.concat(A),y[A]));else for(A=0;A1&&h.push(p("object","layout"))),i.supplyDefaults(d);for(var g=d._fullData,m=r.length,v=0;v0&&c>0&&u/c>d&&(o=n,l=a,d=u/c);if(h===p){var y=h-1,x=h+1;f="tozero"===t.rangemode?h<0?[y,0]:[0,x]:"nonnegative"===t.rangemode?[Math.max(0,y),Math.max(0,x)]:[y,x]}else d&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(o.val>=0&&(o={val:0,pad:0}),l.val<=0&&(l={val:0,pad:0})):"nonnegative"===t.rangemode&&(o.val-d*m(o)<0&&(o={val:0,pad:0}),l.val<0&&(l={val:1,pad:0})),d=(l.val-o.val)/(t._length-m(o)-m(l))),f=[o.val-d*m(o),l.val+d*m(l)]);return f[0]===f[1]&&("tozero"===t.rangemode?f=f[0]<0?[f[0],0]:f[0]>0?[0,f[0]]:[0,1]:(f=[f[0]-1,f[0]+1],"nonnegative"===t.rangemode&&(f[0]=Math.max(0,f[0])))),g&&f.reverse(),i.simpleMap(f,t.l2r||Number)}function s(t){var e=t._length/20;return"domain"===t.constrain&&t._inputDomain&&(e*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0])),function(t){return t.pad+(t.extrapad?e:0)}}function l(t){return n(t)&&Math.abs(t)=e}e.exports={getAutoRange:o,makePadFn:s,doAutoRange:function(t){t._length||t.setScale();var e,r=t._min&&t._max&&t._min.length&&t._max.length;t.autorange&&r&&(t.range=o(t),t._r=t.range.slice(),t._rl=i.simpleMap(t._r,t.r2l),(e=t._input).range=t.range.slice(),e.autorange=t.autorange);if(t._anchorAxis&&t._anchorAxis.rangeslider){var n=t._anchorAxis.rangeslider[t._name];n&&"auto"===n.rangemode&&(n.range=r?o(t):t._rangeInitial?t._rangeInitial.slice():t.range.slice()),(e=t._anchorAxis._input).rangeslider[t._name]=i.extendFlat({},n)}},expand:function(t,e,r){if(!function(t){return t.autorange||t._rangesliderAutorange}(t)||!e)return;t._min||(t._min=[]);t._max||(t._max=[]);r||(r={});t._m||t.setScale();var i,o,s,f,h,p,d,g,m,v,y,x,b=e.length,_=r.padded||!1,w=r.tozero&&("linear"===t.type||"-"===t.type),k="log"===t.type,M=!1;function A(t){if(Array.isArray(t))return M=!0,function(e){return Math.max(Number(t[e]||0),0)};var e=Math.max(Number(t||0),0);return function(){return e}}var T=A((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),S=A((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),C=A(r.vpadplus||r.vpad),E=A(r.vpadminus||r.vpad);if(!M){if(y=1/0,x=-1/0,k)for(i=0;i0&&(y=f),f>x&&f-a&&(y=f),f>x&&f=b&&(f.extrapad||!_)){v=!1;break}M(i,f.val)&&f.pad<=b&&(_||!f.extrapad)&&(a.splice(o,1),o--)}if(v){var A=w&&0===i;a.push({val:i,pad:A?0:b,extrapad:!A&&_})}}}}var z=Math.min(6,b);for(i=0;i=z;i--)L(i)}}},{"../../constants/numerical":637,"../../lib":660,"fast-isnumeric":197}],706:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../../plots/plots"),o=t("../../registry"),s=t("../../lib"),l=t("../../lib/svg_text_utils"),c=t("../../components/titles"),u=t("../../components/color"),f=t("../../components/drawing"),h=t("../../constants/numerical"),p=h.ONEAVGYEAR,d=h.ONEAVGMONTH,g=h.ONEDAY,m=h.ONEHOUR,v=h.ONEMIN,y=h.ONESEC,x=h.MINUS_SIGN,b=h.BADNUM,_=t("../../constants/alignment").MID_SHIFT,w=t("../../constants/alignment").LINE_SPACING,k=e.exports={};k.setConvert=t("./set_convert");var M=t("./axis_autotype"),A=t("./axis_ids");k.id2name=A.id2name,k.name2id=A.name2id,k.cleanId=A.cleanId,k.list=A.list,k.listIds=A.listIds,k.getFromId=A.getFromId,k.getFromTrace=A.getFromTrace;var T=t("./autorange");k.expand=T.expand,k.getAutoRange=T.getAutoRange,k.coerceRef=function(t,e,r,n,i,a){var o=n.charAt(n.length-1),l=r._fullLayout._subplots[o+"axis"],c=n+"ref",u={};return i||(i=l[0]||a),a||(a=i),u[c]={valType:"enumerated",values:l.concat(a?[a]:[]),dflt:i},s.coerce(t,e,u,c)},k.coercePosition=function(t,e,r,n,i,a){var o,l;if("paper"===n||"pixel"===n)o=s.ensureNumber,l=r(i,a);else{var c=k.getFromId(e,n);l=r(i,a=c.fraction2r(a)),o=c.cleanPos}t[i]=o(l)},k.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?s.ensureNumber:k.getFromId(e,r).cleanPos)(t)};var S=k.getDataConversions=function(t,e,r,n){var i,a="x"===r||"y"===r||"z"===r?r:n;if(Array.isArray(a)){if(i={type:M(n),_categories:[]},k.setConvert(i),"category"===i.type)for(var o=0;o2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},k.saveRangeInitial=function(t,e){for(var r=k.list(t,"",!0),n=!1,i=0;i.3*h||u(n)||u(a))){var p=r.dtick/2;t+=t+p.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=k.tickIncrement(t,"M6","reverse")+1.5*g:a.exactMonths>.8?t=k.tickIncrement(t,"M1","reverse")+15.5*g:t-=g/2;var l=k.tickIncrement(t,r);if(l<=n)return l}return t}(m,t,l.dtick,c,a)),d=m,0;d<=u;)d=k.tickIncrement(d,l.dtick,!1,a),0;return{start:e.c2r(m,0,a),end:e.c2r(d,0,a),size:l.dtick,_dataSpan:u-c}},k.prepTicks=function(t){var e=s.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=s.constrain(t._length/r,4,9)+1),"radialaxis"===t._name&&(n*=2)),"array"===t.tickmode&&(n*=100),k.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),F(t)},k.calcTicks=function(t){k.prepTicks(t);var e=s.simpleMap(t.range,t.r2l);if("array"===t.tickmode)return function(t){var e,r,n=t.tickvals,i=t.ticktext,a=new Array(n.length),o=s.simpleMap(t.range,t.r2l),l=1.0001*o[0]-1e-4*o[1],c=1.0001*o[1]-1e-4*o[0],u=Math.min(l,c),f=Math.max(l,c),h=0;Array.isArray(i)||(i=[]);var p="category"===t.type?t.d2l_noadd:t.d2l;"log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1));for(r=0;ru&&e=n:c<=n)&&!(a.length>l||c===o);c=k.tickIncrement(c,t.dtick,i,t.calendar))o=c,a.push(c);"angular"===t._id&&360===Math.abs(e[1]-e[0])&&a.pop(),t._tmax=a[a.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var u=new Array(a.length),f=0;f10||"01-01"!==n.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=g&&a<=10||e>=15*g)t._tickround="d";else if(e>=v&&a<=16||e>=m)t._tickround="M";else if(e>=y&&a<=19||e>=v)t._tickround="S";else{var o=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(i(e)||"L"===e.charAt(0)){var s=t.range.map(t.r2d||Number);i(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(s[0]),Math.abs(s[1])),c=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(c)>3&&(V(t.exponentformat)&&!U(c)?t._tickexponent=3*Math.round((c-1)/3):t._tickexponent=c)}else t._tickround=null}function N(t,e,r){var n=t.tickfont||{};return{x:e,dx:0,dy:0,text:r||"",fontSize:n.size,font:n.family,fontColor:n.color}}k.autoTicks=function(t,e){var r;function n(t){return Math.pow(t,Math.floor(Math.log(e)/Math.LN10))}if("date"===t.type){t.tick0=s.dateTick0(t.calendar);var a=2*e;a>p?(e/=p,r=n(10),t.dtick="M"+12*B(e,r,L)):a>d?(e/=d,t.dtick="M"+B(e,1,z)):a>g?(t.dtick=B(e,g,D),t.tick0=s.dateTick0(t.calendar,!0)):a>m?t.dtick=B(e,m,z):a>v?t.dtick=B(e,v,P):a>y?t.dtick=B(e,y,P):(r=n(10),t.dtick=B(e,r,L))}else if("log"===t.type){t.tick0=0;var o=s.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var l=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/l,r=n(10),t.dtick="L"+B(e,r,L)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):"angular"===t._id?(t.tick0=0,r=1,t.dtick=B(e,r,R)):(t.tick0=0,r=n(10),t.dtick=B(e,r,L));if(0===t.dtick&&(t.dtick=1),!i(t.dtick)&&"string"!=typeof t.dtick){var c=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(c)}},k.tickIncrement=function(t,e,r,a){var o=r?-1:1;if(i(e))return t+o*e;var l=e.charAt(0),c=o*Number(e.substr(1));if("M"===l)return s.incrementMonth(t,c,a);if("L"===l)return Math.log(Math.pow(10,t)+c)/Math.LN10;if("D"===l){var u="D2"===e?I:O,f=t+.01*o,h=s.roundUp(s.mod(f,1),u,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(e)},k.tickFirst=function(t){var e=t.r2l||Number,r=s.simpleMap(t.range,e),a=r[1]"+l,t._prevDateHead=l));e.text=c}(t,o,r,c):"log"===t.type?function(t,e,r,n,a){var o=t.dtick,l=e.x,c=t.tickformat;"never"===a&&(a="");!n||"string"==typeof o&&"L"===o.charAt(0)||(o="L3");if(c||"string"==typeof o&&"L"===o.charAt(0))e.text=q(Math.pow(10,l),t,a,n);else if(i(o)||"D"===o.charAt(0)&&s.mod(l+.01,1)<.1){var u=Math.round(l);-1!==["e","E","power"].indexOf(t.exponentformat)||V(t.exponentformat)&&U(u)?(e.text=0===u?1:1===u?"10":u>1?"10"+u+"":"10"+x+-u+"",e.fontSize*=1.25):(e.text=q(Math.pow(10,l),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,s.mod(l,1)))),e.fontSize*=.75}if("D1"===t.dtick){var f=String(e.text).charAt(0);"0"!==f&&"1"!==f||("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*(l<0?.5:.25)))}}(t,o,0,c,n):"category"===t.type?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r="");e.text=String(r)}(t,o):"angular"===t._id?function(t,e,r,n,i){if("radians"!==t.thetaunit||r)e.text=q(e.x,t,i,n);else{var a=e.x/180;if(0===a)e.text="0";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}var r=function(t){var r=1;for(;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),n=t*r,i=Math.abs(function t(r,n){return e(n,0)?r:t(n,r%n)}(n,r));return[Math.round(n/i),Math.round(r/i)]}(a);if(o[1]>=100)e.text=q(s.deg2rad(e.x),t,i,n);else{var l=e.x<0;1===o[1]?1===o[0]?e.text="\u03c0":e.text=o[0]+"\u03c0":e.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),l&&(e.text=x+e.text)}}}}(t,o,r,c,n):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide");e.text=q(e.x,t,i,n)}(t,o,0,c,n),t.tickprefix&&!p(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!p(t.showticksuffix)&&(o.text+=t.ticksuffix),o},k.hoverLabelText=function(t,e,r){if(r!==b&&r!==e)return k.hoverLabelText(t,e)+" - "+k.hoverLabelText(t,r);var n="log"===t.type&&e<=0,i=k.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":x+i:i};var j=["f","p","n","\u03bc","m","","k","M","G","T"];function V(t){return"SI"===t||"B"===t}function U(t){return t>14||t<-15}function q(t,e,r,n){var a=t<0,o=e._tickround,l=r||e.exponentformat||"B",c=e._tickexponent,u=k.getTickFormat(e),f=e.separatethousands;if(n){var h={exponentformat:l,dtick:"none"===e.showexponent?e.dtick:i(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};F(h),o=(Number(h._tickround)||0)+4,c=h._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return e._numFormat(u)(t).replace(/-/g,x);var p,d=Math.pow(10,-o)/2;if("none"===l&&(c=0),(t=Math.abs(t))"+p+"":"B"===l&&9===c?t+="B":V(l)&&(t+=j[c/3+5]));return a?x+t:t}function H(t,e){for(var r=0;r=0,a=c(t,e[1])<=0;return(r||i)&&(n||a)}if(t.tickformatstops&&t.tickformatstops.length>0)switch(t.type){case"date":case"linear":for(e=0;e=a(n))){r=t.tickformatstops[e];break}break;case"log":for(e=0;e1&&e1)for(n=1;n2*o}(t,e)?"date":function(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,o=0,s=0;s2*n}(t)?"category":function(t){if(!t)return!1;for(var e=0;en?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)}},{"../../registry":790,"./constants":711}],710:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){if("category"===e.type){var i,a=t.categoryarray,o=Array.isArray(a)&&a.length>0;o&&(i="array");var s,l=r("categoryorder",i);"array"===l&&(s=r("categoryarray")),o||"array"!==l||(l=e.categoryorder="trace"),"trace"===l?e._initialCategories=[]:"array"===l?e._initialCategories=s.slice():(s=function(t,e){var r,n,i,a=e.dataAttr||t._id.charAt(0),o={};if(e.axData)r=e.axData;else for(r=[],n=0;no*y)||w)for(r=0;rP&&IL&&(L=I);h/=(L-E)/(2*z),E=c.l2r(E),L=c.l2r(L),c.range=c._input.range=T=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function P(t,e,r,n,i){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",i+"Z")}function D(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function O(t,e,r,n,i,a){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z"),I(t,e,i,a)}function I(t,e,r,n){r||(t.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function R(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function B(t){A&&t.data&&t._context.showTips&&(s.notifier(s._(t,"Double-click to zoom back out"),"long"),A=!1)}function F(t){return"lasso"===t||"select"===t}function N(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,M)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function j(t,e){if(a){var r=void 0!==t.onwheel?"wheel":"mousewheel";t._onwheel&&t.removeEventListener(r,t._onwheel),t._onwheel=e,t.addEventListener(r,e,{passive:!1})}else void 0!==t.onwheel?t.onwheel=e:void 0!==t.onmousewheel&&(t.onmousewheel=e)}function V(t){var e=[];for(var r in t)e.push(t[r]);return e}e.exports={makeDragBox:function(t,e,r,a,u,p,A,T){var I,U,q,H,G,W,Y,X,Z,J,K,Q,$,tt,et,rt,nt,it,at,ot,st,lt=t._fullLayout._zoomlayer,ct=A+T==="nsew",ut=1===(A+T).length;function ft(){if(I=e.xaxis,U=e.yaxis,Z=I._length,J=U._length,Y=I._offset,X=U._offset,(q={})[I._id]=I,(H={})[U._id]=U,A&&T)for(var r=e.overlays,n=0;nM||o>M?(bt="xy",a/Z>o/J?(o=a*J/Z,gt>i?mt.t=gt-o:mt.b=gt+o):(a=o*Z/J,dt>n?mt.l=dt-a:mt.r=dt+a),wt.attr("d",N(mt))):s():!$||o10||r.scrollWidth-r.clientWidth>10)){clearTimeout(zt);var n=-e.deltaY;if(isFinite(n)||(n=e.wheelDelta/10),isFinite(n)){var i,a=Math.exp(-Math.min(Math.max(n,-20),20)/200),o=Dt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-o.left)/o.width,c=(o.bottom-e.clientY)/o.height;if(rt){for(T||(l=.5),i=0;ig[1]-.01&&(e.domain=s),i.noneOrAll(t.domain,e.domain,s)}return r("layer"),e}},{"../../lib":660,"fast-isnumeric":197}],722:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function(t,e,r){void 0===r&&(r=n[t.constraintoward||"center"]);var i=[t.r2l(t.range[0]),t.r2l(t.range[1])],a=i[0]+(i[1]-i[0])*r;t.range=t._input.range=[t.l2r(a+(i[0]-a)*e),t.l2r(a+(i[1]-a)*e)]}},{"../../constants/alignment":632}],723:[function(t,e,r){"use strict";var n=t("polybooljs"),i=t("../../registry"),a=t("../../components/color"),o=t("../../components/fx"),s=t("../../lib/polygon"),l=t("../../lib/throttle"),c=t("../../components/fx/helpers").makeEventData,u=t("./axis_ids").getFromId,f=t("../sort_modules").sortModules,h=t("./constants"),p=h.MINSELECT,d=s.filter,g=s.tester,m=s.multitester;function v(t){return t._id}function y(t,e,r){var n,a,o,s;if(r){var l=r.points||[];for(n=0;n0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*u*Math.abs(n-i))}return h}function v(e,r,n){var a=l(e,n||t.calendar);if(a===h){if(!i(e))return h;a=l(new Date(+e))}return a}function y(e,r,n){return s(e,r,n||t.calendar)}function x(e){return t._categories[Math.round(e)]}function b(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(i(e))return+e}function _(e){return i(e)?n.round(t._b+t._m*e,2):h}function w(e){return(e-t._b)/t._m}t.c2l="log"===t.type?m:c,t.l2c="log"===t.type?g:c,t.l2p=_,t.p2l=w,t.c2p="log"===t.type?function(t,e){return _(m(t,e))}:_,t.p2c="log"===t.type?function(t){return g(w(t))}:w,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=o,t.c2d=t.c2r=t.l2d=t.l2r=c,t.d2p=t.r2p=function(e){return t.l2p(o(e))},t.p2d=t.p2r=w,t.cleanPos=c):"log"===t.type?(t.d2r=t.d2l=function(t,e){return m(o(t),e)},t.r2d=t.r2c=function(t){return g(o(t))},t.d2c=t.r2l=o,t.c2d=t.l2r=c,t.c2r=m,t.l2d=g,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return g(w(t))},t.r2p=function(e){return t.l2p(o(e))},t.p2r=w,t.cleanPos=c):"date"===t.type?(t.d2r=t.r2d=a.identity,t.d2c=t.r2c=t.d2l=t.r2l=v,t.c2d=t.c2r=t.l2d=t.l2r=y,t.d2p=t.r2p=function(e,r,n){return t.l2p(v(e,0,n))},t.p2d=t.p2r=function(t,e,r){return y(w(t),e,r)},t.cleanPos=function(e){return a.cleanDate(e,h,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=function(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return h},t.r2d=t.c2d=t.l2d=x,t.d2r=t.d2l_noadd=b,t.r2c=function(e){var r=b(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=c,t.r2l=b,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return x(w(t))},t.r2p=t.d2p,t.p2r=w,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:c(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e,n){n||(n={}),e||(e="range");var o,s,l=a.nestedProperty(t,e).get();if(s=(s="date"===t.type?a.dfltRange(t.calendar):"y"===r?p.DFLTRANGEY:n.dfltRange||p.DFLTRANGEX).slice(),l&&2===l.length)for("date"===t.type&&(l[0]=a.cleanDate(l[0],h,t.calendar),l[1]=a.cleanDate(l[1],h,t.calendar)),o=0;o<2;o++)if("date"===t.type){if(!a.isDateTime(l[o],t.calendar)){t[e]=s;break}if(t.r2l(l[0])===t.r2l(l[1])){var c=a.constrain(t.r2l(l[0]),a.MIN_MS+1e3,a.MAX_MS-1e3);l[0]=t.l2r(c-1e3),l[1]=t.l2r(c+1e3);break}}else{if(!i(l[o])){if(!i(l[1-o])){t[e]=s;break}l[o]=l[1-o]*(o?10:.1)}if(l[o]<-f?l[o]=-f:l[o]>f&&(l[o]=f),l[0]===l[1]){var u=Math.max(1,Math.abs(1e-6*l[0]));l[0]-=u,l[1]+=u}}else a.nestedProperty(t,e).set(s)},t.setScale=function(n){var i=e._size;if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var a=d.getFromId({_fullLayout:e},t.overlaying);t.domain=a.domain}var o=n&&t._r?"_r":"range",s=t.calendar;t.cleanRange(o);var l=t.r2l(t[o][0],s),c=t.r2l(t[o][1],s);if("y"===r?(t._offset=i.t+(1-t.domain[1])*i.h,t._length=i.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-c),t._b=-t._m*c):(t._offset=i.l+t.domain[0]*i.w,t._length=i.w*(t.domain[1]-t.domain[0]),t._m=t._length/(c-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw e._replotting=!1,new Error("Something went wrong with axis scaling")},t.makeCalcdata=function(e,r){var n,i,o,s,l=t.type,c="date"===l&&e[r+"calendar"];if(r in e){if(n=e[r],s=e._length||n.length,a.isTypedArray(n)&&("linear"===l||"log"===l)){if(s===n.length)return n;if(n.subarray)return n.subarray(0,s)}for(i=new Array(s),o=0;o0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),h=u.substr(1);((h=n(h)?Number(h):0)<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=c)}var p="date"===o?i.dateTick0(e.calendar):0,d=r("tick0",p);"date"===o?e.tick0=i.cleanDate(d,p):n(d)&&"D1"!==u&&"D2"!==u?e.tick0=Number(d):e.tick0=p}else{void 0===r("tickvals")?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":637,"../../lib":660,"fast-isnumeric":197}],728:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../registry"),a=t("../../components/drawing"),o=t("./axes"),s=t("./constants").attrRegex;e.exports=function(t,e,r,l){var c=t._fullLayout,u=[];var f,h,p,d,g=function(t){var e,r,n,i,a={};for(e in t)if((r=e.split("."))[0].match(s)){var o=e.charAt(0),l=r[0];if(n=c[l],i={},Array.isArray(t[e])?i.to=t[e].slice(0):Array.isArray(t[e].range)&&(i.to=t[e].range.slice(0)),!i.to)continue;i.axisName=l,i.length=n._length,u.push(o),a[o]=i}return a}(e),m=Object.keys(g),v=function(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(-1===s.indexOf(l)){var c=l.xaxis._id,u=l.yaxis._id,f=l.xaxis.range,h=l.yaxis.range;l.xaxis._r=l.xaxis.range.slice(),l.yaxis._r=l.yaxis.range.slice(),i=r[c]?r[c].to:f,a=r[u]?r[u].to:h,f[0]===i[0]&&f[1]===i[1]&&h[0]===a[0]&&h[1]===a[1]||-1===e.indexOf(c)&&-1===e.indexOf(u)||s.push(l)}}return s}(c,m,g);if(!v.length)return function(){function e(e,r,n){for(var i=0;i rect").call(a.setTranslate,0,0).call(a.setScale,1,1),t.plot.call(a.setTranslate,e._offset,r._offset).call(a.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(a.setPointGroupScale,1,1),n.selectAll(".textpoint").call(a.setTextPointsScale,1,1),n.call(a.hideOutsideRangePoints,t)}function x(e,r){var n,s,l,u=g[e.xaxis._id],f=g[e.yaxis._id],h=[];if(u){s=(n=t._fullLayout[u.axisName])._r,l=u.to,h[0]=(s[0]*(1-r)+r*l[0]-s[0])/(s[1]-s[0])*e.xaxis._length;var p=s[1]-s[0],d=l[1]-l[0];n.range[0]=s[0]*(1-r)+r*l[0],n.range[1]=s[1]*(1-r)+r*l[1],h[2]=e.xaxis._length*(1-r+r*d/p)}else h[0]=0,h[2]=e.xaxis._length;if(f){s=(n=t._fullLayout[f.axisName])._r,l=f.to,h[1]=(s[1]*(1-r)+r*l[1]-s[1])/(s[0]-s[1])*e.yaxis._length;var m=s[1]-s[0],v=l[1]-l[0];n.range[0]=s[0]*(1-r)+r*l[0],n.range[1]=s[1]*(1-r)+r*l[1],h[3]=e.yaxis._length*(1-r+r*v/m)}else h[1]=0,h[3]=e.yaxis._length;!function(e,r){var n,a=[];for(a=[e._id,r._id],n=0;nr.duration?(function(){for(var e={},r=0;r0&&i["_"+r+"axes"][e])return i;if((i[r+"axis"]||r)===e){if(s(i,r))return i;if((i[r]||[]).length||i[r+"0"])return i}}}(e,r,a);if(!l)return;if("histogram"===l.type&&a==={v:"y",h:"x"}[l.orientation||"v"])return void(t.type="linear");var c,u=a+"calendar",f=l[u];if(s(l,a)){var h=o(l),p=[];for(c=0;c0?".":"")+a;i.isPlainObject(o)?l(o,e,s,n+1):e(s,a,o)}})}r.manageCommandObserver=function(t,e,n,o){var s={},l=!0;e&&e._commandObserver&&(s=e._commandObserver),s.cache||(s.cache={}),s.lookupTable={};var c=r.hasSimpleAPICommandBindings(t,n,s.lookupTable);if(e&&e._commandObserver){if(c)return s;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,s}if(c){a(t,c,s.cache),s.check=function(){if(l){var e=a(t,c,s.cache);return e.changed&&o&&void 0!==s.lookupTable[e.value]&&(s.disable(),Promise.resolve(o({value:e.value,type:c.type,prop:c.prop,traces:c.traces,index:s.lookupTable[e.value]})).then(s.enable,s.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],f=0;fi*Math.PI/180}return!1},r.getPath=function(){return n.geo.path().projection(r)},r.getBounds=function(t){return r.getPath().bounds(t)},r.fitExtent=function(t,e){var n=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=r.clipExtent&&r.clipExtent();r.scale(150).translate([0,0]),a&&r.clipExtent(null);var o=r.getBounds(e),s=Math.min(n/(o[1][0]-o[0][0]),i/(o[1][1]-o[0][1])),l=+t[0][0]+(n-s*(o[1][0]+o[0][0]))/2,c=+t[0][1]+(i-s*(o[1][1]+o[0][1]))/2;return a&&r.clipExtent(a),r.scale(150*s).translate([l,c])},r.precision(d.precision),i&&r.clipAngle(i-d.clipPad);return r}(e);u.center([c.lon-l.lon,c.lat-l.lat]).rotate([-l.lon,-l.lat,l.roll]).parallels(s.parallels);var f=[[r.l+r.w*o.x[0],r.t+r.h*(1-o.y[1])],[r.l+r.w*o.x[1],r.t+r.h*(1-o.y[0])]],h=e.lonaxis,p=e.lataxis,g=function(t,e){var r=d.clipPad,n=t[0]+r,i=t[1]-r,a=e[0]+r,o=e[1]-r;n>0&&i<0&&(i+=360);var s=(i-n)/4;return{type:"Polygon",coordinates:[[[n,a],[n,o],[n+s,o],[n+2*s,o],[n+3*s,o],[i,o],[i,a],[i-s,a],[i-2*s,a],[i-3*s,a],[n,a]]]}}(h.range,p.range);u.fitExtent(f,g);var m=this.bounds=u.getBounds(g),v=this.fitScale=u.scale(),y=u.translate();if(!isFinite(m[0][0])||!isFinite(m[0][1])||!isFinite(m[1][0])||!isFinite(m[1][1])||isNaN(y[0])||isNaN(y[0])){for(var x=this.graphDiv,b=["projection.rotation","center","lonaxis.range","lataxis.range"],_="Invalid geo settings, relayout'ing to default view.",w={},k=0;k0&&w<0&&(w+=360);var k,M,A,T=(_+w)/2;if(!c){var S=u?s.projRotate:[T,0,0];k=r("projection.rotation.lon",S[0]),r("projection.rotation.lat",S[1]),r("projection.rotation.roll",S[2]),r("showcoastlines",!u)&&(r("coastlinecolor"),r("coastlinewidth")),r("showocean")&&r("oceancolor")}(c?(M=-96.6,A=38.7):(M=u?T:k,A=(b[0]+b[1])/2),r("center.lon",M),r("center.lat",A),f)&&r("projection.parallels",s.projParallels||[0,60]);r("projection.scale"),r("showland")&&r("landcolor"),r("showlakes")&&r("lakecolor"),r("showrivers")&&(r("rivercolor"),r("riverwidth")),r("showcountries",u&&"usa"!==a)&&(r("countrycolor"),r("countrywidth")),("usa"===a||"north america"===a&&50===n)&&(r("showsubunits",!0),r("subunitcolor"),r("subunitwidth")),u||r("showframe",!0)&&(r("framecolor"),r("framewidth")),r("bgcolor")}e.exports=function(t,e,r){n(t,e,r,{type:"geo",attributes:a,handleDefaults:s,partition:"y"})}},{"../../subplot_defaults":782,"../constants":734,"./layout_attributes":739}],739:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("../../domain").attributes,a=t("../constants"),o=t("../../../plot_api/edit_types").overrideAll,s={range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},showgrid:{valType:"boolean",dflt:!1},tick0:{valType:"number"},dtick:{valType:"number"},gridcolor:{valType:"color",dflt:n.lightLine},gridwidth:{valType:"number",min:0,dflt:1}};e.exports=o({domain:i({name:"geo"},{}),resolution:{valType:"enumerated",values:[110,50],dflt:110,coerceNumber:!0},scope:{valType:"enumerated",values:Object.keys(a.scopeDefaults),dflt:"world"},projection:{type:{valType:"enumerated",values:Object.keys(a.projNames)},rotation:{lon:{valType:"number"},lat:{valType:"number"},roll:{valType:"number"}},parallels:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},scale:{valType:"number",min:0,dflt:1}},center:{lon:{valType:"number"},lat:{valType:"number"}},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:a.landColor},showocean:{valType:"boolean",dflt:!1},oceancolor:{valType:"color",dflt:a.waterColor},showlakes:{valType:"boolean",dflt:!1},lakecolor:{valType:"color",dflt:a.waterColor},showrivers:{valType:"boolean",dflt:!1},rivercolor:{valType:"color",dflt:a.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"},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:s,lataxis:s},"plot","from-root")},{"../../../components/color/attributes":531,"../../../plot_api/edit_types":691,"../../domain":731,"../constants":734}],740:[function(t,e,r){"use strict";e.exports=function(t){function e(t,e){return{type:"Feature",id:t.id,properties:t.properties,geometry:r(t.geometry,e)}}function r(e,n){if(!e)return null;if("GeometryCollection"===e.type)return{type:"GeometryCollection",geometries:object.geometries.map(function(t){return r(t,n)})};if(!c.hasOwnProperty(e.type))return null;var i=c[e.type];return t.geo.stream(e,n(i)),i.result()}t.geo.project=function(t,e){var i=e.stream;if(!i)throw new Error("not yet supported");return(t&&n.hasOwnProperty(t.type)?n[t.type]:r)(t,i)};var n={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},i=[],a=[],o={point:function(t,e){i.push([t,e])},result:function(){var t=i.length?i.length<2?{type:"Point",coordinates:i[0]}:{type:"MultiPoint",coordinates:i}:null;return i=[],t}},s={lineStart:u,point:function(t,e){i.push([t,e])},lineEnd:function(){i.length&&(a.push(i),i=[])},result:function(){var t=a.length?a.length<2?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a}:null;return a=[],t}},l={polygonStart:u,lineStart:u,point:function(t,e){i.push([t,e])},lineEnd:function(){var t=i.length;if(t){do{i.push(i[0].slice())}while(++t<4);a.push(i),i=[]}},polygonEnd:u,result:function(){if(!a.length)return null;var t=[],e=[];return a.forEach(function(r){!function(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];++rn^p>n&&r<(h-c)*(n-u)/(p-u)+c&&(i=!i)}return i}(t[0],r))return t.push(e),!0})||t.push([e])}),a=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},c={Point:o,MultiPoint:o,LineString:s,MultiLineString:s,Polygon:l,MultiPolygon:l,Sphere:l};function u(){}var f=1e-6,h=f*f,p=Math.PI,d=p/2,g=(Math.sqrt(p),p/180),m=180/p;function v(t){return t>1?d:t<-1?-d:Math.asin(t)}function y(t){return t>1?0:t<-1?p:Math.acos(t)}var x=t.geo.projection,b=t.geo.projectionMutator;function _(t,e){var r=(2+d)*Math.sin(e);e/=2;for(var n=0,i=1/0;n<10&&Math.abs(i)>f;n++){var a=Math.cos(e);e-=i=(e+Math.sin(e)*(a+2)-r)/(2*a*(1+a))}return[2/Math.sqrt(p*(4+p))*t*(1+Math.cos(e)),2*Math.sqrt(p/(4+p))*Math.sin(e)]}t.geo.interrupt=function(e){var r,n=[[[[-p,0],[0,d],[p,0]]],[[[-p,0],[0,-d],[p,0]]]];function i(t,r){for(var i=r<0?-1:1,a=n[+(r<0)],o=0,s=a.length-1;oa[o][2][0];++o);var l=e(t-a[o][1][0],r);return l[0]+=e(a[o][1][0],i*r>i*a[o][0][1]?a[o][0][1]:r)[0],l}e.invert&&(i.invert=function(t,a){for(var o=r[+(a<0)],s=n[+(a<0)],c=0,u=o.length;c=0;--i){var o=n[1][i],l=180*o[0][0]/p,c=180*o[0][1]/p,u=180*o[1][1]/p,f=180*o[2][0]/p,h=180*o[2][1]/p;r.push(s([[f-e,h-e],[f-e,u+e],[l+e,u+e],[l+e,c-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}(),l)},i},a.lobes=function(t){return arguments.length?(n=t.map(function(t){return t.map(function(t){return[[t[0][0]*p/180,t[0][1]*p/180],[t[1][0]*p/180,t[1][1]*p/180],[t[2][0]*p/180,t[2][1]*p/180]]})}),r=n.map(function(t){return t.map(function(t){var r,n=e(t[0][0],t[0][1])[0],i=e(t[2][0],t[2][1])[0],a=e(t[1][0],t[0][1])[1],o=e(t[1][0],t[1][1])[1];return a>o&&(r=a,a=o,o=r),[[n,a],[i,o]]})}),a):n.map(function(t){return t.map(function(t){return[[180*t[0][0]/p,180*t[0][1]/p],[180*t[1][0]/p,180*t[1][1]/p],[180*t[2][0]/p,180*t[2][1]/p]]})})},a},_.invert=function(t,e){var r=.5*e*Math.sqrt((4+p)/p),n=v(r),i=Math.cos(n);return[t/(2/Math.sqrt(p*(4+p))*(1+i)),v((n+r*(i+2))/(2+d))]},(t.geo.eckert4=function(){return x(_)}).raw=_;var w=t.geo.azimuthalEqualArea.raw;function k(t,e){if(arguments.length<2&&(e=t),1===e)return w;if(e===1/0)return M;function r(r,n){var i=w(r/e,n);return i[0]*=t,i}return r.invert=function(r,n){var i=w.invert(r/t,n);return i[0]*=e,i},r}function M(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function A(t,e){return[3*t/(2*p)*Math.sqrt(p*p/3-e*e),e]}function T(t,e){return[t,1.25*Math.log(Math.tan(p/4+.4*e))]}function S(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)>f&&--i>0);return e/2}}M.invert=function(t,e){var r=2*v(e/2);return[t*Math.cos(r/2)/Math.cos(r),r]},(t.geo.hammer=function(){var t=2,e=b(k),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}).raw=k,A.invert=function(t,e){return[2/3*p*t/Math.sqrt(p*p/3-e*e),e]},(t.geo.kavrayskiy7=function(){return x(A)}).raw=A,T.invert=function(t,e){return[t,2.5*Math.atan(Math.exp(.8*e))-.625*p]},(t.geo.miller=function(){return x(T)}).raw=T,S(p);var C=function(t,e,r){var n=S(r);function i(r,i){return[t*r*Math.cos(i=n(i)),e*Math.sin(i)]}return i.invert=function(n,i){var a=v(i/e);return[n/(t*Math.cos(a)),v((2*a+Math.sin(2*a))/r)]},i}(Math.SQRT2/d,Math.SQRT2,p);function E(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791)),e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))]}(t.geo.mollweide=function(){return x(C)}).raw=C,E.invert=function(t,e){var r,n=e,i=25;do{var a=n*n,o=a*a;n-=r=(n*(1.007226+a*(.015085+o*(.028874*a-.044475-.005916*o)))-e)/(1.007226+a*(.045255+o*(.259866*a-.311325-.005916*11*o)))}while(Math.abs(r)>f&&--i>0);return[t/(.8707+(a=n*n)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),n]},(t.geo.naturalEarth=function(){return x(E)}).raw=E;var L=[[.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]];function z(t,e){var r,n=Math.min(18,36*Math.abs(e)/p),i=Math.floor(n),a=n-i,o=(r=L[i])[0],s=r[1],l=(r=L[++i])[0],c=r[1],u=(r=L[Math.min(19,++i)])[0],f=r[1];return[t*(l+a*(u-o)/2+a*a*(u-2*l+o)/2),(e>0?d:-d)*(c+a*(f-s)/2+a*a*(f-2*c+s)/2)]}function P(t,e){return[t*Math.cos(e),e]}function D(t,e){var r,n=Math.cos(e),i=(r=y(n*Math.cos(t/=2)))?r/Math.sin(r):1;return[2*n*Math.sin(t)*i,Math.sin(e)*i]}function O(t,e){var r=D(t,e);return[(r[0]+t/d)/2,(r[1]+e)/2]}L.forEach(function(t){t[1]*=1.0144}),z.invert=function(t,e){var r=e/d,n=90*r,i=Math.min(18,Math.abs(n/5)),a=Math.max(0,Math.floor(i));do{var o=L[a][1],s=L[a+1][1],l=L[Math.min(19,a+2)][1],c=l-o,u=l-2*s+o,f=2*(Math.abs(r)-s)/c,p=u/c,v=f*(1-p*f*(1-2*p*f));if(v>=0||1===a){n=(e>=0?5:-5)*(v+i);var y,x=50;do{v=(i=Math.min(18,Math.abs(n)/5))-(a=Math.floor(i)),o=L[a][1],s=L[a+1][1],l=L[Math.min(19,a+2)][1],n-=(y=(e>=0?d:-d)*(s+v*(l-o)/2+v*v*(l-2*s+o)/2)-e)*m}while(Math.abs(y)>h&&--x>0);break}}while(--a>=0);var b=L[a][0],_=L[a+1][0],w=L[Math.min(19,a+2)][0];return[t/(_+v*(w-b)/2+v*v*(w-2*_+b)/2),n*g]},(t.geo.robinson=function(){return x(z)}).raw=z,P.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return x(P)}).raw=P,D.invert=function(t,e){if(!(t*t+4*e*e>p*p+f)){var r=t,n=e,i=25;do{var a,o=Math.sin(r),s=Math.sin(r/2),l=Math.cos(r/2),c=Math.sin(n),u=Math.cos(n),h=Math.sin(2*n),d=c*c,g=u*u,m=s*s,v=1-g*l*l,x=v?y(u*l)*Math.sqrt(a=1/v):a=0,b=2*x*u*s-t,_=x*c-e,w=a*(g*m+x*u*l*d),k=a*(.5*o*h-2*x*c*s),M=.25*a*(h*s-x*c*g*o),A=a*(d*l+x*m*u),T=k*M-A*w;if(!T)break;var S=(_*k-b*A)/T,C=(b*M-_*w)/T;r-=S,n-=C}while((Math.abs(S)>f||Math.abs(C)>f)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return x(D)}).raw=D,O.invert=function(t,e){var r=t,n=e,i=25;do{var a,o=Math.cos(n),s=Math.sin(n),l=Math.sin(2*n),c=s*s,u=o*o,h=Math.sin(r),p=Math.cos(r/2),g=Math.sin(r/2),m=g*g,v=1-u*p*p,x=v?y(o*p)*Math.sqrt(a=1/v):a=0,b=.5*(2*x*o*g+r/d)-t,_=.5*(x*s+n)-e,w=.5*a*(u*m+x*o*p*c)+.5/d,k=a*(h*l/4-x*s*g),M=.125*a*(l*g-x*s*u*h),A=.5*a*(c*p+x*m*o)+.5,T=k*M-A*w,S=(_*k-b*A)/T,C=(b*M-_*w)/T;r-=S,n-=C}while((Math.abs(S)>f||Math.abs(C)>f)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return x(O)}).raw=O}},{}],741:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=Math.PI/180,o=180/Math.PI,s={cursor:"pointer"},l={cursor:"auto"};function c(t,e){return n.behavior.zoom().translate(e.translate()).scale(e.scale())}function u(t,e,r){var n=t.id,a=t.graphDiv,o=a.layout[n],s=a._fullLayout[n],l={};function c(t,e){var r=i.nestedProperty(s,t);r.get()!==e&&(r.set(e),i.nestedProperty(o,t).set(e),l[n+"."+t]=e)}r(c),c("projection.scale",e.scale()/t.fitScale),a.emit("plotly_relayout",l)}function f(t,e){var r=c(0,e);function i(r){var n=e.invert(t.midPt);r("center.lon",n[0]),r("center.lat",n[1])}return r.on("zoomstart",function(){n.select(this).style(s)}).on("zoom",function(){e.scale(n.event.scale).translate(n.event.translate),t.render()}).on("zoomend",function(){n.select(this).style(l),u(t,e,i)}),r}function h(t,e){var r,i,a,o,f,h,p,d,g=c(0,e),m=2;function v(t){return e.invert(t)}function y(r){var n=e.rotate(),i=e.invert(t.midPt);r("projection.rotation.lon",-n[0]),r("center.lon",i[0]),r("center.lat",i[1])}return g.on("zoomstart",function(){n.select(this).style(s),r=n.mouse(this),i=e.rotate(),a=e.translate(),o=i,f=v(r)}).on("zoom",function(){if(h=n.mouse(this),l=e(v(s=r)),Math.abs(l[0]-s[0])>m||Math.abs(l[1]-s[1])>m)return g.scale(e.scale()),void g.translate(e.translate());var s,l;e.scale(n.event.scale),e.translate([a[0],n.event.translate[1]]),f?v(h)&&(d=v(h),p=[o[0]+(d[0]-f[0]),i[1],i[2]],e.rotate(p),o=p):f=v(r=h),t.render()}).on("zoomend",function(){n.select(this).style(l),u(t,e,y)}),g}function p(t,e){var r,i={r:e.rotate(),k:e.scale()},f=c(0,e),h=function(t){var e=0,r=arguments.length,i=[];for(;++ed?(a=(f>0?90:-90)-p,i=0):(a=Math.asin(f/d)*o-p,i=Math.sqrt(d*d-f*f));var m=180-a-2*p,y=(Math.atan2(h,u)-Math.atan2(c,i))*o,x=(Math.atan2(h,u)-Math.atan2(c,-i))*o,b=g(r[0],r[1],a,y),_=g(r[0],r[1],m,x);return b<=_?[a,y,r[2]]:[m,x,r[2]]}(k,r,C);isFinite(M[0])&&isFinite(M[1])&&isFinite(M[2])||(M=C),e.rotate(M),C=M}}else r=d(e,T=b);h.of(this,arguments)({type:"zoom"})}),A=h.of(this,arguments),p++||A({type:"zoomstart"})}).on("zoomend",function(){var r;n.select(this).style(l),m.call(f,"zoom",null),r=h.of(this,arguments),--p||r({type:"zoomend"}),u(t,e,x)}).on("zoom.redraw",function(){t.render()}),n.rebind(f,h,"on")}function d(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&function(t){var e=t[0]*a,r=t[1]*a,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}(r)}function g(t,e,r,n){var i=m(r-t),a=m(n-e);return Math.sqrt(i*i+a*a)}function m(t){return(t%360+540)%360-180}function v(t,e,r){var n=r*a,i=t.slice(),o=0===e?1:0,s=2===e?1:2,l=Math.cos(n),c=Math.sin(n);return i[o]=t[o]*l-t[s]*c,i[s]=t[s]*l+t[o]*c,i}function y(t,e){for(var r=0,n=0,i=t.length;nMath.abs(s)?(l.boxEnd[1]=l.boxStart[1]+Math.abs(a)*_*(s>=0?1:-1),l.boxEnd[1]u[3]&&(l.boxEnd[1]=u[3],l.boxEnd[0]=l.boxStart[0]+(u[3]-l.boxStart[1])/Math.abs(_))):(l.boxEnd[0]=l.boxStart[0]+Math.abs(s)/_*(a>=0?1:-1),l.boxEnd[0]u[2]&&(l.boxEnd[0]=u[2],l.boxEnd[1]=l.boxStart[1]+(u[2]-l.boxStart[0])*Math.abs(_)))}}else l.boxEnabled?(a=l.boxStart[0]!==l.boxEnd[0],s=l.boxStart[1]!==l.boxEnd[1],a||s?(a&&(m(0,l.boxStart[0],l.boxEnd[0]),t.xaxis.autorange=!1),s&&(m(1,l.boxStart[1],l.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),l.boxEnabled=!1,l.boxInited=!1):l.boxInited&&(l.boxInited=!1);break;case"pan":l.boxEnabled=!1,l.boxInited=!1,e?(l.panning||(l.dragStart[0]=n,l.dragStart[1]=i),Math.abs(l.dragStart[0]-n)Math.abs(e))c.rotate(a,0,0,-t*r*Math.PI*d.rotateSpeed/window.innerWidth);else{var o=-d.zoomSpeed*i*e/window.innerHeight*(a-c.lastT())/20;c.pan(a,0,0,f*(Math.exp(o)-1))}}},!0),d};var n=t("right-now"),i=t("3d-view"),a=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset"),l=t("has-passive-events")},{"3d-view":42,"has-passive-events":355,"mouse-change":378,"mouse-event-offset":379,"mouse-wheel":381,"right-now":440}],748:[function(t,e,r){"use strict";var n=t("../../plot_api/edit_types").overrideAll,i=t("../../components/fx/layout_attributes"),a=t("./scene"),o=t("../get_data").getSubplotData,s=t("../../lib"),l=t("../../constants/xmlns_namespaces");r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=r.attrRegex=s.counterRegex("scene"),r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.baseLayoutAttrOverrides=n({hoverlabel:i.hoverlabel},"plot","nested"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,n=e._subplots.gl3d,i=0;i1;o(t,e,r,{type:"gl3d",attributes:l,handleDefaults:c,fullLayout:e,font:e.font,fullData:r,getDfltFromLayout:function(e){if(!i)return n.validate(t[e],l[e])?t[e]:void 0},paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})}},{"../../../components/color":532,"../../../lib":660,"../../../registry":790,"../../subplot_defaults":782,"./axis_defaults":751,"./layout_attributes":754}],754:[function(t,e,r){"use strict";var n=t("./axis_attributes"),i=t("../../domain").attributes,a=t("../../../lib/extend").extendFlat,o=t("../../../lib").counterRegex;function s(t,e,r){return{x:{valType:"number",dflt:t,editType:"camera"},y:{valType:"number",dflt:e,editType:"camera"},z:{valType:"number",dflt:r,editType:"camera"},editType:"camera"}}e.exports={_arrayAttrRegexps:[o("scene",".annotations",!0)],bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"plot"},camera:{up:a(s(0,0,1),{}),center:a(s(0,0,0),{}),eye:a(s(1.25,1.25,1.25),{}),editType:"camera"},domain:i({name:"scene",editType:"plot"}),aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto",editType:"plot",impliedEdits:{"aspectratio.x":void 0,"aspectratio.y":void 0,"aspectratio.z":void 0}},aspectratio:{x:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},y:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},z:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},editType:"plot",impliedEdits:{aspectmode:"manual"}},xaxis:n,yaxis:n,zaxis:n,dragmode:{valType:"enumerated",values:["orbit","turntable","zoom","pan",!1],dflt:"turntable",editType:"plot"},hovermode:{valType:"enumerated",values:["closest",!1],dflt:"closest",editType:"modebar"},editType:"plot",_deprecated:{cameraposition:{valType:"info_array",editType:"camera"}}}},{"../../../lib":660,"../../../lib/extend":649,"../../domain":731,"./axis_attributes":750}],755:[function(t,e,r){"use strict";var n=t("../../../lib/str2rgbarray"),i=["xaxis","yaxis","zaxis"];function a(){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]}a.prototype.merge=function(t){for(var e=0;e<3;++e){var r=t[i[e]];r.visible?(this.enabled[e]=r.showspikes,this.colors[e]=n(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness):(this.enabled[e]=!1,this.drawSides[e]=!1)}},e.exports=function(t){var e=new a;return e.merge(t),e}},{"../../../lib/str2rgbarray":683}],756:[function(t,e,r){"use strict";e.exports=function(t){for(var e=t.axesOptions,r=t.glplot.axesPixels,l=t.fullSceneLayout,c=[[],[],[]],u=0;u<3;++u){var f=l[o[u]];if(f._length=(r[u].hi-r[u].lo)*r[u].pixelsPerDataUnit/t.dataScale[u],Math.abs(f._length)===1/0)c[u]=[];else{f._input_range=f.range.slice(),f.range[0]=r[u].lo/t.dataScale[u],f.range[1]=r[u].hi/t.dataScale[u],f._m=1/(t.dataScale[u]*r[u].pixelsPerDataUnit),f.range[0]===f.range[1]&&(f.range[0]-=1,f.range[1]+=1);var h=f.tickmode;if("auto"===f.tickmode){f.tickmode="linear";var p=f.nticks||i.constrain(f._length/40,4,9);n.autoTicks(f,Math.abs(f.range[1]-f.range[0])/p)}for(var d=n.calcTicks(f),g=0;g")}else m=c.textLabel;t.fullSceneLayout.hovermode&&f.loneHover({x:(.5+.5*d[0]/d[3])*i,y:(.5-.5*d[1]/d[3])*a,xLabel:w,yLabel:k,zLabel:M,text:m,name:l.name,color:f.castHoverOption(e,v,"bgcolor")||l.color,borderColor:f.castHoverOption(e,v,"bordercolor"),fontFamily:f.castHoverOption(e,v,"font.family"),fontSize:f.castHoverOption(e,v,"font.size"),fontColor:f.castHoverOption(e,v,"font.color")},{container:r,gd:t.graphDiv});var T={x:c.traceCoordinate[0],y:c.traceCoordinate[1],z:c.traceCoordinate[2],data:e._input,fullData:e,curveNumber:e.index,pointNumber:v};f.appendArrayPointValue(T,e,v);var S={points:[T]};c.buttons&&c.distance<5?t.graphDiv.emit("plotly_click",S):t.graphDiv.emit("plotly_hover",S),o=S}else f.loneUnhover(r),t.graphDiv.emit("plotly_unhover",o);t.drawAnnotations(t)}.bind(null,t),t.traces={},!0}function b(t,e){var r=document.createElement("div"),n=t.container;this.graphDiv=t.graphDiv;var i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.style.position="absolute",i.style.top=i.style.left="0px",i.style.width=i.style.height="100%",i.style["z-index"]=20,i.style["pointer-events"]="none",r.appendChild(i),this.svgContainer=i,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.fullSceneLayout=e[this.id],this.plotArgs=[[],{},{}],this.axesOptions=m(e[this.id]),this.spikeOptions=v(e[this.id]),this.container=r,this.staticMode=!!t.staticPlot,this.pixelRatio=t.plotGlPixelRatio||2,this.dataScale=[1,1,1],this.contourLevels=[[],[],[]],this.convertAnnotations=l.getComponentMethod("annotations3d","convert"),this.drawAnnotations=l.getComponentMethod("annotations3d","draw"),x(this)}var _=b.prototype;_.recoverContext=function(){var t=this,e=this.glplot.gl,r=this.glplot.canvas;this.glplot.dispose(),requestAnimationFrame(function n(){e.isContextLost()?requestAnimationFrame(n):x(t,t.fullLayout,r,e)?t.plot.apply(t,t.plotArgs):c.error("Catastrophic and unrecoverable WebGL error. Context lost.")})};var w=["xaxis","yaxis","zaxis"];function k(t,e,r){for(var n=t.fullSceneLayout,i=0;i<3;i++){var a=w[i],o=a.charAt(0),s=n[a],l=e[o],u=e[o+"calendar"],f=e["_"+o+"length"];if(c.isArrayOrTypedArray(l))for(var h,p=0;p<(f||l.length);p++)if(c.isArrayOrTypedArray(l[p]))for(var d=0;df[1][o]?p[o]=1:f[1][o]===f[0][o]?p[o]=1:p[o]=1/(f[1][o]-f[0][o]);for(this.dataScale=p,this.convertAnnotations(this),a=0;ag[1][a])g[0][a]=-1,g[1][a]=1;else{var C=g[1][a]-g[0][a];g[0][a]-=C/32,g[1][a]+=C/32}}else{var E=s.range;g[0][a]=s.r2l(E[0]),g[1][a]=s.r2l(E[1])}g[0][a]===g[1][a]&&(g[0][a]-=1,g[1][a]+=1),m[a]=g[1][a]-g[0][a],this.glplot.bounds[0][a]=g[0][a]*p[a],this.glplot.bounds[1][a]=g[1][a]*p[a]}var L=[1,1,1];for(a=0;a<3;++a){var z=v[l=(s=c[w[a]]).type];L[a]=Math.pow(z.acc,1/z.count)/p[a]}var P;if("auto"===c.aspectmode)P=Math.max.apply(null,L)/Math.min.apply(null,L)<=4?L:[1,1,1];else if("cube"===c.aspectmode)P=[1,1,1];else if("data"===c.aspectmode)P=L;else{if("manual"!==c.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var D=c.aspectratio;P=[D.x,D.y,D.z]}c.aspectratio.x=u.aspectratio.x=P[0],c.aspectratio.y=u.aspectratio.y=P[1],c.aspectratio.z=u.aspectratio.z=P[2],this.glplot.aspect=P;var O=c.domain||null,I=e._size||null;if(O&&I){var R=this.container.style;R.position="absolute",R.left=I.l+O.x[0]*I.w+"px",R.top=I.t+(1-O.y[1])*I.h+"px",R.width=I.w*(O.x[1]-O.x[0])+"px",R.height=I.h*(O.y[1]-O.y[0])+"px"}this.glplot.redraw()}},_.destroy=function(){this.glplot&&(this.camera.mouseListener.enabled=!1,this.container.removeEventListener("wheel",this.camera.wheelListener),this.camera=this.glplot.camera=null,this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null)},_.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),M(this.glplot.camera)},_.setCamera=function(t){var e;this.glplot.camera.lookAt.apply(this,[[(e=t).eye.x,e.eye.y,e.eye.z],[e.center.x,e.center.y,e.center.z],[e.up.x,e.up.y,e.up.z]])},_.saveCamera=function(t){var e=this.getCamera(),r=c.nestedProperty(t,this.id+".camera"),n=r.get(),i=!1;function a(t,e,r,n){var i=["up","center","eye"],a=["x","y","z"];return e[i[r]]&&t[i[r]][a[n]]===e[i[r]][a[n]]}if(void 0===n)i=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!a(e,n,o,s)){i=!0;break}return i&&r.set(e),i},_.updateFx=function(t,e){var r=this.camera;r&&("orbit"===t?(r.mode="orbit",r.keyBindingMode="rotate"):"turntable"===t?(r.up=[0,0,1],r.mode="turntable",r.keyBindingMode="rotate"):r.keyBindingMode=t),this.fullSceneLayout.hovermode=e},_.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(n),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,i=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var a=new Uint8Array(r*i*4);e.readPixels(0,0,r,i,e.RGBA,e.UNSIGNED_BYTE,a);for(var o=0,s=i-1;o0}function l(t){var e={},r={};switch(t.type){case"circle":n.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":n.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":n.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var a=t.symbol,o=i(a.textposition,a.iconsize);n.extendFlat(e,{"icon-image":a.icon+"-15","icon-size":a.iconsize/10,"text-field":a.text,"text-size":a.textfont.size,"text-anchor":o.anchor,"text-offset":o.offset}),n.extendFlat(r,{"icon-color":t.color,"text-color":a.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:r}}o.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)?this.updateLayer(t):this.updateStyle(t):(this.updateSource(t),this.updateLayer(t)),this.visible=s(t)},o.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},o.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},o.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,s(t)){var r=function(t){var e,r=t.sourcetype,n=t.source,i={type:r};"geojson"===r?e="data":"vector"===r&&(e="string"==typeof n?"url":"tiles");return i[e]=n,i}(t);e.addSource(this.idSource,r)}},o.updateLayer=function(t){var e=this.map,r=l(t);e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,s(t)&&e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type,layout:r.layout,paint:r.paint},t.below)},o.updateStyle=function(t){if(s(t)){var e=l(t);this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint)}},o.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,r){var n=new a(t,e);return n.update(r),n}},{"../../lib":660,"./convert_text_opts":761}],764:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color").defaultLine,a=t("../domain").attributes,o=t("../font_attributes"),s=t("../../traces/scatter/attributes").textposition,l=t("../../plot_api/edit_types").overrideAll,c=o({});c.family.dflt="Open Sans Regular, Arial Unicode MS Regular",e.exports=l({_arrayAttrRegexps:[n.counterRegex("mapbox",".layers",!0)],domain:a({name:"mapbox"}),accesstoken:{valType:"string",noBlank:!0,strict:!0},style:{valType:"any",values:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],dflt:"basic"},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},layers:{_isLinkedToArray:"layer",sourcetype:{valType:"enumerated",values:["geojson","vector"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},type:{valType:"enumerated",values:["circle","line","fill","symbol"],dflt:"circle"},below:{valType:"string",dflt:""},color:{valType:"color",dflt:i},opacity:{valType:"number",min:0,max:1,dflt:1},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2}},fill:{outlinecolor:{valType:"color",dflt:i}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},textfont:c,textposition:n.extendFlat({},s,{arrayOk:!1})}}},"plot","from-root")},{"../../components/color":532,"../../lib":660,"../../plot_api/edit_types":691,"../../traces/scatter/attributes":990,"../domain":731,"../font_attributes":732}],765:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../subplot_defaults"),a=t("./layout_attributes");function o(t,e,r,i){r("accesstoken",i.accessToken),r("style"),r("center.lon"),r("center.lat"),r("zoom"),r("bearing"),r("pitch"),function(t,e){var r,i,o=t.layers||[],s=e.layers=[];function l(t,e){return n.coerce(r,i,a.layers,t,e)}for(var c=0;c=e.width-20?(a["text-anchor"]="start",a.x=5):(a["text-anchor"]="end",a.x=e._paper.attr("width")-7),r.attr(a);var o=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&&function(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(){m.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})}}(t,o),c.text(o.text()&&u.text()?" - ":"")}},m.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=n.select(t).append("div").attr("id","hiddenform").style("display","none"),i=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return i.append("input").attr({type:"text",name:"data"}).node().value=m.graphJson(t,!1,"keepdata"),i.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1};var x,b=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],_=["year","month","dayMonth","dayMonthYear"];function w(t,e){var r=t._context.locale,n=!1,i={};function o(t){for(var r=!0,a=0;a1&&O.length>1){for(a.getComponentMethod("grid","sizeDefaults")(c,l),o=0;o15&&O.length>15&&0===l.shapes.length&&0===l.images.length,l._hasCartesian=l._has("cartesian"),l._hasGeo=l._has("geo"),l._hasGL3D=l._has("gl3d"),l._hasGL2D=l._has("gl2d"),l._hasTernary=l._has("ternary"),l._hasPie=l._has("pie"),m.linkSubplots(p,l,h,i),m.cleanPlot(p,l,h,i,y),d(l,i),m.doAutoMargin(t);var F=u.list(t);for(o=0;o0){var u=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}(t._boundingBoxMargins),f=u.left+u.right,h=u.bottom+u.top,p=1-2*l,d=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(p*(d.width-f)),a=Math.round(p*(d.height-h))}else{var g=c?window.getComputedStyle(t):{};n=parseFloat(g.width)||r.width,a=parseFloat(g.height)||r.height}var v=m.layoutAttributes.width.min,y=m.layoutAttributes.height.min;n1,b=!e.height&&Math.abs(r.height-a)>1;(b||x)&&(x&&(r.width=n),b&&(r.height=a)),t._initialAutoSize||(t._initialAutoSize={width:n,height:a}),m.sanitizeMargins(r)},m.supplyLayoutModuleDefaults=function(t,e,r,n){var i,o,l,c=a.componentsRegistry,u=e._basePlotModules,f=a.subplotsRegistry.cartesian;for(i in c)(l=c[i]).includeBasePlot&&l.includeBasePlot(t,e);for(var h in u.length||u.push(f),e._has("cartesian")&&(a.getComponentMethod("grid","contentDefaults")(t,e),f.finalizeSubplots(t,e)),e._subplots)e._subplots[h].sort(s.subplotSort);for(o=0;o.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];n._replotting||m.doAutoMargin(t)}},m.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),o=Math.max(e.margin.l||0,0),s=Math.max(e.margin.r||0,0),l=Math.max(e.margin.t||0,0),c=Math.max(e.margin.b||0,0),u=e._pushmargin;if(!1!==e.margin.autoexpand)for(var f in u.base={l:{val:0,size:o},r:{val:1,size:s},t:{val:1,size:l},b:{val:0,size:c}},u){var h=u[f].l||{},p=u[f].b||{},d=h.val,g=h.size,m=p.val,v=p.size;for(var y in u){if(i(g)&&u[y].r){var x=u[y].r.val,b=u[y].r.size;if(x>d){var _=(g*x+(b-e.width)*d)/(x-d),w=(b*(1-d)+(g-e.width)*(1-x))/(x-d);_>=0&&w>=0&&_+w>o+s&&(o=_,s=w)}}if(i(v)&&u[y].t){var k=u[y].t.val,M=u[y].t.size;if(k>m){var A=(v*k+(M-e.height)*m)/(k-m),T=(M*(1-m)+(v-e.height)*(1-k))/(k-m);A>=0&&T>=0&&A+T>c+l&&(c=A,l=T)}}}}if(r.l=Math.round(o),r.r=Math.round(s),r.t=Math.round(l),r.b=Math.round(c),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,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return a.call("plot",t)},m.graphJson=function(t,e,r,n,i){(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&m.supplyDefaults(t);var a=i?t._fullData:t.data,o=i?t._fullLayout:t.layout,l=(t._transitionData||{})._frames;function c(t){if("function"==typeof t)return null;if(s.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("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!s.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;i[e]=c(t[e])}return i}return Array.isArray(t)?t.map(c):s.isJSDate(t)?s.ms2DateTimeLocal(+t):t}var u={data:(a||[]).map(function(t){var r=c(t);return e&&delete r.fit,r})};return e||(u.layout=c(o)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),l&&(u.frames=c(l)),"object"===n?u:JSON.stringify(u)},m.modifyFrames=function(t,e){var r,n,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){p=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return a.call("redraw",t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var n,l,c=0,u=0;function f(){return c++,function(){var r;p||++u!==c||(r=e,t._transitionData&&(function(t){if(t)for(;t.length;)t.shift()}(t._transitionData._interruptCallbacks),Promise.resolve().then(function(){if(i.redraw)return a.call("redraw",t)}).then(function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])}).then(r)))}}var d=t._fullLayout._basePlotModules,g=!1;if(r)for(l=0;l=0;s--)if(o[s].enabled){r._indexToPoints=o[s]._indexToPoints;break}n&&n.calc&&(a=n.calc(t,r))}Array.isArray(a)&&a[0]||(a=[{x:c,y:c}]),a[0].t||(a[0].t={}),a[0].trace=r,p[e]=a}}for(m&&M(l),i=0;i=0?h.angularAxis.domain:n.extent(w),S=Math.abs(w[1]-w[0]);M&&!k&&(S=0);var C=T.slice();A&&k&&(C[1]+=S);var E=h.angularAxis.ticksCount||4;E>8&&(E=E/(E/8)+E%8),h.angularAxis.ticksStep&&(E=(C[1]-C[0])/E);var L=h.angularAxis.ticksStep||(C[1]-C[0])/(E*(h.minorTicks+1));_&&(L=Math.max(Math.round(L),1)),C[2]||(C[2]=L);var z=n.range.apply(this,C);if(z=z.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(C.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=s.domain(),u.layout.angularAxis.endPadding=A?S:0,void 0===(t=n.select(this).select("svg.chart-root"))||t.empty()){var P=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),D=this.appendChild(this.ownerDocument.importNode(P.documentElement,!0));t=n.select(D)}t.select(".guides-group").style({"pointer-events":"none"}),t.select(".angular.axis-group").style({"pointer-events":"none"}),t.select(".radial.axis-group").style({"pointer-events":"none"});var O,I=t.select(".chart-group"),R={fill:"none",stroke:h.tickColor},B={"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){O=t.select(".legend-group").attr({transform:"translate("+[y,h.margin.top]+")"}).style({display:"block"});var F=p.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=void 0===t.visibleInLegend||t.visibleInLegend,r.color="LinePlot"===t.geometry?t.strokeColor:t.color,r});o.Legend().config({data:p.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},o.Legend.defaultConfig().legendConfig,{container:O,elements:F,reverseOrder:h.legend.reverseOrder})})();var N=O.node().getBBox();y=Math.min(h.width-N.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,y=Math.max(10,y),b=[h.margin.left+y,h.margin.top+y],r.range([0,y]),u.layout.radialAxis.domain=r.domain(),O.attr("transform","translate("+[b[0]+y,b[1]-y]+")")}else O=t.select(".legend-group").style({display:"none"});t.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),I.attr("transform","translate("+b+")").style({cursor:"crosshair"});var j=[(h.width-(h.margin.left+h.margin.right+2*y+(N?N.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*y))/2];if(j[0]=Math.max(0,j[0]),j[1]=Math.max(0,j[1]),t.select(".outer-group").attr("transform","translate("+j+")"),h.title){var V=t.select("g.title-group text").style(B).text(h.title),U=V.node().getBBox();V.attr({x:b[0]-U.width/2,y:b[1]-y-20})}var q=t.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var H=q.selectAll("circle.grid-circle").data(r.ticks(5));H.enter().append("circle").attr({class:"grid-circle"}).style(R),H.attr("r",r),H.exit().remove()}q.select("circle.outside-circle").attr({r:y}).style(R);var G=t.select("circle.background-circle").attr({r:y}).style({fill:h.backgroundColor,stroke:h.stroke});function W(t,e){return s(t)%360+h.orientation}if(h.radialAxis.visible){var Y=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(Y).attr({transform:"rotate("+h.radialAxis.orientation+")"}),q.selectAll(".domain").style(R),q.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(B).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,B["font-size"]]+")":"translate("+[0,B["font-size"]]+")"}}),q.selectAll("g>line").style({stroke:"black"})}var X=t.select(".angular.axis-group").selectAll("g.angular-tick").data(z),Z=X.enter().append("g").classed("angular-tick",!0);X.attr({transform:function(t,e){return"rotate("+W(t)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),X.exit().remove(),Z.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(R),Z.selectAll(".minor").style({stroke:h.minorTickColor}),X.select("line.grid-line").attr({x1:h.tickLength?y-h.tickLength:0,x2:y}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),Z.append("text").classed("axis-text",!0).style(B);var J=X.select("text.axis-text").attr({x:y+h.labelOffset,dy:a+"em",transform:function(t,e){var r=W(t),n=y+h.labelOffset,i=h.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&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?"":_?_[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(B);h.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.angularAxis.rewriteTicks(this.textContent,e)});var K=n.max(I.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));O.attr({transform:"translate("+[y+K,h.margin.top]+")"});var Q=t.select("g.geometry-group").selectAll("g").size()>0,$=t.select("g.geometry-group").selectAll("g.geometry").data(p);if($.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),$.exit().remove(),p[0]||Q){var tt=[];p.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=s,n.container=$.filter(function(t,r){return r==e}),n.geometry=t.geometry,n.orientation=h.orientation,n.direction=h.direction,n.index=e,tt.push({data:t,geometryConfig:n})});var et=[];n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(tt).forEach(function(t,e){"unstacked"===t.key?et=et.concat(t.values.map(function(t,e){return[t]})):et.push(t.values)}),et.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 i(o[r].defaultConfig(),t)});o[r]().config(n)()})}var rt,nt,it=t.select(".guides-group"),at=t.select(".tooltips-group"),ot=o.tooltipPanel().config({container:at,fontSize:8})(),st=o.tooltipPanel().config({container:at,fontSize:8})(),lt=o.tooltipPanel().config({container:at,hasTick:!0})();if(!k){var ct=it.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});I.on("mousemove.angular-guide",function(t,e){var r=o.util.getMousePos(G).angle;ct.attr({x2:-y,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;rt=s.invert(n);var i=o.util.convertToCartesian(y+12,r+180);ot.text(o.util.round(rt)).move([i[0]+b[0],i[1]+b[1]])}).on("mouseout.angular-guide",function(t,e){it.select("line").style({opacity:0})})}var ut=it.select("circle").style({stroke:"grey",fill:"none"});I.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos(G).radius;ut.attr({r:n}).style({opacity:.5}),nt=r.invert(o.util.getMousePos(G).radius);var i=o.util.convertToCartesian(n,h.radialAxis.orientation);st.text(o.util.round(nt)).move([i[0]+b[0],i[1]+b[1]])}).on("mouseout.radial-guide",function(t,e){ut.style({opacity:0}),lt.hide(),ot.hide(),st.hide()}),t.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(e,r){var i=n.select(this),a=this.style.fill,s="black",l=this.style.opacity||1;if(i.attr({"data-opacity":l}),a&&"none"!==a){i.attr({"data-fill":a}),s=n.hsl(a).darker().toString(),i.style({fill:s,opacity:1});var c={t:o.util.round(e[0]),r:o.util.round(e[1])};k&&(c.t=_[e[0]]);var u="t: "+c.t+", r: "+c.r,f=this.getBoundingClientRect(),h=t.node().getBoundingClientRect(),p=[f.left+f.width/2-j[0]-h.left,f.top+f.height/2-j[1]-h.top];lt.config({color:s}).text(u),lt.move(p)}else a=this.style.stroke||"black",i.attr({"data-stroke":a}),s=n.hsl(a).darker().toString(),i.style({stroke:s,opacity:1})}).on("mousemove.tooltip",function(t,e){if(0!=n.event.which)return!1;n.select(this).attr("data-fill")&<.show()}).on("mouseout.tooltip",function(t,e){lt.hide();var r=n.select(this),i=r.attr("data-fill");i?r.style({fill:i,opacity:r.attr("data-opacity")}):r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})})}(c),this},h.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]={}),i(l.data[e],o.Axis.defaultConfig().data[0]),i(l.data[e],t)}),i(l.layout,o.Axis.defaultConfig().layout),i(l.layout,e.layout),this},h.getLiveConfig=function(){return u},h.getinputConfig=function(){return c},h.radialScale=function(t){return r},h.angularScale=function(t){return s},h.svg=function(){return t},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){return{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:n.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}}},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;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},o.util.dataFromEquation=function(t,e,r){var i=e||6,a=[],o=[];n.range(0,360+i,i).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);a.push(e),o.push(i)});var s={t:a,r:o};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.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 n.zip(t,e).map(function(t,e){return n.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;return[t*Math.cos(r),t*Math.sin(r)]},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=n.mouse(t.node()),r=e[0],i=e[1],a={};return a.x=r,a.y=i,a.pos=e,a.angle=180*(Math.atan2(i,r)+Math.PI)/Math.PI,a.radius=Math.sqrt(r*r+i*i),a},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;i0)){var l=n.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:u(s),transform:function(t,r){return"rotate("+(e.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return d.fill(r,i,a)},"fill-opacity":0,stroke:function(t,e){return d.stroke(r,i,a)},"stroke-width":function(t,e){return d["stroke-width"](r,i,a)},"stroke-dasharray":function(t,e){return d["stroke-dasharray"](r,i,a)},opacity:function(t,e){return d.opacity(r,i,a)},display:function(t,e){return d.display(r,i,a)}})}};var f=e.angularScale.range(),h=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,p=n.svg.arc().startAngle(function(t){return-h/2}).endAngle(function(t){return h/2}).innerRadius(function(t){return e.radialScale(l+(t[2]||0))}).outerRadius(function(t){return e.radialScale(l+(t[2]||0))+e.radialScale(t[1])});c.arc=function(t,r,i){n.select(this).attr({class:"mark arc",d:p,transform:function(t,r){return"rotate("+(e.orientation+s(t[0])+90)+")"}})};var d={fill:function(e,r,n){return t[n].data.color},stroke:function(e,r,n){return t[n].data.strokeColor},"stroke-width":function(e,r,n){return t[n].data.strokeSize+"px"},"stroke-dasharray":function(e,n,i){return r[t[i].data.strokeDash]},opacity:function(e,r,n){return t[n].data.opacity},display:function(e,r,n){return void 0===t[n].data.visible||t[n].data.visible?"block":"none"}},g=n.select(this).selectAll("g.layer").data(o);g.enter().append("g").attr({class:"layer"});var m=g.selectAll("path.mark").data(function(t,e){return t});m.enter().append("path").attr({class:"mark"}),m.style(d).each(c[e.geometryType]),m.exit().remove(),g.exit().remove()})}return a.config=function(e){return arguments.length?(e.forEach(function(e,r){t[r]||(t[r]={}),i(t[r],o.PolyChart.defaultConfig()),i(t[r],e)}),this):t},a.getColorScale=function(){},n.rebind(a,e,"on"),a},o.PolyChart.defaultConfig=function(){return{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:n.scale.category20()}}},o.BarChart=function(){return o.PolyChart()},o.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},o.AreaChart=function(){return o.PolyChart()},o.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},o.DotPlot=function(){return o.PolyChart()},o.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},o.LinePlot=function(){return o.PolyChart()},o.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},o.Legend=function(){var t=o.Legend.defaultConfig(),e=n.dispatch("hover");function r(){var e=t.legendConfig,a=t.data.map(function(t,r){return[].concat(t).map(function(t,n){var a=i({},e.elements[r]);return a.name=t,a.color=[].concat(e.elements[r].color)[n],a})}),o=n.merge(a);o=o.filter(function(t,r){return e.elements[r]&&(e.elements[r].visibleInLegend||void 0===e.elements[r].visibleInLegend)}),e.reverseOrder&&(o=o.reverse());var s=e.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),c=e.fontSize,u=null==e.isContinuous?"number"==typeof o[0]:e.isContinuous,f=u?e.height:c*o.length,h=s.classed("legend-group",!0).selectAll("svg").data([0]),p=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});p.append("g").classed("legend-axis",!0),p.append("g").classed("legend-marks",!0);var d=n.range(o.length),g=n.scale[u?"linear":"ordinal"]().domain(d).range(l),m=n.scale[u?"linear":"ordinal"]().domain(d)[u?"range":"rangePoints"]([0,f]);if(u){var v=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);v.enter().append("stop"),v.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:e.height,width:e.colorBandWidth,fill:"url(#grad1)"})}else{var y=h.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(t,e){return"translate("+[c/2,m(e)+c/2]+")"},d:function(t,e){var r,i,a,o=t.symbol;return a=3*(i=c),"line"===(r=o)?"M"+[[-i/2,-i/12],[i/2,-i/12],[i/2,i/12],[-i/2,i/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(r)?n.svg.symbol().type(r).size(a)():n.svg.symbol().type("square").size(a)()},fill:function(t,e){return g(e)}}),y.exit().remove()}var x=n.svg.axis().scale(m).orient("right"),b=h.select("g.legend-axis").attr({transform:"translate("+[u?e.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?e.textColor:"none"}),b.selectAll("text").style({fill:e.textColor,"font-size":e.fontSize}).text(function(t,e){return o[e].name}),r}return r.config=function(e){return arguments.length?(i(t,e),this):t},n.rebind(r,e,"on"),r},o.Legend.defaultConfig=function(t,e){return{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}}},o.tooltipPanel=function(){var t,e,r,a={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},s="tooltip-"+o.tooltipPanel.uid++,l=10,c=function(){var n=(t=a.container.selectAll("g."+s).data([0])).enter().append("g").classed(s,!0).style({"pointer-events":"none",display:"none"});return r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),e=n.append("text").attr({dx:a.padding+l,dy:.3*+a.fontSize}),c};return c.text=function(i){var o=n.hsl(a.color).l,s=o>=.5?"#aaa":"white",u=o>=.5?"black":"white",f=i||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var h=a.padding,p=e.node().getBBox(),d={fill:a.color,stroke:s,"stroke-width":"2px"},g=p.width+2*h+l,m=p.height+2*h;return r.attr({d:"M"+[[l,-m/2],[l,-m/4],[a.hasTick?0:l,0],[l,m/4],[l,m/2],[g,m/2],[g,-m/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[l,-m/2+2*h]+")"}),t.style({display:"block"}),c},c.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(t)return t.style({display:"none"}),c},c.show=function(){if(t)return t.style({display:"block"}),c},c.config=function(t){return i(a,t),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={convert:function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=i({},t);return[[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"]]].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",!0===n.dotVisible?(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 a=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var s=i({},t.layout);if([[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"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?(void 0!==s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&void 0!==s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&void 0!==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&&void 0!==s.margin.t){var l=["t","r","b","l","pad"],c=["top","right","bottom","left","pad"],u={};n.entries(s.margin).forEach(function(t,e){u[c[l.indexOf(t.key)]]=t.value}),s.margin=u}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}};return t}},{"../../../constants/alignment":632,"../../../lib":660,d3:131}],778:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../../lib"),a=t("../../../components/color"),o=t("./micropolar"),s=t("./undo_manager"),l=i.extendDeepAll,c=e.exports={};c.framework=function(t){var e,r,i,a,u,f=new s;function h(r,s){return s&&(u=s),n.select(n.select(u).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),e=e?l(e,r):r,i||(i=o.Axis()),a=o.adapter.plotly().convert(e),i.config(a).render(u),t.data=e.data,t.layout=e.layout,c.fillLayout(t),e}return h.isPolar=!0,h.svg=function(){return i.svg()},h.getConfig=function(){return e},h.getLiveConfig=function(){return o.adapter.plotly().convert(i.getLiveConfig(),!0)},h.getLiveScales=function(){return{t:i.angularScale(),r:i.radialScale()}},h.setUndoPoint=function(){var t,n,i=this,a=o.util.cloneJson(e);t=a,n=r,f.add({undo:function(){n&&i(n)},redo:function(){i(t)}}),r=o.util.cloneJson(a)},h.undo=function(){f.undo()},h.redo=function(){f.redo()},h},c.fillLayout=function(t){var e=n.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),i=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:a.background,_container:e,_paperdiv:r,_paper:i};t._fullLayout=l(o,t.layout)}},{"../../../components/color":532,"../../../lib":660,"./micropolar":777,"./undo_manager":779,d3:131}],779:[function(t,e,r){"use strict";e.exports=function(){var t,e=[],r=-1,n=!1;function i(t,e){return t?(n=!0,t[e](),n=!1,this):this}return{add:function(t){return n?this:(e.splice(r+1,e.length-r),e.push(t),r=e.length-1,this)},setCallback:function(e){t=e},undo:function(){var n=e[r];return n?(i(n,"undo"),r-=1,t&&t(n.undo),this):this},redo:function(){var n=e[r+1];return n?(i(n,"redo"),r+=1,t&&t(n.redo),this):this},clear:function(){e=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r0?1:-1}function F(t){return B(Math.cos(t))}function N(t){return B(Math.sin(t))}e.exports=function(t,e){return new S(t,e)},C.plot=function(t,e){var r=e[this.id];this._hasClipOnAxisFalse=!1;for(var n=0;n=90||s>90&&l>=450?1:u<=0&&h<=0?0:Math.max(u,h);e=s<=180&&l>=180||s>180&&l>=540?-1:c>=0&&f>=0?0:Math.min(c,f);r=s<=270&&l>=270||s>270&&l>=630?-1:u>=0&&h>=0?0:Math.min(u,h);n=l>=360?1:c<=0&&f<=0?0:Math.max(c,f);return[e,r,n,i]}(v),x=y[2]-y[0],b=y[3]-y[1],w=m/g,M=Math.abs(b/x);w>M?(c=g,d=(m-(f=g*M))/i.h/2,h=[a[0],a[1]],p=[o[0]+d,o[1]-d]):(f=m,d=(g-(c=m/M))/i.w/2,h=[a[0]+d,a[1]-d],p=[o[0],o[1]]),r.xLength2=c,r.yLength2=f,r.xDomain2=h,r.yDomain2=p;var A=r.xOffset2=i.l+i.w*h[0],T=r.yOffset2=i.t+i.h*(1-p[1]),S=r.radius=c/x,C=r.cx=A-S*y[0],E=r.cy=T+S*y[3],L=r.cxx=C-A,z=r.cyy=E-T;r.updateRadialAxis(t,e),r.updateRadialAxisTitle(t,e),r.updateAngularAxis(t,e);var D=r.radialAxis.range,O=D[1]-D[0],R=r.xaxis={type:"linear",_id:"x",range:[y[0]*O,y[2]*O],domain:h};u.setConvert(R,t),R.setScale();var B=r.yaxis={type:"linear",_id:"y",range:[y[1]*O,y[3]*O],domain:p};u.setConvert(B,t),B.setScale(),R.isPtWithinRange=function(t){return r.isPtWithinSector(t)},B.isPtWithinRange=function(){return!0},n.frontplot.attr("transform",I(A,T)).call(l.setClipUrl,r._hasClipOnAxisFalse?null:r.clipIds.circle),n.bgcircle.attr({d:P(S,v),transform:I(C,E)}).call(s.fill,e.bgcolor),r.clipPaths.circle.select("path").attr("d",P(S,v)).attr("transform",I(L,z)),r.framework.selectAll(".crisp").classed("crisp",0)},C.updateRadialAxis=function(t,e){var r=this.gd,n=this.layers,i=this.radius,a=this.cx,l=this.cy,c=t._size,h=e.radialaxis,p=e.sector,d=k(p[0]);this.fillViewInitialKey("radialaxis.angle",h.angle);var g=this.radialAxis=o.extendFlat({},h,{_axislayer:n["radial-axis"],_gridlayer:n["radial-grid"],_id:"x",_pos:0,side:{counterclockwise:"top",clockwise:"bottom"}[h.side],domain:[0,i/c.w],anchor:"free",position:0,_counteraxis:!0,automargin:!1});E(g,h,t),f(g),h.range=g.range.slice(),h._input.range=g.range.slice(),this.fillViewInitialKey("radialaxis.range",g.range.slice()),"auto"===g.tickangle&&d>90&&d<=270&&(g.tickangle=180),g._transfn=function(t){return"translate("+g.l2p(t.x)+",0)"},g._gridpath=function(t){return z(g.r2p(t.x),p)};var m=L(h);this.radialTickLayout!==m&&(n["radial-axis"].selectAll(".xtick").remove(),this.radialTickLayout=m),u.doTicksSingle(r,g,!0),O(n["radial-axis"],h.showticklabels||h.ticks,{transform:I(a,l)+R(-h.angle)}),O(n["radial-grid"],h.showgrid,{transform:I(a,l)}).selectAll("path").attr("transform",null),O(n["radial-line"].select("line"),h.showline,{x1:0,y1:0,x2:i,y2:0,transform:I(a,l)+R(-h.angle)}).attr("stroke-width",h.linewidth).call(s.stroke,h.linecolor)},C.updateRadialAxisTitle=function(t,e,r){var n=this.gd,i=this.radius,a=this.cx,o=this.cy,s=e.radialaxis,c=this.id+"title",u=void 0!==r?r:s.angle,f=_(u),h=Math.cos(f),p=Math.sin(f),d=0;if(s.title){var m=l.bBox(this.layers["radial-axis"].node()).height,v=s.titlefont.size;d="counterclockwise"===s.side?-m-.4*v:m+.8*v}this.layers["radial-axis-title"]=g.draw(n,c,{propContainer:s,propName:this.id+".radialaxis.title",placeholder:b(n,"Click to enter radial axis title"),attributes:{x:a+i/2*h+d*p,y:o-i/2*p+d*h,"text-anchor":"middle"},transform:{rotate:-u}})},C.updateAngularAxis=function(t,e){var r=this,i=r.gd,a=r.layers,l=r.radius,c=r.cx,f=r.cy,h=e.angularaxis,p=e.sector,d=p.map(_);r.fillViewInitialKey("angularaxis.rotation",h.rotation);var g=r.angularAxis=o.extendFlat({},h,{_axislayer:a["angular-axis"],_gridlayer:a["angular-grid"],_id:"angular",_pos:0,side:"right",domain:[0,Math.PI],anchor:"free",position:0,_counteraxis:!0,automargin:!1,autorange:!1});if("linear"===g.type)D(p)?g.range=p.slice():g.range=d.map(g.unTransformRad).map(w),"radians"===g.thetaunit&&(g.tick0=w(g.tick0),g.dtick=w(g.dtick));else if("category"===g.type){var m=h.period?Math.max(h.period,h._categories.length):h._categories.length;g.range=[0,m],g._tickFilter=function(t){return r.isPtWithinSector({r:r.radialAxis.range[1],rad:g.c2rad(t.x)})}}function v(t){return g.c2rad(t.x,"degrees")}function y(t){return[l*Math.cos(t),l*Math.sin(t)]}E(g,h,t),g._transfn=function(t){var e=v(t),r=y(e),i=I(c+r[0],f-r[1]),a=n.select(this);return a&&a.node()&&a.classed("ticks")&&(i+=R(-w(e))),i},g._gridpath=function(t){var e=y(v(t));return"M0,0L"+-e[0]+","+e[1]};var b="outside"!==h.ticks?.7:.5;g._labelx=function(t){var e=v(t),r=g._labelStandoff,n=g._pad;return(0===N(e)?0:Math.cos(e)*(r+n+b*t.fontSize))+F(e)*(t.dx+r+n)},g._labely=function(t){var e=v(t),r=g._labelStandoff,n=g._labelShift,i=g._pad;return t.dy+t.fontSize*x-n+-Math.sin(e)*(r+i+b*t.fontSize)},g._labelanchor=function(t,e){var r=v(e);return 0===N(r)?F(r)>0?"start":"end":"middle"};var k=L(h);r.angularTickLayout!==k&&(a["angular-axis"].selectAll(".angulartick").remove(),r.angularTickLayout=k),u.doTicksSingle(i,g,!0),O(a["angular-line"].select("path"),h.showline,{d:P(l,p),transform:I(c,f)}).attr("stroke-width",h.linewidth).call(s.stroke,h.linecolor)},C.updateFx=function(t,e){this.gd._context.staticPlot||(this.updateAngularDrag(t,e),this.updateRadialDrag(t,e),this.updateMainDrag(t,e))},C.updateMainDrag=function(t,e){var r=this,o=r.gd,s=r.layers,l=t._zoomlayer,c=T.MINZOOM,u=T.OFFEDGE,f=r.radius,g=r.cx,y=r.cy,x=r.cxx,b=r.cyy,_=e.sector,w=p.makeDragger(s,"path","maindrag","crosshair");n.select(w).attr("d",P(f,_)).attr("transform",I(g,y));var k,M,A,S,C,E,L,z,D,O={element:w,gd:o,subplot:r.id,plotinfo:{xaxis:r.xaxis,yaxis:r.yaxis},xaxes:[r.xaxis],yaxes:[r.yaxis]};function R(t,e){var r=t-x,n=e-b;return Math.sqrt(r*r+n*n)}function B(t,e){return Math.atan2(b-e,t-x)}function F(t,e){return[t*Math.cos(e),t*Math.sin(-e)]}function N(t,e){var r=T.cornerLen,n=T.cornerHalfWidth;if(0===t)return P(2*n,_);var i=r/t/2,a=e-i,o=e+i,s=Math.max(0,Math.min(t,f)),l=s-n,c=s+n;return"M"+F(l,a)+"A"+[l,l]+" 0,0,0 "+F(l,o)+"L"+F(c,o)+"A"+[c,c]+" 0,0,1 "+F(c,a)+"Z"}function j(t,e){var r,n,i=k+t,a=M+e,o=R(k,M),s=Math.min(R(i,a),f),l=B(k,M),h=B(i,a);oc?(o0==h>y[0]){S=d.range[1]=h,u.doTicksSingle(i,r.radialAxis,!0),s["radial-grid"].attr("transform",I(c,f)).selectAll("path").attr("transform",null);var p=S-y[0],g=r.sectorBBox;for(var v in r.xaxis.range=[g[0]*p,g[2]*p],r.yaxis.range=[g[1]*p,g[3]*p],r.xaxis.setScale(),r.yaxis.setScale(),r.traceHash){var b=r.traceHash[v],_=o.filterVisible(b),w=b[0][0].trace._module,k=i._fullLayout[r.id];if(w.plot(i,r,_,k),!a.traceIs(v,"gl"))for(var M=0;M<_.length;M++)w.style(i,_[M])}}}},C.updateAngularDrag=function(t,e){var r=this,i=r.gd,s=r.layers,c=r.radius,f=r.cx,d=r.cy,g=r.cxx,m=r.cyy,x=e.sector,b=T.angularDragBoxSize,k=p.makeDragger(s,"path","angulardrag","move"),S={element:k,gd:i};function C(t,e){return Math.atan2(m+b-e,t-g-b)}n.select(k).attr("d",function(t,e,r){var n,i,a,o=Math.abs(r[1]-r[0])<=180?0:1;function s(t,e){return[t*Math.cos(e),-t*Math.sin(e)]}function l(t,e,r){return"A"+[t,t]+" "+[0,o,r]+" "+s(t,e)}return D(r)?(n=0,a=2*Math.PI,i=Math.PI,"M"+s(t,n)+l(t,i,0)+l(t,a,0)+"ZM"+s(e,n)+l(e,i,1)+l(e,a,1)+"Z"):(n=_(r[0]),a=_(r[1]),"M"+s(t,n)+"L"+s(e,n)+l(e,a,0)+"L"+s(t,a)+l(t,n,1)+"Z")}(c,c+b,x)).attr("transform",I(f,d)).call(y,"move");var E,L,z,P,O,B,F=s.frontplot.select(".scatterlayer").selectAll(".trace"),N=F.selectAll(".point"),j=F.selectAll(".textpoint");function V(t,e){var c=C(E+t,L+e),f=w(c-B);P=z+f,s.frontplot.attr("transform",I(r.xOffset2,r.yOffset2)+R([-f,g,m])),r.clipPaths.circle.select("path").attr("transform",I(g,m)+R(f)),N.each(function(){var t=n.select(this),e=l.getTranslate(t);t.attr("transform",I(e.x,e.y)+R([f]))}),j.each(function(){var t=n.select(this),e=t.select("text"),r=l.getTranslate(t);t.attr("transform",R([f,e.attr("x"),e.attr("y")])+I(r.x,r.y))});var h=r.angularAxis;for(var p in h.rotation=M(P),"linear"!==h.type||D(x)||(h.range=O.map(_).map(h.unTransformRad).map(w)),A(h),u.doTicksSingle(i,h,!0),r._hasClipOnAxisFalse&&!D(x)&&(r.sector=[O[0]-f,O[1]-f],F.call(l.hideOutsideRangePoints,r)),r.traceHash)if(a.traceIs(p,"gl")){var d=r.traceHash[p],v=o.filterVisible(d),y=d[0][0].trace._module,b=i._fullLayout[r.id];y.plot(i,r,v,b)}}function U(){j.select("text").attr("transform",null);var t={};t[r.id+".angularaxis.rotation"]=P,a.call("relayout",i,t)}S.prepFn=function(e,n,i){var a=t[r.id];O=a.sector.slice(),z=a.angularaxis.rotation;var o=k.getBoundingClientRect();E=n-o.left,L=i-o.top,B=C(E,L),S.moveFn=V,S.doneFn=U,v(t._zoomlayer)},h.init(S)},C.isPtWithinSector=function(t){var e=this.sector,r=this.radialAxis,n=r.range,i=r.c2r(t.r),a=k(e[0]),o=k(e[1]);a>o&&(o+=360);var s,l,c=k(w(t.rad)),u=c+360;return n[1]>=n[0]?(s=n[0],l=n[1]):(s=n[1],l=n[0]),i>=s&&i<=l&&(D(e)||c>=a&&c<=o||u>=a&&u<=o)},C.fillViewInitialKey=function(t,e){t in this.viewInitial||(this.viewInitial[t]=e)}},{"../../components/color":532,"../../components/dragelement":554,"../../components/drawing":557,"../../components/fx":574,"../../components/titles":625,"../../constants/alignment":632,"../../lib":660,"../../lib/setcursor":680,"../../registry":790,"../cartesian/autorange":705,"../cartesian/axes":706,"../cartesian/dragbox":714,"../cartesian/select":723,"../plots":768,"./constants":769,"./helpers":770,d3:131,tinycolor2:473}],781:[function(t,e,r){"use strict";function n(t,e){return"splom"===t?-1:"splom"===e?1:0}e.exports={sortBasePlotModules:function(t,e){return n(t.name,e.name)},sortModules:n}},{}],782:[function(t,e,r){"use strict";var n=t("../lib"),i=t("./domain").defaults;e.exports=function(t,e,r,a){var o,s,l=a.type,c=a.attributes,u=a.handleDefaults,f=a.partition||"x",h=e._subplots[l],p=h.length;function d(t,e){return n.coerce(o,s,c,t,e)}for(var g=0;g=f&&(p.min=0,d.min=0,g.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}e.exports=function(t,e,r){i(t,e,r,{type:"ternary",attributes:a,handleDefaults:l,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":532,"../../subplot_defaults":782,"./axis_defaults":786,"./layout_attributes":788}],788:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("../../domain").attributes,a=t("./axis_attributes"),o=t("../../../plot_api/edit_types").overrideAll;e.exports=o({domain:i({name:"ternary"}),bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:a,baxis:a,caxis:a},"plot","from-root")},{"../../../components/color/attributes":531,"../../../plot_api/edit_types":691,"../../domain":731,"./axis_attributes":785}],789:[function(t,e,r){"use strict";var n=t("d3"),i=t("tinycolor2"),a=t("../../registry"),o=t("../../lib"),s=o._,l=t("../../components/color"),c=t("../../components/drawing"),u=t("../cartesian/set_convert"),f=t("../../lib/extend").extendFlat,h=t("../plots"),p=t("../cartesian/axes"),d=t("../../components/dragelement"),g=t("../../components/fx"),m=t("../../components/titles"),v=t("../cartesian/select").prepSelect,y=t("../cartesian/select").clearSelect,x=t("../cartesian/constants");function b(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework(e)}e.exports=b;var _=b.prototype;_.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={},this.layers={}},_.plot=function(t,e){var r=e[this.id],n=e._size;this._hasClipOnAxisFalse=!1;for(var i=0;iw*x?i=(a=x)*w:a=(i=y)/w,o=m*i/y,s=v*a/x,r=e.l+e.w*d-i/2,n=e.t+e.h*(1-g)-a/2,h.x0=r,h.y0=n,h.w=i,h.h=a,h.sum=b,h.xaxis={type:"linear",range:[_+2*M-b,b-_-2*k],domain:[d-o/2,d+o/2],_id:"x"},u(h.xaxis,h.graphDiv._fullLayout),h.xaxis.setScale(),h.xaxis.isPtWithinRange=function(t){return t.a>=h.aaxis.range[0]&&t.a<=h.aaxis.range[1]&&t.b>=h.baxis.range[1]&&t.b<=h.baxis.range[0]&&t.c>=h.caxis.range[1]&&t.c<=h.caxis.range[0]},h.yaxis={type:"linear",range:[_,b-k-M],domain:[g-s/2,g+s/2],_id:"y"},u(h.yaxis,h.graphDiv._fullLayout),h.yaxis.setScale(),h.yaxis.isPtWithinRange=function(){return!0};var A=h.yaxis.domain[0],T=h.aaxis=f({},t.aaxis,{visible:!0,range:[_,b-k-M],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[A,A+s*w],_axislayer:h.layers.aaxis,_gridlayer:h.layers.agrid,_pos:0,_id:"y",_length:i,_gridpath:"M0,0l"+a+",-"+i/2,automargin:!1});u(T,h.graphDiv._fullLayout),T.setScale();var S=h.baxis=f({},t.baxis,{visible:!0,range:[b-_-M,k],side:"bottom",_counterangle:30,domain:h.xaxis.domain,_axislayer:h.layers.baxis,_gridlayer:h.layers.bgrid,_counteraxis:h.aaxis,_pos:0,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+a,automargin:!1});u(S,h.graphDiv._fullLayout),S.setScale(),T._counteraxis=S;var C=h.caxis=f({},t.caxis,{visible:!0,range:[b-_-k,M],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[A,A+s*w],_axislayer:h.layers.caxis,_gridlayer:h.layers.cgrid,_counteraxis:h.baxis,_pos:0,_id:"y",_length:i,_gridpath:"M0,0l-"+a+","+i/2,automargin:!1});u(C,h.graphDiv._fullLayout),C.setScale();var E="M"+r+","+(n+a)+"h"+i+"l-"+i/2+",-"+a+"Z";h.clipDef.select("path").attr("d",E),h.layers.plotbg.select("path").attr("d",E);var L="M0,"+a+"h"+i+"l-"+i/2+",-"+a+"Z";h.clipDefRelative.select("path").attr("d",L);var z="translate("+r+","+n+")";h.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",z),h.clipDefRelative.select("path").attr("transform",null);var P="translate("+(r-S._offset)+","+(n+a)+")";h.layers.baxis.attr("transform",P),h.layers.bgrid.attr("transform",P);var D="translate("+(r+i/2)+","+n+")rotate(30)translate(0,"+-T._offset+")";h.layers.aaxis.attr("transform",D),h.layers.agrid.attr("transform",D);var O="translate("+(r+i/2)+","+n+")rotate(-30)translate(0,"+-C._offset+")";h.layers.caxis.attr("transform",O),h.layers.cgrid.attr("transform",O),h.drawAxes(!0),h.plotContainer.selectAll(".crisp").classed("crisp",!1),h.layers.aline.select("path").attr("d",T.showline?"M"+r+","+(n+a)+"l"+i/2+",-"+a:"M0,0").call(l.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px"),h.layers.bline.select("path").attr("d",S.showline?"M"+r+","+(n+a)+"h"+i:"M0,0").call(l.stroke,S.linecolor||"#000").style("stroke-width",(S.linewidth||0)+"px"),h.layers.cline.select("path").attr("d",C.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+a:"M0,0").call(l.stroke,C.linecolor||"#000").style("stroke-width",(C.linewidth||0)+"px"),h.graphDiv._context.staticPlot||h.initInteractions(),c.setClipUrl(h.layers.frontplot,h._hasClipOnAxisFalse?null:h.clipId)},_.drawAxes=function(t){var e=this.graphDiv,r=this.id.substr(7)+"title",n=this.aaxis,i=this.baxis,a=this.caxis;if(p.doTicksSingle(e,n,!0),p.doTicksSingle(e,i,!0),p.doTicksSingle(e,a,!0),t){var o=Math.max(n.showticklabels?n.tickfont.size/2:0,(a.showticklabels?.75*a.tickfont.size:0)+("outside"===a.ticks?.87*a.ticklen:0));this.layers["a-title"]=m.draw(e,"a"+r,{propContainer:n,propName:this.id+".aaxis.title",placeholder:s(e,"Click to enter Component A title"),attributes:{x:this.x0+this.w/2,y:this.y0-n.titlefont.size/3-o,"text-anchor":"middle"}});var l=(i.showticklabels?i.tickfont.size:0)+("outside"===i.ticks?i.ticklen:0)+3;this.layers["b-title"]=m.draw(e,"b"+r,{propContainer:i,propName:this.id+".baxis.title",placeholder:s(e,"Click to enter Component B title"),attributes:{x:this.x0-l,y:this.y0+this.h+.83*i.titlefont.size+l,"text-anchor":"middle"}}),this.layers["c-title"]=m.draw(e,"c"+r,{propContainer:a,propName:this.id+".caxis.title",placeholder:s(e,"Click to enter Component C title"),attributes:{x:this.x0+this.w+l,y:this.y0+this.h+.83*a.titlefont.size+l,"text-anchor":"middle"}})}};var k=x.MINZOOM/2+.87,M="m-0.87,.5h"+k+"v3h-"+(k+5.2)+"l"+(k/2+2.6)+",-"+(.87*k+4.5)+"l2.6,1.5l-"+k/2+","+.87*k+"Z",A="m0.87,.5h-"+k+"v3h"+(k+5.2)+"l-"+(k/2+2.6)+",-"+(.87*k+4.5)+"l-2.6,1.5l"+k/2+","+.87*k+"Z",T="m0,1l"+k/2+","+.87*k+"l2.6,-1.5l-"+(k/2+2.6)+",-"+(.87*k+4.5)+"l-"+(k/2+2.6)+","+(.87*k+4.5)+"l2.6,1.5l"+k/2+",-"+.87*k+"Z",S="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",C=!0;function E(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}_.initInteractions=function(){var t,e,r,n,u,f,h,p,m,b,_=this,k=_.layers.plotbg.select("path").node(),L=_.graphDiv,z=L._fullLayout._zoomlayer,P={element:k,gd:L,plotinfo:{xaxis:_.xaxis,yaxis:_.yaxis},subplot:_.id,prepFn:function(a,o,s){P.xaxes=[_.xaxis],P.yaxes=[_.yaxis];var c=L._fullLayout.dragmode;a.shiftKey&&(c="pan"===c?"zoom":"pan"),P.minDrag="lasso"===c?1:void 0,"zoom"===c?(P.moveFn=R,P.doneFn=B,function(a,o,s){var c=k.getBoundingClientRect();t=o-c.left,e=s-c.top,r={a:_.aaxis.range[0],b:_.baxis.range[1],c:_.caxis.range[1]},u=r,n=_.aaxis.range[1]-r.a,f=i(_.graphDiv._fullLayout[_.id].bgcolor).getLuminance(),h="M0,"+_.h+"L"+_.w/2+", 0L"+_.w+","+_.h+"Z",p=!1,m=z.append("path").attr("class","zoombox").attr("transform","translate("+_.x0+", "+_.y0+")").style({fill:f>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",h),b=z.append("path").attr("class","zoombox-corners").attr("transform","translate("+_.x0+", "+_.y0+")").style({fill:l.background,stroke:l.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),y(z)}(0,o,s)):"pan"===c?(P.moveFn=F,P.doneFn=N,r={a:_.aaxis.range[0],b:_.baxis.range[1],c:_.caxis.range[1]},u=r,y(z)):"select"!==c&&"lasso"!==c||v(a,o,s,P,c)},clickFn:function(t,e){if(E(L),2===t){var r={};r[_.id+".aaxis.min"]=0,r[_.id+".baxis.min"]=0,r[_.id+".caxis.min"]=0,L.emit("plotly_doubleclick",null),a.call("relayout",L,r)}g.click(L,e,_.id)}};function D(t,e){return 1-e/_.h}function O(t,e){return 1-(t+(_.h-e)/Math.sqrt(3))/_.w}function I(t,e){return(t-(_.h-e)/Math.sqrt(3))/_.w}function R(i,a){var o=t+i,s=e+a,l=Math.max(0,Math.min(1,D(0,e),D(0,s))),c=Math.max(0,Math.min(1,O(t,e),O(o,s))),d=Math.max(0,Math.min(1,I(t,e),I(o,s))),g=(l/2+d)*_.w,v=(1-l/2-c)*_.w,y=(g+v)/2,k=v-g,C=(1-l)*_.h,E=C-k/w;k.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),b.transition().style("opacity",1).duration(200),p=!0)}function B(){if(E(L),u!==r){var t={};t[_.id+".aaxis.min"]=u.a,t[_.id+".baxis.min"]=u.b,t[_.id+".caxis.min"]=u.c,a.call("relayout",L,t),C&&L.data&&L._context.showTips&&(o.notifier(s(L,"Double-click to zoom back out"),"long"),C=!1)}}function F(t,e){var n=t/_.xaxis._m,i=e/_.yaxis._m,a=[(u={a:r.a-i,b:r.b+(n+i)/2,c:r.c-(n-i)/2}).a,u.b,u.c].sort(),o=a.indexOf(u.a),s=a.indexOf(u.b),l=a.indexOf(u.c);a[0]<0&&(a[1]+a[0]/2<0?(a[2]+=a[0]+a[1],a[0]=a[1]=0):(a[2]+=a[0]/2,a[1]+=a[0]/2,a[0]=0),u={a:a[o],b:a[s],c:a[l]},e=(r.a-u.a)*_.yaxis._m,t=(r.c-u.c-r.b+u.b)*_.xaxis._m);var f="translate("+(_.x0+t)+","+(_.y0+e)+")";_.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",f);var h="translate("+-t+","+-e+")";_.clipDefRelative.select("path").attr("transform",h),_.aaxis.range=[u.a,_.sum-u.b-u.c],_.baxis.range=[_.sum-u.a-u.c,u.b],_.caxis.range=[_.sum-u.a-u.b,u.c],_.drawAxes(!1),_.plotContainer.selectAll(".crisp").classed("crisp",!1),_._hasClipOnAxisFalse&&_.plotContainer.select(".scatterlayer").selectAll(".trace").call(c.hideOutsideRangePoints,_)}function N(){var t={};t[_.id+".aaxis.min"]=u.a,t[_.id+".baxis.min"]=u.b,t[_.id+".caxis.min"]=u.c,a.call("relayout",L,t)}k.onmousemove=function(t){g.hover(L,t,_.id),L._fullLayout._lasthover=k,L._fullLayout._hoversubplot=_.id},k.onmouseout=function(t){L._dragging||d.unhover(L,t)},d.init(P)}},{"../../components/color":532,"../../components/dragelement":554,"../../components/drawing":557,"../../components/fx":574,"../../components/titles":625,"../../lib":660,"../../lib/extend":649,"../../registry":790,"../cartesian/axes":706,"../cartesian/constants":711,"../cartesian/select":723,"../cartesian/set_convert":724,"../plots":768,d3:131,tinycolor2:473}],790:[function(t,e,r){"use strict";var n=t("./lib/loggers"),i=t("./lib/noop"),a=t("./lib/push_unique"),o=t("./lib/is_plain_object"),s=t("./lib/extend"),l=t("./plots/attributes"),c=t("./plots/layout_attributes"),u=s.extendFlat,f=s.extendDeepAll;function h(t){var e=t.name,i=t.categories,a=t.meta;if(r.modules[e])n.log("Type "+e+" already registered");else{r.subplotsRegistry[t.basePlotModule.name]||function(t){var e=t.name;if(r.subplotsRegistry[e])return void n.log("Plot type "+e+" already registered.");for(var i in m(t),r.subplotsRegistry[e]=t,r.componentsRegistry)x(i,t.name)}(t.basePlotModule);for(var o={},s=0;s-1&&(u[h[r]].title="");for(r=0;r")?"":e.html(t).text()});return e.remove(),r}(_),_=(_=_.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(c,"'"),i.isIE()&&(_=(_=(_=_.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),_}},{"../components/color":532,"../components/drawing":557,"../constants/xmlns_namespaces":639,"../lib":660,d3:131}],799:[function(t,e,r){"use strict";var n=t("../../lib").mergeArray;e.exports=function(t,e){for(var r=0;ra;if(!o)return e}return void 0!==r?r:t.dflt}(t.size,s,n.size),color:function(t,e,r){return a(e).isValid()?e:void 0!==r?r:t.dflt}(t.color,l,n.color)}}function b(t,e){var r;return Array.isArray(t)?e.01?N:function(t,e){return Math.abs(t-e)>=2?N(t):t>e?Math.ceil(t):Math.floor(t)};C=F(C,A=F(A,C)),L=F(L,E=F(E,L))}o.ensureSingle(z,"path").style("vector-effect","non-scaling-stroke").attr("d","M"+A+","+E+"V"+L+"H"+C+"V"+E+"Z").call(c.setClipUrl,e.layerClipId),function(t,e,r,n,i,a,l,u){var f;function w(e,r,n){var i=o.ensureSingle(e,"text").text(r).attr({class:"bartext bartext-"+f,transform:"","text-anchor":"middle","data-notex":1}).call(c.font,n).call(s.convertToTspans,t);return i}var k=r[0].trace,M=k.orientation,A=function(t,e){var r=b(t.text,e);return _(h,r)}(k,n);if(!A)return;if("none"===(f=function(t,e){var r=b(t.textposition,e);return function(t,e,r){return t.coerceNumber&&(e=+e),-1!==t.values.indexOf(e)?e:void 0!==r?r:t.dflt}(p,r)}(k,n)))return;var T,S,C,E,L,z,P=function(t,e,r){return x(d,t.textfont,e,r)}(k,n,t._fullLayout.font),D=function(t,e,r){return x(g,t.insidetextfont,e,r)}(k,n,P),O=function(t,e,r){return x(m,t.outsidetextfont,e,r)}(k,n,P),I=t._fullLayout.barmode,R="stack"===I||"relative"===I,B=r[n],F=!R||B._outmost,N=Math.abs(a-i)-2*v,j=Math.abs(u-l)-2*v;"outside"===f&&(F||(f="inside"));if("auto"===f)if(F){f="inside",T=w(e,A,D),S=c.bBox(T.node()),C=S.width,E=S.height;var V=C>0&&E>0,U=C<=N&&E<=j,q=C<=j&&E<=N,H="h"===M?N>=C*(j/E):j>=E*(N/C);V&&(U||q||H)?f="inside":(f="outside",T.remove(),T=null)}else f="inside";if(!T&&(T=w(e,A,"outside"===f?O:D),S=c.bBox(T.node()),C=S.width,E=S.height,C<=0||E<=0))return void T.remove();"outside"===f?(z="both"===k.constraintext||"outside"===k.constraintext,L=function(t,e,r,n,i,a,o){var s,l="h"===a?Math.abs(n-r):Math.abs(e-t);l>2*v&&(s=v);var c=1;o&&(c="h"===a?Math.min(1,l/i.height):Math.min(1,l/i.width));var u,f,h,p,d=(i.left+i.right)/2,g=(i.top+i.bottom)/2;u=c*i.width,f=c*i.height,"h"===a?er?(h=(t+e)/2,p=n+s+f/2):(h=(t+e)/2,p=n-s-f/2);return y(d,g,h,p,c,!1)}(i,a,l,u,S,M,z)):(z="both"===k.constraintext||"inside"===k.constraintext,L=function(t,e,r,n,i,a,o){var s,l,c,u,f,h,p,d=i.width,g=i.height,m=(i.left+i.right)/2,x=(i.top+i.bottom)/2,b=Math.abs(e-t),_=Math.abs(n-r);b>2*v&&_>2*v?(b-=2*(f=v),_-=2*f):f=0;d<=b&&g<=_?(h=!1,p=1):d<=_&&g<=b?(h=!0,p=1):dr?(c=(t+e)/2,u=n-f-l/2):(c=(t+e)/2,u=n+f+l/2);return y(m,x,c,u,p,h)}(i,a,l,u,S,M,z));T.attr("transform",L)}(t,z,r,u,A,C,E,L),e.layerClipId&&c.hideOutsideRangePoint(r[u],z.select("text"),f,w,M.xcalendar,M.ycalendar)}else z.remove();function N(t){return 0===k.bargap&&0===k.bargroupgap?n.round(Math.round(t)-B,2):t}});var E=!1===r[0].trace.cliponaxis;c.setClipUrl(A,E?null:e.layerClipId)}),u.getComponentMethod("errorbars","plot")(M,e)}},{"../../components/color":532,"../../components/drawing":557,"../../lib":660,"../../lib/svg_text_utils":684,"../../registry":790,"./attributes":800,d3:131,"fast-isnumeric":197,tinycolor2:473}],808:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n=t.cd,i=t.xaxis,a=t.yaxis,o=[];if(!1===e)for(r=0;rf+c||!n(u))&&(p=!0,g(h,t))}for(var m=0;m1||0===s.bargap&&0===s.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),r.selectAll("g.points").each(function(e){o(n.select(this),e[0].trace,t)}),a.getComponentMethod("errorbars","style")(r)},styleOnSelect:function(t,e){var r=e[0].node3,n=e[0].trace;n.selectedpoints?(i.selectedPointStyle(r.selectAll("path"),n),i.selectedTextStyle(r.selectAll("text"),n)):o(r,n,t)}}},{"../../components/drawing":557,"../../registry":790,d3:131}],812:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,s){r("marker.color",o),i(t,"marker")&&a(t,e,s,r,{prefix:"marker.",cLetter:"c"}),r("marker.line.color",n.defaultLine),i(t,"marker.line")&&a(t,e,s,r,{prefix:"marker.line.",cLetter:"c"}),r("marker.line.width"),r("marker.opacity"),r("selected.marker.color"),r("unselected.marker.color")}},{"../../components/color":532,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546}],813:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/color/attributes"),a=t("../../lib/extend").extendFlat,o=n.marker,s=o.line;e.exports={y:{valType:"data_array",editType:"calc+clearAxisTypes"},x:{valType:"data_array",editType:"calc+clearAxisTypes"},x0:{valType:"any",editType:"calc+clearAxisTypes"},y0:{valType:"any",editType:"calc+clearAxisTypes"},name:{valType:"string",editType:"calc+clearAxisTypes"},text:a({},n.text,{}),whiskerwidth:{valType:"number",min:0,max:1,dflt:.5,editType:"calcIfAutorange"},notched:{valType:"boolean",editType:"calcIfAutorange"},notchwidth:{valType:"number",min:0,max:.5,dflt:.25,editType:"calcIfAutorange"},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers",editType:"calcIfAutorange"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1,editType:"calcIfAutorange"},jitter:{valType:"number",min:0,max:1,editType:"calcIfAutorange"},pointpos:{valType:"number",min:-2,max:2,editType:"calcIfAutorange"},orientation:{valType:"enumerated",values:["v","h"],editType:"calc+clearAxisTypes"},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)",editType:"style"},symbol:a({},o.symbol,{arrayOk:!1,editType:"plot"}),opacity:a({},o.opacity,{arrayOk:!1,dflt:1,editType:"style"}),size:a({},o.size,{arrayOk:!1,editType:"calcIfAutorange"}),color:a({},o.color,{arrayOk:!1,editType:"style"}),line:{color:a({},s.color,{arrayOk:!1,dflt:i.defaultLine,editType:"style"}),width:a({},s.width,{arrayOk:!1,dflt:0,editType:"style"}),outliercolor:{valType:"color",editType:"style"},outlierwidth:{valType:"number",min:0,dflt:1,editType:"style"},editType:"style"},editType:"plot"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},editType:"plot"},fillcolor:n.fillcolor,selected:{marker:n.selected.marker,editType:"style"},unselected:{marker:n.unselected.marker,editType:"style"},hoveron:{valType:"flaglist",flags:["boxes","points"],dflt:"boxes+points",editType:"style"}}},{"../../components/color/attributes":531,"../../lib/extend":649,"../scatter/attributes":990}],814:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=i._,o=t("../../plots/cartesian/axes");function s(t,e,r){var n={text:"tx"};for(var i in n)Array.isArray(e[i])&&(t[n[i]]=e[i][r])}function l(t,e){return t.v-e.v}function c(t){return t.v}e.exports=function(t,e){var r,u,f,h,p,d=t._fullLayout,g=o.getFromId(t,e.xaxis||"x"),m=o.getFromId(t,e.yaxis||"y"),v=[],y="violin"===e.type?"_numViolins":"_numBoxes";"h"===e.orientation?(u=g,f="x",h=m,p="y"):(u=m,f="y",h=g,p="x");var x=u.makeCalcdata(e,f),b=function(t,e,r,a,o){if(e in t)return r.makeCalcdata(t,e);var s;s=e+"0"in t?t[e+"0"]:"name"in t&&("category"===r.type||n(t.name)&&-1!==["linear","log"].indexOf(r.type)||i.isDateTime(t.name)&&"date"===r.type)?t.name:o;var l=r.d2c(s,0,t[e+"calendar"]);return a.map(function(){return l})}(e,p,h,x,d[y]),_=i.distinctVals(b),w=_.vals,k=_.minDiff/2,M=function(t,e){for(var r=t.length,n=new Array(r+1),i=0;i=0&&C0){var L=T[r].sort(l),z=L.map(c),P=z.length,D={pos:w[r],pts:L};D.min=z[0],D.max=z[P-1],D.mean=i.mean(z,P),D.sd=i.stdev(z,P,D.mean),D.q1=i.interp(z,.25),D.med=i.interp(z,.5),D.q3=i.interp(z,.75),D.lf=Math.min(D.q1,z[Math.min(i.findBin(2.5*D.q1-1.5*D.q3,z,!0)+1,P-1)]),D.uf=Math.max(D.q3,z[Math.max(i.findBin(2.5*D.q3-1.5*D.q1,z),0)]),D.lo=4*D.q1-3*D.q3,D.uo=4*D.q3-3*D.q1;var O=1.57*(D.q3-D.q1)/Math.sqrt(P);D.ln=D.med-O,D.un=D.med+O,v.push(D)}return function(t,e){if(i.isArrayOrTypedArray(e.selectedpoints))for(var r=0;r0?(v[0].t={num:d[y],dPos:k,posLetter:p,valLetter:f,labels:{med:a(t,"median:"),min:a(t,"min:"),q1:a(t,"q1:"),q3:a(t,"q3:"),max:a(t,"max:"),mean:"sd"===e.boxmean?a(t,"mean \xb1 \u03c3:"):a(t,"mean:"),lf:a(t,"lower fence:"),uf:a(t,"upper fence:")}},d[y]++,v):[{t:{empty:!0}}]}},{"../../lib":660,"../../plots/cartesian/axes":706,"fast-isnumeric":197}],815:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry"),a=t("../../components/color"),o=t("./attributes");function s(t,e,r,n){var a,o,s=r("y"),l=r("x"),c=l&&l.length;if(s&&s.length)a="v",c?o=Math.min(l.length,s.length):(r("x0"),o=s.length);else{if(!c)return void(e.visible=!1);a="h",r("y0"),o=l.length}e._length=o,i.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],n),r("orientation",a)}function l(t,e,r,i){var a=i.prefix,s=n.coerce2(t,e,o,"marker.outliercolor"),l=r("marker.line.outliercolor"),c=r(a+"points",s||l?"suspectedoutliers":void 0);c?(r("jitter","all"===c?.3:0),r("pointpos","all"===c?-1.5:0),r("marker.symbol"),r("marker.opacity"),r("marker.size"),r("marker.color",e.line.color),r("marker.line.color"),r("marker.line.width"),"suspectedoutliers"===c&&(r("marker.line.outliercolor",e.marker.color),r("marker.line.outlierwidth")),r("selected.marker.color"),r("unselected.marker.color"),r("selected.marker.size"),r("unselected.marker.size"),r("text")):delete e.marker,r("hoveron"),n.coerceSelectionMarkerOpacity(e,r)}e.exports={supplyDefaults:function(t,e,r,i){function c(r,i){return n.coerce(t,e,o,r,i)}s(t,e,c,i),!1!==e.visible&&(c("line.color",(t.marker||{}).color||r),c("line.width"),c("fillcolor",a.addOpacity(e.line.color,.5)),c("whiskerwidth"),c("boxmean"),c("notched",void 0!==t.notchwidth)&&c("notchwidth"),l(t,e,c,{prefix:"box"}))},handleSampleDefaults:s,handlePointsDefaults:l}},{"../../components/color":532,"../../lib":660,"../../registry":790,"./attributes":813}],816:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib"),a=t("../../components/fx"),o=t("../../components/color"),s=t("../scatter/fill_hover_text");function l(t,e,r,s){var l,c,u,f,h,p,d,g,m,v,y,x,b=t.cd,_=t.xa,w=t.ya,k=b[0].trace,M=b[0].t,A="violin"===k.type,T=[],S=M.bdPos,C=M.wHover,E=function(t){return t.pos+M.bPos-p};A&&"both"!==k.side?("positive"===k.side&&(m=function(t){var e=E(t);return a.inbox(e,e+C,v)}),"negative"===k.side&&(m=function(t){var e=E(t);return a.inbox(e-C,e,v)})):m=function(t){var e=E(t);return a.inbox(e-C,e+C,v)},x=A?function(t){return a.inbox(t.span[0]-h,t.span[1]-h,v)}:function(t){return a.inbox(t.min-h,t.max-h,v)},"h"===k.orientation?(h=e,p=r,d=x,g=m,l="y",u=w,c="x",f=_):(h=r,p=e,d=m,g=x,l="x",u=_,c="y",f=w);var L=Math.min(1,S/Math.abs(u.r2c(u.range[1])-u.r2c(u.range[0])));function z(t){return(d(t)+g(t))/2}v=t.maxHoverDistance-L,y=t.maxSpikeDistance-L;var P=a.getDistanceFunction(s,d,g,z);if(a.getClosest(b,P,t),!1===t.index)return[];var D=b[t.index],O=k.line.color,I=(k.marker||{}).color;o.opacity(O)&&k.line.width?t.color=O:o.opacity(I)&&k.boxpoints?t.color=I:t.color=k.fillcolor,t[l+"0"]=u.c2p(D.pos+M.bPos-S,!0),t[l+"1"]=u.c2p(D.pos+M.bPos+S,!0),t[l+"LabelVal"]=D.pos;var R=l+"Spike";t.spikeDistance=z(D)*y/v,t[R]=u.c2p(D.pos,!0);var B={},F=["med","min","q1","q3","max"];(k.boxmean||(k.meanline||{}).visible)&&F.push("mean"),(k.boxpoints||k.points)&&F.push("lf","uf");for(var N=0;Nt.uf}),l=Math.max((t.max-t.min)/10,t.q3-t.q1),c=1e-9*l,p=l*s,d=[],g=0;if(r.jitter){if(0===l)for(g=1,d=new Array(a.length),e=0;et.lo&&(_.so=!0)}return a});d.enter().append("path").classed("point",!0),d.exit().remove(),d.call(a.translatePoints,l,c)}function u(t,e,r,a){var o,s,l=e.pos,c=e.val,u=a.bPos,f=a.bPosPxOffset||0;Array.isArray(a.bdPos)?(o=a.bdPos[0],s=a.bdPos[1]):(o=a.bdPos,s=a.bdPos);var h=t.selectAll("path.mean").data(i.identity);h.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}),h.exit().remove(),h.each(function(t){var e=l.c2p(t.pos+u,!0)+f,i=l.c2p(t.pos+u-o,!0)+f,a=l.c2p(t.pos+u+s,!0)+f,h=c.c2p(t.mean,!0),p=c.c2p(t.mean-t.sd,!0),d=c.c2p(t.mean+t.sd,!0);"h"===r.orientation?n.select(this).attr("d","M"+h+","+i+"V"+a+("sd"===r.boxmean?"m0,0L"+p+","+e+"L"+h+","+i+"L"+d+","+e+"Z":"")):n.select(this).attr("d","M"+i+","+h+"H"+a+("sd"===r.boxmean?"m0,0L"+e+","+p+"L"+i+","+h+"L"+e+","+d+"Z":""))})}e.exports={plot:function(t,e,r,i){var a=t._fullLayout,o=e.xaxis,s=e.yaxis,f=i.selectAll("g.trace.boxes").data(r,function(t){return t[0].trace.uid});f.enter().append("g").attr("class","trace boxes"),f.exit().remove(),f.order(),f.each(function(t){var r=t[0],i=r.t,f=r.trace,h=n.select(this);e.isRangePlot||(r.node3=h);var p,d,g=a._numBoxes,m=1-a.boxgap,v="group"===a.boxmode&&g>1,y=i.dPos*m*(1-a.boxgroupgap)/(v?g:1),x=v?2*i.dPos*((i.num+.5)/g-.5)*m:0,b=y*f.whiskerwidth;!0!==f.visible||i.empty?h.remove():("h"===f.orientation?(p=s,d=o):(p=o,d=s),i.bPos=x,i.bdPos=y,i.wdPos=b,i.wHover=i.dPos*(v?m/g:1),l(h,{pos:p,val:d},f,i),f.boxpoints&&c(h,{x:o,y:s},f,i),f.boxmean&&u(h,{pos:p,val:d},f,i))})},plotBoxAndWhiskers:l,plotPoints:c,plotBoxMean:u}},{"../../components/drawing":557,"../../lib":660,d3:131}],821:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,i=t.cd,a=t.xaxis,o=t.yaxis,s=[];if(!1===e)for(r=0;r=10)return null;var i=1/0;var a=-1/0;var o=e.length;for(var s=0;s0?Math.floor:Math.ceil,P=E>0?Math.ceil:Math.floor,D=E>0?Math.min:Math.max,O=E>0?Math.max:Math.min,I=z(S+L),R=P(C-L),B=[[f=T(S)]];for(a=I;a*E=0;i--)a[u-i]=t[f][i],o[u-i]=e[f][i];for(s.push({x:a,y:o,bicubic:l}),i=f,a=[],o=[];i>=0;i--)a[f-i]=t[i][0],o[f-i]=e[i][0];return s.push({x:a,y:o,bicubic:c}),s}},{}],836:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib/extend").extendFlat;e.exports=function(t,e,r){var a,o,s,l,c,u,f,h,p,d,g,m,v,y,x=t["_"+e],b=t[e+"axis"],_=b._gridlines=[],w=b._minorgridlines=[],k=b._boundarylines=[],M=t["_"+r],A=t[r+"axis"];"array"===b.tickmode&&(b.tickvals=x.slice());var T=t._xctrl,S=t._yctrl,C=T[0].length,E=T.length,L=t._a.length,z=t._b.length;n.prepTicks(b),"array"===b.tickmode&&delete b.tickvals;var P=b.smoothing?3:1;function D(n){var i,a,o,s,l,c,u,f,p,d,g,m,v=[],y=[],x={};if("b"===e)for(a=t.b2j(n),o=Math.floor(Math.max(0,Math.min(z-2,a))),s=a-o,x.length=z,x.crossLength=L,x.xy=function(e){return t.evalxy([],e,a)},x.dxy=function(e,r){return t.dxydi([],e,o,r,s)},i=0;i0&&(p=t.dxydi([],i-1,o,0,s),v.push(l[0]+p[0]/3),y.push(l[1]+p[1]/3),d=t.dxydi([],i-1,o,1,s),v.push(f[0]-d[0]/3),y.push(f[1]-d[1]/3)),v.push(f[0]),y.push(f[1]),l=f;else for(i=t.a2i(n),c=Math.floor(Math.max(0,Math.min(L-2,i))),u=i-c,x.length=L,x.crossLength=z,x.xy=function(e){return t.evalxy([],i,e)},x.dxy=function(e,r){return t.dxydj([],c,e,u,r)},a=0;a0&&(g=t.dxydj([],c,a-1,u,0),v.push(l[0]+g[0]/3),y.push(l[1]+g[1]/3),m=t.dxydj([],c,a-1,u,1),v.push(f[0]-m[0]/3),y.push(f[1]-m[1]/3)),v.push(f[0]),y.push(f[1]),l=f;return x.axisLetter=e,x.axis=b,x.crossAxis=A,x.value=n,x.constvar=r,x.index=h,x.x=v,x.y=y,x.smoothing=A.smoothing,x}function O(n){var i,a,o,s,l,c=[],u=[],f={};if(f.length=x.length,f.crossLength=M.length,"b"===e)for(o=Math.max(0,Math.min(z-2,n)),l=Math.min(1,Math.max(0,n-o)),f.xy=function(e){return t.evalxy([],e,n)},f.dxy=function(e,r){return t.dxydi([],e,o,r,l)},i=0;ix.length-1||_.push(i(O(o),{color:b.gridcolor,width:b.gridwidth}));for(h=u;hx.length-1||g<0||g>x.length-1))for(m=x[s],v=x[g],a=0;ax[x.length-1]||w.push(i(D(d),{color:b.minorgridcolor,width:b.minorgridwidth}));b.startline&&k.push(i(O(0),{color:b.startlinecolor,width:b.startlinewidth})),b.endline&&k.push(i(O(x.length-1),{color:b.endlinecolor,width:b.endlinewidth}))}else{for(l=5e-15,u=(c=[Math.floor((x[x.length-1]-b.tick0)/b.dtick*(1+l)),Math.ceil((x[0]-b.tick0)/b.dtick/(1+l))].sort(function(t,e){return t-e}))[0],f=c[1],h=u;h<=f;h++)p=b.tick0+b.dtick*h,_.push(i(D(p),{color:b.gridcolor,width:b.gridwidth}));for(h=u-1;hx[x.length-1]||w.push(i(D(d),{color:b.minorgridcolor,width:b.minorgridwidth}));b.startline&&k.push(i(D(x[0]),{color:b.startlinecolor,width:b.startlinewidth})),b.endline&&k.push(i(D(x[x.length-1]),{color:b.endlinecolor,width:b.endlinewidth}))}}},{"../../lib/extend":649,"../../plots/cartesian/axes":706}],837:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib/extend").extendFlat;e.exports=function(t,e){var r,a,o,s=e._labels=[],l=e._gridlines;for(r=0;re.length&&(t=t.slice(0,e.length)):t=[],i=0;i90&&(p-=180,l=-l),{angle:p,flip:l,p:t.c2p(n,e,r),offsetMultplier:c}}},{}],851:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/drawing"),a=t("./map_1d_array"),o=t("./makepath"),s=t("./orient_text"),l=t("../../lib/svg_text_utils"),c=t("../../lib"),u=t("../../constants/alignment"),f=t("../../plots/get_data").getUidsFromCalcData;function h(t,e,r,n){var i=r[0],l=r[0].trace,u=e.xaxis,f=e.yaxis,h=l.aaxis,g=l.baxis,m=t._fullLayout._clips,y=c.ensureSingle(n,"g","carpet"+l.uid).classed("trace",!0),x=c.ensureSingle(y,"g","minorlayer"),b=c.ensureSingle(y,"g","majorlayer"),_=c.ensureSingle(y,"g","boundarylayer"),w=c.ensureSingle(y,"g","labellayer");y.style("opacity",l.opacity),p(u,f,b,h,"a",h._gridlines),p(u,f,b,g,"b",g._gridlines),p(u,f,x,h,"a",h._minorgridlines),p(u,f,x,g,"b",g._minorgridlines),p(u,f,_,h,"a-boundary",h._boundarylines),p(u,f,_,g,"b-boundary",g._boundarylines),function(t,e,r,n,i,a,o,l){var u,f,h,p;u=.5*(r.a[0]+r.a[r.a.length-1]),f=r.b[0],h=r.ab2xy(u,f,!0),p=r.dxyda_rough(u,f),void 0===o.angle&&c.extendFlat(o,s(r,i,a,h,r.dxydb_rough(u,f)));v(t,e,r,n,h,p,r.aaxis,i,a,o,"a-title"),u=r.a[0],f=.5*(r.b[0]+r.b[r.b.length-1]),h=r.ab2xy(u,f,!0),p=r.dxydb_rough(u,f),void 0===l.angle&&c.extendFlat(l,s(r,i,a,h,r.dxyda_rough(u,f)));v(t,e,r,n,h,p,r.baxis,i,a,l,"b-title")}(t,w,l,i,u,f,d(t,u,f,l,i,w,h._labels,"a-label"),d(t,u,f,l,i,w,g._labels,"b-label")),function(t,e,r,n,i){var s,l,u,f,h=r.select("#"+t._clipPathId);h.size()||(h=r.append("clipPath").classed("carpetclip",!0));var p=c.ensureSingle(h,"path","carpetboundary"),d=e.clipsegments,g=[];for(f=0;f0?"start":"end","data-notex":1}).call(i.font,o.font).text(o.text).call(l.convertToTspans,t),m=i.bBox(this);g.attr("transform","translate("+u.p[0]+","+u.p[1]+") rotate("+u.angle+")translate("+o.axis.labelpadding*h+","+.3*m.height+")"),p=Math.max(p,m.width+o.axis.labelpadding)}),h.exit().remove(),d.maxExtent=p,d}e.exports=function(t,e,r,i){var a=f(r);i.selectAll("g.trace").each(function(){var t=n.select(this).attr("class").split("carpet")[1].split(/\s/)[0];a[t]||n.select(this).remove()});for(var o=0;o90&&d<270,y=n.select(this);y.text(u.title||"").call(l.convertToTspans,t),v&&(x=(-l.lineCount(y)+m)*g*a-x),y.attr("transform","translate("+e.p[0]+","+e.p[1]+") rotate("+e.angle+") translate(0,"+x+")").classed("user-select-none",!0).attr("text-anchor","middle").call(i.font,u.titlefont)}),y.exit().remove()}},{"../../components/drawing":557,"../../constants/alignment":632,"../../lib":660,"../../lib/svg_text_utils":684,"../../plots/get_data":742,"./makepath":848,"./map_1d_array":849,"./orient_text":850,d3:131}],852:[function(t,e,r){"use strict";var n=t("./constants"),i=t("../../lib/search").findBin,a=t("./compute_control_points"),o=t("./create_spline_evaluator"),s=t("./create_i_derivative_evaluator"),l=t("./create_j_derivative_evaluator");e.exports=function(t){var e=t._a,r=t._b,c=e.length,u=r.length,f=t.aaxis,h=t.baxis,p=e[0],d=e[c-1],g=r[0],m=r[u-1],v=e[e.length-1]-e[0],y=r[r.length-1]-r[0],x=v*n.RELATIVE_CULL_TOLERANCE,b=y*n.RELATIVE_CULL_TOLERANCE;p-=x,d+=x,g-=b,m+=b,t.isVisible=function(t,e){return t>p&&tg&&ed||em},t.setScale=function(){var e=t._x,r=t._y,n=a(t._xctrl,t._yctrl,e,r,f.smoothing,h.smoothing);t._xctrl=n[0],t._yctrl=n[1],t.evalxy=o([t._xctrl,t._yctrl],c,u,f.smoothing,h.smoothing),t.dxydi=s([t._xctrl,t._yctrl],f.smoothing,h.smoothing),t.dxydj=l([t._xctrl,t._yctrl],f.smoothing,h.smoothing)},t.i2a=function(t){var r=Math.max(0,Math.floor(t[0]),c-2),n=t[0]-r;return(1-n)*e[r]+n*e[r+1]},t.j2b=function(t){var e=Math.max(0,Math.floor(t[1]),c-2),n=t[1]-e;return(1-n)*r[e]+n*r[e+1]},t.ij2ab=function(e){return[t.i2a(e[0]),t.j2b(e[1])]},t.a2i=function(t){var r=Math.max(0,Math.min(i(t,e),c-2)),n=e[r],a=e[r+1];return Math.max(0,Math.min(c-1,r+(t-n)/(a-n)))},t.b2j=function(t){var e=Math.max(0,Math.min(i(t,r),u-2)),n=r[e],a=r[e+1];return Math.max(0,Math.min(u-1,e+(t-n)/(a-n)))},t.ab2ij=function(e){return[t.a2i(e[0]),t.b2j(e[1])]},t.i2c=function(e,r){return t.evalxy([],e,r)},t.ab2xy=function(n,i,a){if(!a&&(ne[c-1]|ir[u-1]))return[!1,!1];var o=t.a2i(n),s=t.b2j(i),l=t.evalxy([],o,s);if(a){var f,h,p,d,g=0,m=0,v=[];ne[c-1]?(f=c-2,h=1,g=(n-e[c-1])/(e[c-1]-e[c-2])):h=o-(f=Math.max(0,Math.min(c-2,Math.floor(o)))),ir[u-1]?(p=u-2,d=1,m=(i-r[u-1])/(r[u-1]-r[u-2])):d=s-(p=Math.max(0,Math.min(u-2,Math.floor(s)))),g&&(t.dxydi(v,f,p,h,d),l[0]+=v[0]*g,l[1]+=v[1]*g),m&&(t.dxydj(v,f,p,h,d),l[0]+=v[0]*m,l[1]+=v[1]*m)}return l},t.c2p=function(t,e,r){return[e.c2p(t[0]),r.c2p(t[1])]},t.p2x=function(t,e,r){return[e.p2c(t[0]),r.p2c(t[1])]},t.dadi=function(t){var r=Math.max(0,Math.min(e.length-2,t));return e[r+1]-e[r]},t.dbdj=function(t){var e=Math.max(0,Math.min(r.length-2,t));return r[e+1]-r[e]},t.dxyda=function(e,r,n,i){var a=t.dxydi(null,e,r,n,i),o=t.dadi(e,n);return[a[0]/o,a[1]/o]},t.dxydb=function(e,r,n,i){var a=t.dxydj(null,e,r,n,i),o=t.dbdj(r,i);return[a[0]/o,a[1]/o]},t.dxyda_rough=function(e,r,n){var i=v*(n||.1),a=t.ab2xy(e+i,r,!0),o=t.ab2xy(e-i,r,!0);return[.5*(a[0]-o[0])/i,.5*(a[1]-o[1])/i]},t.dxydb_rough=function(e,r,n){var i=y*(n||.1),a=t.ab2xy(e,r+i,!0),o=t.ab2xy(e,r-i,!0);return[.5*(a[0]-o[0])/i,.5*(a[1]-o[1])/i]},t.dpdx=function(t){return t._m},t.dpdy=function(t){return t._m}}},{"../../lib/search":679,"./compute_control_points":840,"./constants":841,"./create_i_derivative_evaluator":842,"./create_j_derivative_evaluator":843,"./create_spline_evaluator":844}],853:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){var i,a,o,s=[],l=[],c=t[0].length,u=t.length;function f(e,r){var n,i=0,a=0;return e>0&&void 0!==(n=t[r][e-1])&&(a++,i+=n),e0&&void 0!==(n=t[r-1][e])&&(a++,i+=n),r0&&a0&&i1e-5);return n.log("Smoother converged to",M,"after",A,"iterations"),t}},{"../../lib":660}],854:[function(t,e,r){"use strict";var n=t("../../lib").isArray1D;e.exports=function(t,e,r){var i=r("x"),a=i&&i.length,o=r("y"),s=o&&o.length;if(!a&&!s)return!1;if(e._cheater=!i,a&&!n(i)||s&&!n(o))e._length=null;else{var l=a?i.length:1/0;s&&(l=Math.min(l,o.length)),e.a&&e.a.length&&(l=Math.min(l,e.a.length)),e.b&&e.b.length&&(l=Math.min(l,e.b.length)),e._length=l}return!0}},{"../../lib":660}],855:[function(t,e,r){"use strict";var n=t("../scattergeo/attributes"),i=t("../../components/colorscale/attributes"),a=t("../../components/colorbar/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend"),l=s.extendFlat,c=s.extendDeepAll,u=n.marker.line;e.exports=l({locations:{valType:"data_array",editType:"calc"},locationmode:n.locationmode,z:{valType:"data_array",editType:"calc"},text:l({},n.text,{}),marker:{line:{color:u.color,width:l({},u.width,{dflt:1}),editType:"calc"},opacity:{valType:"number",arrayOk:!0,min:0,max:1,dflt:1,editType:"style"},editType:"calc"},selected:{marker:{opacity:n.selected.marker.opacity,editType:"plot"},editType:"plot"},unselected:{marker:{opacity:n.unselected.marker.opacity,editType:"plot"},editType:"plot"},hoverinfo:l({},o.hoverinfo,{editType:"calc",flags:["location","z","text","name"]})},c({},i,{zmax:{editType:"calc"},zmin:{editType:"calc"}}),{colorbar:a})},{"../../components/colorbar/attributes":533,"../../components/colorscale/attributes":538,"../../lib/extend":649,"../../plots/attributes":703,"../scattergeo/attributes":1028}],856:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../constants/numerical").BADNUM,a=t("../../components/colorscale/calc"),o=t("../scatter/arrays_to_calcdata"),s=t("../scatter/calc_selection");e.exports=function(t,e){for(var r=e._length,l=new Array(r),c=0;c")}(t,f,o,h.mockAxis),[t]}},{"../../plots/cartesian/axes":706,"../scatter/fill_hover_text":998,"./attributes":855}],860:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style").style,n.styleOnSelect=t("./style").styleOnSelect,n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":736,"../heatmap/colorbar":902,"./attributes":855,"./calc":856,"./defaults":857,"./event_data":858,"./hover":859,"./plot":861,"./select":862,"./style":863}],861:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../lib/polygon"),o=t("../../lib/topojson_utils").getTopojsonFeatures,s=t("../../lib/geo_location_utils").locationToFeature,l=t("./style").style;function c(t,e){for(var r=t[0].trace,n=t.length,i=o(r,e),a=0;a0&&t[e+1][0]<0)return e;return null}switch(e="RUS"===l||"FJI"===l?function(t){var e;if(null===u(t))e=t;else for(e=new Array(t.length),i=0;ie?r[n++]=[t[i][0]+360,t[i][1]]:i===e?(r[n++]=t[i],r[n++]=[t[i][0],-90]):r[n++]=t[i];var o=a.tester(r);o.pts.pop(),c.push(o)}:function(t){c.push(a.tester(t))},o.type){case"MultiPolygon":for(r=0;r":f.value>h&&(s.prefixBoundary=!0);break;case"<":f.valueh)&&(s.prefixBoundary=!0);break;case"][":a=Math.min.apply(null,f.value),o=Math.max.apply(null,f.value),ah&&(s.prefixBoundary=!0)}}},{}],873:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../components/colorbar/draw"),a=t("./make_color_map"),o=t("./end_plus");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+s).remove(),r.showscale){var l=i(t,s);e[0].t.cb=l;var c=r.contours,u=r.line,f=c.size||1,h=c.coloring,p=a(r,{isColorbar:!0});"heatmap"===h&&l.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),l.fillcolor("fill"===h||"heatmap"===h?p:"").line({color:"lines"===h?p:u.color,width:!1!==c.showlines?u.width:0,dash:u.dash}).levels({start:c.start,end:o(c),size:f}).options(r.colorbar)()}else n.autoMargin(t,s)}},{"../../components/colorbar/draw":536,"../../plots/plots":768,"./end_plus":881,"./make_color_map":886}],874:[function(t,e,r){"use strict";e.exports={BOTTOMSTART:[1,9,13,104,713],TOPSTART:[4,6,7,104,713],LEFTSTART:[8,12,14,208,1114],RIGHTSTART:[2,3,11,208,1114],NEWDELTA:[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]],CHOOSESADDLE:{104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},SADDLEREMAINDER:{1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11},LABELDISTANCE:2,LABELINCREASE:10,LABELMIN:3,LABELMAX:10,LABELOPTIMIZER:{EDGECOST:1,ANGLECOST:1,NEIGHBORCOST:5,SAMELEVELFACTOR:10,SAMELEVELDISTANCE:5,MAXCOST:100,INITIALSEARCHPOINTS:10,ITERATIONS:5}}},{}],875:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("./label_defaults"),a=t("../../components/color"),o=a.addOpacity,s=a.opacity,l=t("../../constants/filter_ops"),c=l.CONSTRAINT_REDUCTION,u=l.COMPARISON_OPS2;e.exports=function(t,e,r,a,l,f){var h,p,d,g=e.contours,m=r("contours.operation");(g._operation=c[m],function(t,e){var r;-1===u.indexOf(e.operation)?(t("contours.value",[0,1]),Array.isArray(e.value)?e.value.length>2?e.value=e.value.slice(2):0===e.length?e.value=[0,1]:e.length<2?(r=parseFloat(e.value[0]),e.value=[r,r+1]):e.value=[parseFloat(e.value[0]),parseFloat(e.value[1])]:n(e.value)&&(r=parseFloat(e.value),e.value=[r,r+1])):(t("contours.value",0),n(e.value)||(Array.isArray(e.value)?e.value=parseFloat(e.value[0]):e.value=0))}(r,g),"="===m?h=g.showlines=!0:(h=r("contours.showlines"),d=r("fillcolor",o((t.line||{}).color||l,.5))),h)&&(p=r("line.color",d&&s(d)?o(e.fillcolor,1):l),r("line.width",2),r("line.dash"));r("line.smoothing"),i(r,a,p,f)}},{"../../components/color":532,"../../constants/filter_ops":633,"./label_defaults":885,"fast-isnumeric":197}],876:[function(t,e,r){"use strict";var n=t("../../constants/filter_ops"),i=t("fast-isnumeric");function a(t,e){var r,a=Array.isArray(e);function o(t){return i(t)?+t:null}return-1!==n.COMPARISON_OPS2.indexOf(t)?r=o(a?e[0]:e):-1!==n.INTERVAL_OPS.indexOf(t)?r=a?[o(e[0]),o(e[1])]:[o(e),o(e)]:-1!==n.SET_OPS.indexOf(t)&&(r=a?e.map(o):[o(e)]),r}function o(t){return function(e){e=a(t,e);var r=Math.min(e[0],e[1]),n=Math.max(e[0],e[1]);return{start:r,end:n,size:n-r}}}function s(t){return function(e){return{start:e=a(t,e),end:1/0,size:1/0}}}e.exports={"[]":o("[]"),"][":o("]["),">":s(">"),"<":s("<"),"=":s("=")}},{"../../constants/filter_ops":633,"fast-isnumeric":197}],877:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=n("contours.start"),a=n("contours.end"),o=!1===i||!1===a,s=r("contours.size");!(o?e.autocontour=!0:r("autocontour",!1))&&s||r("ncontours")}},{}],878:[function(t,e,r){"use strict";var n=t("../../lib");function i(t){return n.extendFlat({},t,{edgepaths:n.extendDeep([],t.edgepaths),paths:n.extendDeep([],t.paths)})}e.exports=function(t,e){var r,a,o,s=function(t){return t.reverse()},l=function(t){return t};switch(e){case"=":case"<":return t;case">":for(1!==t.length&&n.warn("Contour data invalid for the specified inequality operation."),a=t[0],r=0;r1e3){n.warn("Too many contours, clipping at 1000",t);break}return l}},{"../../lib":660,"./constraint_mapping":876,"./end_plus":881}],881:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],882:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./constants");function a(t,e,r,n){return Math.abs(t[0]-e[0])20&&e?208===t||1114===t?n=0===r[0]?1:-1:a=0===r[1]?1:-1:-1!==i.BOTTOMSTART.indexOf(t)?a=1:-1!==i.LEFTSTART.indexOf(t)?n=1:-1!==i.TOPSTART.indexOf(t)?a=-1:n=-1;return[n,a]}(h,r,e),d=[s(t,e,[-p[0],-p[1]])],g=p.join(","),m=t.z.length,v=t.z[0].length;for(c=0;c<1e4;c++){if(h>20?(h=i.CHOOSESADDLE[h][(p[0]||p[1])<0?0:1],t.crossings[f]=i.SADDLEREMAINDER[h]):delete t.crossings[f],!(p=i.NEWDELTA[h])){n.log("Found bad marching index:",h,e,t.level);break}d.push(s(t,e,p)),e[0]+=p[0],e[1]+=p[1],a(d[d.length-1],d[d.length-2],o,l)&&d.pop(),f=e.join(",");var y=p[0]&&(e[0]<0||e[0]>v-2)||p[1]&&(e[1]<0||e[1]>m-2);if(f===u&&p.join(",")===g||r&&y)break;h=t.crossings[f]}1e4===c&&n.log("Infinite loop in contour?");var x,b,_,w,k,M,A,T,S,C,E,L,z,P,D,O=a(d[0],d[d.length-1],o,l),I=0,R=.2*t.smoothing,B=[],F=0;for(c=1;c=F;c--)if((x=B[c])=F&&x+B[b]T&&S--,t.edgepaths[S]=E.concat(d,C));break}U||(t.edgepaths[T]=d.concat(C))}for(T=0;Tt?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);return 5===r||10===r?t>(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4?5===r?713:1114:5===r?104:208:15===r?0:r}e.exports=function(t){var e,r,a,o,s,l,c,u,f,h=t[0].z,p=h.length,d=h[0].length,g=2===p||2===d;for(r=0;rt.level}return r?"M"+e.join("L")+"Z":""}(t,e),h=0,p=t.edgepaths.map(function(t,e){return e}),d=!0;function g(t){return Math.abs(t[1]-e[2][1])<.01}function m(t){return Math.abs(t[0]-e[0][0])<.01}function v(t){return Math.abs(t[0]-e[2][0])<.01}for(;p.length;){for(c=a.smoothopen(t.edgepaths[h],t.smoothing),f+=d?c:c.replace(/^M/,"L"),p.splice(p.indexOf(h),1),r=t.edgepaths[h][t.edgepaths[h].length-1],s=-1,o=0;o<4;o++){if(!r){i.log("Missing end?",h,t);break}for(u=r,Math.abs(u[1]-e[0][1])<.01&&!v(r)?n=e[1]:m(r)?n=e[0]:g(r)?n=e[3]:v(r)&&(n=e[2]),l=0;l=0&&(n=y,s=l):Math.abs(r[1]-n[1])<.01?Math.abs(r[1]-y[1])<.01&&(y[0]-r[0])*(n[0]-y[0])>=0&&(n=y,s=l):i.log("endpt to newendpt is not vert. or horz.",r,n,y)}if(r=n,s>=0)break;f+="L"+n}if(s===t.edgepaths.length){i.log("unclosed perimeter path");break}h=s,(d=-1===p.indexOf(h))&&(h=p[0],f+="Z")}for(h=0;hn.center?n.right-s:s-n.left)/(u+Math.abs(Math.sin(c)*o)),p=(l>n.middle?n.bottom-l:l-n.top)/(Math.abs(f)+Math.cos(c)*o);if(h<1||p<1)return 1/0;var d=v.EDGECOST*(1/(h-1)+1/(p-1));d+=v.ANGLECOST*c*c;for(var g=s-u,m=l-f,y=s+u,x=l+f,b=0;b2*v.MAXCOST)break;p&&(s/=2),l=(o=c-s/2)+1.5*s}if(h<=v.MAXCOST)return u},r.addLabelData=function(t,e,r,n){var i=e.width/2,a=e.height/2,o=t.x,s=t.y,l=t.theta,c=Math.sin(l),u=Math.cos(l),f=i*u,h=a*c,p=i*c,d=-a*u,g=[[o-f-h,s-p-d],[o+f-h,s+p-d],[o+f+h,s+p+d],[o-f+h,s-p+d]];r.push({text:e.text,x:o,y:s,dy:e.dy,theta:l,level:e.level,width:e.width,height:e.height}),n.push(g)},r.drawLabels=function(t,e,r,a,s){var l=t.selectAll("text").data(e,function(t){return t.text+","+t.x+","+t.y+","+t.theta});if(l.exit().remove(),l.enter().append("text").attr({"data-notex":1,"text-anchor":"middle"}).each(function(t){var e=t.x+Math.sin(t.theta)*t.dy,i=t.y-Math.cos(t.theta)*t.dy;n.select(this).text(t.text).attr({x:e,y:i,transform:"rotate("+180*t.theta/Math.PI+" "+e+" "+i+")"}).call(o.convertToTspans,r)}),s){for(var c="",u=0;ue.end&&(e.start=e.end=(e.start+e.end)/2),t._input.contours||(t._input.contours={}),i.extendFlat(t._input.contours,{start:e.start,end:e.end,size:e.size}),t._input.autocontour=!0}else if("constraint"!==e.type){var l,c=e.start,u=e.end,f=t._input.contours;if(c>u&&(e.start=f.start=u,u=e.end=f.end=c,c=e.start),!(e.size>0))l=c===u?1:a(c,u,t.ncontours).dtick,f.size=e.size=l}}},{"../../lib":660,"../../plots/cartesian/axes":706}],890:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/drawing"),a=t("../heatmap/style"),o=t("./make_color_map");e.exports=function(t){var e=n.select(t).selectAll("g.contour");e.style("opacity",function(t){return t.trace.opacity}),e.each(function(t){var e=n.select(this),r=t.trace,a=r.contours,s=r.line,l=a.size||1,c=a.start,u="constraint"===a.type,f=!u&&"lines"===a.coloring,h=!u&&"fill"===a.coloring,p=f||h?o(r):null;e.selectAll("g.contourlevel").each(function(t){n.select(this).selectAll("path").call(i.lineGroupStyle,s.width,f?p(t.level):s.color,s.dash)});var d=a.labelfont;if(e.selectAll("g.contourlabels text").each(function(t){i.font(n.select(this),{family:d.family,size:d.size,color:d.color||(f?p(t.level):s.color)})}),u)e.selectAll("g.contourfill path").style("fill",r.fillcolor);else if(h){var g;e.selectAll("g.contourfill path").style("fill",function(t){return void 0===g&&(g=t.level),p(t.level+.5*l)}),void 0===g&&(g=c),e.selectAll("g.contourbg path").style("fill",p(g-.5*l))}}),a(t)}},{"../../components/drawing":557,"../heatmap/style":912,"./make_color_map":886,d3:131}],891:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults"),i=t("./label_defaults");e.exports=function(t,e,r,a,o){var s,l=r("contours.coloring"),c="";"fill"===l&&(s=r("contours.showlines")),!1!==s&&("lines"!==l&&(c=r("line.color","#000")),r("line.width",.5),r("line.dash")),"none"!==l&&n(t,e,a,r,{prefix:"",cLetter:"z"}),r("line.smoothing"),i(r,a,c,o)}},{"../../components/colorscale/defaults":542,"./label_defaults":885}],892:[function(t,e,r){"use strict";var n=t("../heatmap/attributes"),i=t("../contour/attributes"),a=i.contours,o=t("../scatter/attributes"),s=t("../../components/colorscale/attributes"),l=t("../../components/colorbar/attributes"),c=t("../../lib/extend").extendFlat,u=o.line;e.exports=c({},{carpet:{valType:"string",editType:"calc"},z:n.z,a:n.x,a0:n.x0,da:n.dx,b:n.y,b0:n.y0,db:n.dy,text:n.text,transpose:n.transpose,atype:n.xtype,btype:n.ytype,fillcolor:i.fillcolor,autocontour:i.autocontour,ncontours:i.ncontours,contours:{type:a.type,start:a.start,end:a.end,size:a.size,coloring:{valType:"enumerated",values:["fill","lines","none"],dflt:"fill",editType:"calc"},showlines:a.showlines,showlabels:a.showlabels,labelfont:a.labelfont,labelformat:a.labelformat,operation:a.operation,value:a.value,editType:"calc",impliedEdits:{autocontour:!1}},line:{color:c({},u.color,{}),width:u.width,dash:u.dash,smoothing:c({},u.smoothing,{}),editType:"plot"}},s,{autocolorscale:c({},s.autocolorscale,{dflt:!1})},{colorbar:l})},{"../../components/colorbar/attributes":533,"../../components/colorscale/attributes":538,"../../lib/extend":649,"../contour/attributes":870,"../heatmap/attributes":899,"../scatter/attributes":990}],893:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc"),i=t("../../lib").isArray1D,a=t("../heatmap/convert_column_xyz"),o=t("../heatmap/clean_2d_array"),s=t("../heatmap/max_row_length"),l=t("../heatmap/interp2d"),c=t("../heatmap/find_empties"),u=t("../heatmap/make_bound_array"),f=t("./defaults"),h=t("../carpet/lookup_carpetid"),p=t("../contour/set_contours");e.exports=function(t,e){var r=e._carpetTrace=h(t,e);if(r&&r.visible&&"legendonly"!==r.visible){if(!e.a||!e.b){var d=t.data[r.index],g=t.data[e.index];g.a||(g.a=d.a),g.b||(g.b=d.b),f(g,e,e._defaultColor,t._fullLayout)}var m=function(t,e){var r,f,h,p,d,g,m,v=e._carpetTrace,y=v.aaxis,x=v.baxis;y._minDtick=0,x._minDtick=0,i(e.z)&&a(e,y,x,"a","b",["z"]);r=e._a=e._a||e.a,p=e._b=e._b||e.b,r=r?y.makeCalcdata(e,"_a"):[],p=p?x.makeCalcdata(e,"_b"):[],f=e.a0||0,h=e.da||1,d=e.b0||0,g=e.db||1,m=e._z=o(e._z||e.z,e.transpose),e._emptypoints=c(m),e._interpz=l(m,e._emptypoints,e._interpz);var b=s(m),_="scaled"===e.xtype?"":r,w=u(e,_,f,h,b,y),k="scaled"===e.ytype?"":p,M=u(e,k,d,g,m.length,x),A={a:w,b:M,z:m};"levels"===e.contours.type&&"none"!==e.contours.coloring&&n(e,m,"","z");return[A]}(0,e);return p(e),m}}},{"../../components/colorscale/calc":539,"../../lib":660,"../carpet/lookup_carpetid":847,"../contour/set_contours":889,"../heatmap/clean_2d_array":901,"../heatmap/convert_column_xyz":903,"../heatmap/find_empties":905,"../heatmap/interp2d":908,"../heatmap/make_bound_array":909,"../heatmap/max_row_length":910,"./defaults":894}],894:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../heatmap/xyz_defaults"),a=t("./attributes"),o=t("../contour/constraint_defaults"),s=t("../contour/contours_defaults"),l=t("../contour/style_defaults");e.exports=function(t,e,r,c){function u(r,i){return n.coerce(t,e,a,r,i)}if(u("carpet"),t.a&&t.b){if(!i(t,e,u,c,"a","b"))return void(e.visible=!1);u("text");var f="constraint"===u("contours.type");f||delete e.showlegend,f?o(t,e,u,c,r,{hasHover:!1}):(s(t,e,u,function(r){return n.coerce2(t,e,a,r)}),l(t,e,u,c,{hasHover:!1}))}else e._defaultColor=r,e._length=null}},{"../../lib":660,"../contour/constraint_defaults":875,"../contour/contours_defaults":877,"../contour/style_defaults":891,"../heatmap/xyz_defaults":914,"./attributes":892}],895:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../contour/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("../contour/style"),n.moduleType="trace",n.name="contourcarpet",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","svg","carpet","contour","symbols","showLegend","hasLines","carpetDependent"],n.meta={},e.exports=n},{"../../plots/cartesian":717,"../contour/colorbar":873,"../contour/style":890,"./attributes":892,"./calc":893,"./defaults":894,"./plot":898}],896:[function(t,e,r){"use strict";var n=t("../../components/drawing"),i=t("../carpet/axis_aligned_line"),a=t("../../lib");e.exports=function(t,e,r,o,s,l,c,u){var f,h,p,d,g,m,v,y="",x=e.edgepaths.map(function(t,e){return e}),b=!0,_=1e-4*Math.abs(r[0][0]-r[2][0]),w=1e-4*Math.abs(r[0][1]-r[2][1]);function k(t){return Math.abs(t[1]-r[0][1])=0&&(p=E,g=m):Math.abs(h[1]-p[1])=0&&(p=E,g=m):a.log("endpt to newendpt is not vert. or horz.",h,p,E)}if(g>=0)break;y+=S(h,p),h=p}if(g===e.edgepaths.length){a.log("unclosed perimeter path");break}f=g,(b=-1===x.indexOf(f))&&(f=x[0],y+=S(h,p)+"Z",h=null)}for(f=0;f=0;q--)j=M.clipsegments[q],V=i([],j.x,E.c2p),U=i([],j.y,L.c2p),V.reverse(),U.reverse(),G.push(a(V,U,j.bicubic));var W="M"+G.join("L")+"Z";!function(t,e,r,n,o,l){var c,u,f,h,p=s.ensureSingle(t,"g","contourbg").selectAll("path").data("fill"!==l||o?[]:[0]);p.enter().append("path"),p.exit().remove();var d=[];for(h=0;hm&&(n.max=m);n.len=n.max-n.min}(this,r,t,n,c,e.height),!(n.len<(e.width+e.height)*h.LABELMIN)))for(var i=Math.min(Math.ceil(n.len/P),h.LABELMAX),a=0;az){E("x scale is not linear");break}}if(m.length&&"fast"===S){var P=(m[m.length-1]-m[0])/(m.length-1),D=Math.abs(P/100);for(b=0;bD){E("y scale is not linear");break}}}var O=c(x),I="scaled"===e.xtype?"":r,R=p(e,I,d,g,O,w),B="scaled"===e.ytype?"":m,F=p(e,B,v,y,x.length,k);T||(a.expand(w,R),a.expand(k,F));var N={x:R,y:F,z:x,text:e._text||e.text};if(I&&I.length===R.length-1&&(N.xCenter=I),B&&B.length===F.length-1&&(N.yCenter=B),A&&(N.xRanges=_.xRanges,N.yRanges=_.yRanges,N.pts=_.pts),M&&"constraint"===e.contours.type||s(e,x,"","z"),M&&e.contours&&"heatmap"===e.contours.coloring){var j={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};N.xfill=p(j,I,d,g,O,w),N.yfill=p(j,B,v,y,x.length,k)}return[N]}},{"../../components/colorscale/calc":539,"../../lib":660,"../../plots/cartesian/axes":706,"../../registry":790,"../histogram2d/calc":931,"./clean_2d_array":901,"./convert_column_xyz":903,"./find_empties":905,"./interp2d":908,"./make_bound_array":909,"./max_row_length":910}],901:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){var r,i,a,o,s,l;function c(t){if(n(t))return+t}if(e){for(r=0,s=0;s=0;o--)(s=((f[[(r=(a=h[o])[0])-1,i=a[1]]]||g)[2]+(f[[r+1,i]]||g)[2]+(f[[r,i-1]]||g)[2]+(f[[r,i+1]]||g)[2])/20)&&(l[a]=[r,i,s],h.splice(o,1),c=!0);if(!c)throw"findEmpties iterated with no new neighbors";for(a in l)f[a]=l[a],u.push(l[a])}return u.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":910}],906:[function(t,e,r){"use strict";var n=t("../../components/fx"),i=t("../../lib"),a=t("../../plots/cartesian/axes");e.exports=function(t,e,r,o,s,l){var c,u,f,h,p=t.cd[0],d=p.trace,g=t.xa,m=t.ya,v=p.x,y=p.y,x=p.z,b=p.xCenter,_=p.yCenter,w=p.zmask,k=[d.zmin,d.zmax],M=d.zhoverformat,A=v,T=y;if(!1!==t.index){try{f=Math.round(t.index[1]),h=Math.round(t.index[0])}catch(e){return void i.error("Error hovering on heatmap, pointNumber must be [row,col], found:",t.index)}if(f<0||f>=x[0].length||h<0||h>x.length)return}else{if(n.inbox(e-v[0],e-v[v.length-1],0)>0||n.inbox(r-y[0],r-y[y.length-1],0)>0)return;if(l){var S;for(A=[2*v[0]-v[1]],S=1;Sg&&(v=Math.max(v,Math.abs(t[a][o]-d)/(m-g))))}return v}e.exports=function(t,e,r){var i,s,l=1;if(Array.isArray(r))for(i=0;i.01;i++)l=o(t,e,a(l));return l>.01&&n.log("interp2d didn't converge quickly",l),t}},{"../../lib":660}],909:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib").isArrayOrTypedArray;e.exports=function(t,e,r,a,o,s){var l,c,u,f=[],h=n.traceIs(t,"contour"),p=n.traceIs(t,"histogram"),d=n.traceIs(t,"gl2d");if(i(e)&&e.length>1&&!p&&"category"!==s.type){var g=e.length;if(!(g<=o))return h?e.slice(0,o):e.slice(0,o+1);if(h||d)f=e.slice(0,o);else if(1===o)f=[e[0]-.5,e[0]+.5];else{for(f=[1.5*e[0]-.5*e[1]],u=1;u0;)f=_.c2p(A[y]),y--;for(f0;)v=w.c2p(T[y]),y--;if(v image").each(function(t){var e=t.trace||{};a[e.uid]||n.select(this.parentNode).remove()});for(var o=0;o0&&(a=!0);for(var l=0;la){var o=a-r[t];return r[t]=a,o}}return 0},max:function(t,e,r,i){var a=i[e];if(n(a)){if(a=Number(a),!n(r[t]))return r[t]=a,a;if(r[t]c?t>o?t>1.1*i?i:t>1.1*a?a:o:t>s?s:t>l?l:c:Math.pow(10,Math.floor(Math.log(t)/Math.LN10))}function p(t,e,r,n,a,s){if(n&&t>o){var l=d(e,a,s),c=d(r,a,s),u=t===i?0:1;return l[u]!==c[u]}return Math.floor(r/t)-Math.floor(e/t)>.1}function d(t,e,r){var n=e.c2d(t,i,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}e.exports=function(t,e,r,n,a){var s,l,c=-1.1*e,h=-.1*e,p=t-h,d=r[0],g=r[1],m=Math.min(f(d+h,d+p,n,a),f(g+h,g+p,n,a)),v=Math.min(f(d+c,d+h,n,a),f(g+c,g+h,n,a));if(m>v&&vo){var y=s===i?1:6,x=s===i?"M12":"M1";return function(e,r){var o=n.c2d(e,i,a),s=o.indexOf("-",y);s>0&&(o=o.substr(0,s));var c=n.d2c(o,0,a);if(cu.size/1.9?u.size:u.size/Math.ceil(u.size/x);var A=u.start+(u.size-x)/2;b=A-x*Math.ceil((A-b)/x)}for(s=0;s=0&&w=0;n--)s(n);else if("increasing"===e){for(n=1;n=0;n--)t[n]+=t[n+1];"exclude"===r&&(t.push(0),t.shift())}}(d,x.direction,x.currentbin);var Z=Math.min(f.length,d.length),J=[],K=0,Q=Z-1;for(r=0;r=K;r--)if(d[r]){Q=r;break}for(r=K;r<=Q;r++)if(n(f[r])&&n(d[r])){var $={p:f[r],s:d[r],b:0};x.enabled||($.pts=z[r],H?$.p0=$.p1=z[r].length?A[z[r][0]]:f[r]:($.p0=U(S[r]),$.p1=U(S[r+1],!0))),J.push($)}return 1===J.length&&(J[0].width1=a.tickIncrement(J[0].p,M.size,!1,y)-J[0].p),o(J,e),i.isArrayOrTypedArray(e.selectedpoints)&&i.tagSelected(J,e,Y),J}}},{"../../constants/numerical":637,"../../lib":660,"../../plots/cartesian/axes":706,"../bar/arrays_to_calcdata":799,"./average":919,"./bin_functions":921,"./bin_label_vals":922,"./clean_bins":924,"./norm_functions":929,"fast-isnumeric":197}],924:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib").cleanDate,a=t("../../constants/numerical"),o=a.ONEDAY,s=a.BADNUM;e.exports=function(t,e,r){var a=e.type,l=r+"bins",c=t[l];c||(c=t[l]={});var u="date"===a?function(t){return t||0===t?i(t,s,c.calendar):null}:function(t){return n(t)?Number(t):null};c.start=u(c.start),c.end=u(c.end);var f="date"===a?o:1,h=c.size;if(n(h))c.size=h>0?Number(h):f;else if("string"!=typeof h)c.size=f;else{var p=h.charAt(0),d=h.substr(1);((d=n(d)?Number(d):0)<=0||"date"!==a||"M"!==p||d!==Math.round(d))&&(c.size=f)}var g="autobin"+r;"boolean"!=typeof t[g]&&(t[g]=t._fullInput[g]=t._input[g]=!((c.start||0===c.start)&&(c.end||0===c.end))),t[g]||(delete t["nbins"+r],delete t._fullInput["nbins"+r])}},{"../../constants/numerical":637,"../../lib":660,"fast-isnumeric":197}],925:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),s=t("../bar/style_defaults"),l=t("./attributes");e.exports=function(t,e,r,c){function u(r,n){return i.coerce(t,e,l,r,n)}var f=u("x"),h=u("y");u("cumulative.enabled")&&(u("cumulative.direction"),u("cumulative.currentbin")),u("text");var p=u("orientation",h&&!f?"h":"v"),d="v"===p?"x":"y",g="v"===p?"y":"x",m=f&&h?Math.min(f.length&&h.length):(e[d]||[]).length;if(m){e._length=m,n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],c),e[g]&&u("histfunc"),o(t,e,u,[d]),s(t,e,u,r,c);var v=n.getComponentMethod("errorbars","supplyDefaults");v(t,e,a.defaultLine,{axis:"y"}),v(t,e,a.defaultLine,{axis:"x",inherit:"y"}),i.coerceSelectionMarkerOpacity(e,u)}else e.visible=!1}},{"../../components/color":532,"../../lib":660,"../../registry":790,"../bar/style_defaults":812,"./attributes":918,"./bin_defaults":920}],926:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){if(t.x="xVal"in e?e.xVal:e.x,t.y="yVal"in e?e.yVal:e.y,e.xa&&(t.xaxis=e.xa),e.ya&&(t.yaxis=e.ya),!(r.cumulative||{}).enabled){var a,o=Array.isArray(i)?n[0].pts[i[0]][i[1]]:n[i].pts;if(t.pointNumbers=o,t.binNumber=t.pointNumber,delete t.pointNumber,delete t.pointIndex,r._indexToPoints){a=[];for(var s=0;sA&&m.splice(A,m.length-A),y.length>A&&y.splice(A,y.length-A),u(e,"x",m,g,_,k,x),u(e,"y",y,v,w,M,b);var T=[],S=[],C=[],E="string"==typeof e.xbins.size,L="string"==typeof e.ybins.size,z=[],P=[],D=E?z:e.xbins,O=L?P:e.ybins,I=0,R=[],B=[],F=e.histnorm,N=e.histfunc,j=-1!==F.indexOf("density"),V="max"===N||"min"===N?null:0,U=a.count,q=o[F],H=!1,G=[],W=[],Y="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";Y&&"count"!==N&&(H="avg"===N,U=a[N]);var X=e.xbins,Z=_(X.start),J=_(X.end)+(Z-i.tickIncrement(Z,X.size,!1,x))/1e6;for(r=Z;r=0&&c=0&&d0)c=a(t.alphahull,u);else{var p=["x","y","z"].indexOf(t.delaunayaxis);c=i(u.map(function(t){return[t[(p+1)%3],t[(p+2)%3]]}))}var d={positions:u,cells:c,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:l(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",d.vertexIntensity=t.intensity,d.vertexIntensityBounds=[t.cmin,t.cmax],d.colormap=s(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolor[0],d.vertexColors=f(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],d.cellColors=f(t.facecolor)):(this.color=t.color,d.meshColor=l(t.color)),this.mesh.update(d)},u.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=function(t,e){var r=t.glplot.gl,i=n({gl:r}),a=new c(t,i,e.uid);return i._trace=a,a.update(e),t.glplot.add(i),a}},{"../../lib/gl_format_color":656,"../../lib/str2rgbarray":683,"alpha-shape":49,"convex-hull":111,"delaunay-triangulate":133,"gl-mesh3d":249}],943:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/colorscale/defaults"),o=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,o,r,n)}function c(t){var e=t.map(function(t){var e=l(t);return e&&i.isArrayOrTypedArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=c(["x","y","z"]),f=c(["i","j","k"]);u?(f&&f.forEach(function(t){for(var e=0;ed):p=_>y,d=_;var w=s(y,x,b,_);w.pos=v,w.yc=(y+_)/2,w.i=m,w.dir=p?"increasing":"decreasing",h&&(w.tx=e.text[m]),g.push(w)}}return a.expand(n,u.concat(c),{padded:!0}),g.length&&(g[0].t={labels:{open:i(t,"open:")+" ",high:i(t,"high:")+" ",low:i(t,"low:")+" ",close:i(t,"close:")+" "}}),g}e.exports={calc:function(t,e){var r=a.getFromId(t,e.xaxis),i=a.getFromId(t,e.yaxis),o=function(t,e,r){var i=r._minDiff;if(!i){var a,o=t._fullData,s=[];for(i=1/0,a=0;a"),t.y0=t.y1=f.c2p(C.yc,!0),[t]}},{"../../components/color":532,"../../components/fx":574,"../../plots/cartesian/axes":706,"../scatter/fill_hover_text":998}],949:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc").calc,plot:t("./plot"),style:t("./style"),hoverPoints:t("./hover"),selectPoints:t("./select")}},{"../../plots/cartesian":717,"./attributes":945,"./calc":946,"./defaults":947,"./hover":948,"./plot":951,"./select":952,"./style":953}],950:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,i){var a=r("x"),o=r("open"),s=r("high"),l=r("low"),c=r("close");if(n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x"],i),o&&s&&l&&c){var u=Math.min(o.length,s.length,l.length,c.length);return a&&(u=Math.min(u,a.length)),e._length=u,u}}},{"../../registry":790}],951:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib");e.exports=function(t,e,r,a){var o=e.xaxis,s=e.yaxis,l=a.selectAll("g.trace").data(r,function(t){return t[0].trace.uid});l.enter().append("g").attr("class","trace ohlc"),l.exit().remove(),l.order(),l.each(function(t){var r=t[0],a=r.t,l=r.trace,c=n.select(this);if(e.isRangePlot||(r.node3=c),!0!==l.visible||a.empty)c.remove();else{var u=a.tickLen,f=c.selectAll("path").data(i.identity);f.enter().append("path"),f.exit().remove(),f.attr("d",function(t){var e=o.c2p(t.pos,!0),r=o.c2p(t.pos-u,!0),n=o.c2p(t.pos+u,!0);return"M"+r+","+s.c2p(t.o,!0)+"H"+e+"M"+e+","+s.c2p(t.h,!0)+"V"+s.c2p(t.l,!0)+"M"+n+","+s.c2p(t.c,!0)+"H"+e})}})}},{"../../lib":660,d3:131}],952:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n=t.cd,i=t.xaxis,a=t.yaxis,o=[],s=n[0].t.bPos||0;if(!1===e)for(r=0;r=0;a--){var o=t[a];if(e>f(n,o))return c(n,i);if(e>o||a===t.length-1)return c(o,n);i=n,n=o}}function d(t,e){for(var r=0;r=e[r][0]&&t<=e[r][1])return!0;return!1}function g(t){t.attr("x",-n.bar.captureWidth/2).attr("width",n.bar.captureWidth)}function m(t){t.attr("visibility","visible").style("visibility","visible").attr("fill","yellow").attr("opacity",0)}function v(t){if(!t.brush.filterSpecified)return"0,"+t.height;for(var e,r,n,i=y(t.brush.filter.getConsolidated(),t.height),a=[0],o=i.length?i[0][0]:null,s=0;se){h=r;break}}if(a=u,isNaN(a)&&(a=isNaN(f)||isNaN(h)?isNaN(f)?h:f:e-c[f][1]t[1]+r||e=.9*t[1]+.1*t[0]?"n":e<=.9*t[0]+.1*t[1]?"s":"ns"}(d,e);g&&(o.interval=l[a],o.intervalPix=d,o.region=g)}}if(t.ordinal&&!o.region){var m=t.unitTickvals,v=t.unitToPaddedPx.invert(e);for(r=0;r=x[0]&&v<=x[1]){o.clickableOrdinalRange=x;break}}}return o}function k(t){t.on("mousemove",function(t){if(i.event.preventDefault(),!t.parent.inBrushDrag){var e=w(t,t.height-i.mouse(this)[1]-2*n.verticalPadding),r="crosshair";e.clickableOrdinalRange?r="pointer":e.region&&(r=e.region+"-resize"),i.select(document.body).style("cursor",r)}}).on("mouseleave",function(t){t.parent.inBrushDrag||x()}).call(i.behavior.drag().on("dragstart",function(t){i.event.sourceEvent.stopPropagation();var e=t.height-i.mouse(this)[1]-2*n.verticalPadding,r=t.unitToPaddedPx.invert(e),a=t.brush,o=w(t,e),s=o.interval,l=a.svgBrush;if(l.wasDragged=!1,l.grabbingBar="ns"===o.region,l.grabbingBar){var c=s.map(t.unitToPaddedPx);l.grabPoint=e-c[0]-n.verticalPadding,l.barLength=c[1]-c[0]}l.clickableOrdinalRange=o.clickableOrdinalRange,l.stayingIntervals=t.multiselect&&a.filterSpecified?a.filter.getConsolidated():[],s&&(l.stayingIntervals=l.stayingIntervals.filter(function(t){return t[0]!==s[0]&&t[1]!==s[1]})),l.startExtent=o.region?s["s"===o.region?1:0]:r,t.parent.inBrushDrag=!0,l.brushStartCallback()}).on("drag",function(t){i.event.sourceEvent.stopPropagation();var e=t.height-i.mouse(this)[1]-2*n.verticalPadding,r=t.brush.svgBrush;r.wasDragged=!0,r.grabbingBar?r.newExtent=[e-r.grabPoint,e+r.barLength-r.grabPoint].map(t.unitToPaddedPx.invert):r.newExtent=[r.startExtent,t.unitToPaddedPx.invert(e)].sort(s);var a=Math.max(0,-r.newExtent[0]),o=Math.max(0,r.newExtent[1]-1);r.newExtent[0]+=a,r.newExtent[1]-=o,r.grabbingBar&&(r.newExtent[1]+=a,r.newExtent[0]-=o),t.brush.filterSpecified=!0,r.extent=r.stayingIntervals.concat([r.newExtent]),r.brushCallback(t),_(this.parentNode)}).on("dragend",function(t){i.event.sourceEvent.stopPropagation();var e=t.brush,r=e.filter,n=e.svgBrush,a=n.grabbingBar;if(n.grabbingBar=!1,n.grabLocation=void 0,t.parent.inBrushDrag=!1,x(),!n.wasDragged)return n.wasDragged=void 0,n.clickableOrdinalRange?e.filterSpecified&&t.multiselect?n.extent.push(n.clickableOrdinalRange):(n.extent=[n.clickableOrdinalRange],e.filterSpecified=!0):a?(n.extent=n.stayingIntervals,0===n.extent.length&&A(e)):A(e),n.brushCallback(t),_(this.parentNode),void n.brushEndCallback(e.filterSpecified?r.getConsolidated():[]);var o=function(){r.set(r.getConsolidated())};if(t.ordinal){var s=t.unitTickvals;s[s.length-1]n.newExtent[0];n.extent=n.stayingIntervals.concat(l?[n.newExtent]:[]),n.extent.length||A(e),n.brushCallback(t),l?_(this.parentNode,o):(o(),_(this.parentNode))}else o();n.brushEndCallback(e.filterSpecified?r.getConsolidated():[])}))}function M(t,e){return t[0]-e[0]}function A(t){t.filterSpecified=!1,t.svgBrush.extent=[[0,1]]}function T(t){for(var e,r=t.slice(),n=[],i=r.shift();i;){for(e=i.slice();(i=r.shift())&&i[0]<=e[1];)e[1]=Math.max(e[1],i[1]);n.push(e)}return n}e.exports={makeBrush:function(t,e,r,n,i,a){var o,l=function(){var t,e,r=[];return{set:function(n){r=n.map(function(t){return t.slice().sort(s)}).sort(M),t=T(r),e=r.reduce(function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]},[1/0,-1/0])},get:function(){return r.slice()},getConsolidated:function(){return t},getBounds:function(){return e}}}();return l.set(r),{filter:l,filterSpecified:e,svgBrush:{extent:[],brushStartCallback:n,brushCallback:(o=i,function(t){var e=t.brush,r=function(t){return t.svgBrush.extent.map(function(t){return t.slice()})}(e).slice();e.filter.set(r),o()}),brushEndCallback:a}}},ensureAxisBrush:function(t){var e=t.selectAll("."+n.cn.axisBrush).data(o,a);e.enter().append("g").classed(n.cn.axisBrush,!0),function(t){var e=t.selectAll(".background").data(o);e.enter().append("rect").classed("background",!0).call(g).call(m).style("pointer-events","auto").attr("transform","translate(0 "+n.verticalPadding+")"),e.call(k).attr("height",function(t){return t.height-n.verticalPadding});var r=t.selectAll(".highlight-shadow").data(o);r.enter().append("line").classed("highlight-shadow",!0).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width+n.bar.strokeWidth).attr("stroke",n.bar.strokeColor).attr("opacity",n.bar.strokeOpacity).attr("stroke-linecap","butt"),r.attr("y1",function(t){return t.height}).call(b);var i=t.selectAll(".highlight").data(o);i.enter().append("line").classed("highlight",!0).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width-n.bar.strokeWidth).attr("stroke",n.bar.fillColor).attr("opacity",n.bar.fillOpacity).attr("stroke-linecap","butt"),i.attr("y1",function(t){return t.height}).call(b)}(e)},cleanRanges:function(t,e){if(Array.isArray(t[0])?(t=t.map(function(t){return t.sort(s)}),t=e.multiselect?T(t.sort(M)):[t[0]]):t=[t.sort(s)],e.tickvals){var r=e.tickvals.slice().sort(s);if(!(t=t.map(function(t){var e=[h(r,t[0],[]),p(r,t[1],[])];if(e[1]>e[0])return e}).filter(function(t){return t})).length)return}return t.length>1?t:t[0]}}},{"../../lib":660,"../../lib/gup":657,"./constants":959,d3:131}],956:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plots/get_data").getModuleCalcData,a=t("./plot"),o=t("../../constants/xmlns_namespaces");r.name="parcoords",r.plot=function(t){var e=i(t.calcdata,"parcoords")[0];e.length&&a(t,e)},r.clean=function(t,e,r,n){var i=n._has&&n._has("parcoords"),a=e._has&&e._has("parcoords");i&&!a&&(n._paperdiv.selectAll(".parcoords").remove(),n._glimages.selectAll("*").remove())},r.toSVG=function(t){var e=t._fullLayout._glimages,r=n.select(t).selectAll(".svg-container");r.filter(function(t,e){return e===r.size()-1}).selectAll(".gl-canvas-context, .gl-canvas-focus").each(function(){var t=this.toDataURL("image/png");e.append("svg:image").attr({xmlns:o.svg,"xlink:href":t,preserveAspectRatio:"none",x:0,y:0,width:this.width,height:this.height})}),window.setTimeout(function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)}},{"../../constants/xmlns_namespaces":639,"../../plots/get_data":742,"./plot":964,d3:131}],957:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("../../lib"),o=t("../../lib/gup").wrap;e.exports=function(t,e){var r=!!e.line.colorscale&&a.isArrayOrTypedArray(e.line.color),s=r?e.line.color:function(t){for(var e=new Array(t),r=0;rs&&(n.log("parcoords traces support up to "+s+" dimensions at the moment"),l.splice(s)),o=0;o>>8*e)%256/255}function M(t,e,r){var n,i,a,o=[];for(i=0;i=h-4?k(o,h-2-s):.5);return a}(d,p,i);!function(t,e,r){for(var n=0;n<16;n++)t["p"+n.toString(16)](M(e,r,n))}(E,d,o),L=S.texture(l.extendFlat({data:function(t,e,r){for(var n=[],i=0;i<256;i++){var a=t(i/255);n.push((e?v:a).concat(r))}return n}(r.unitToColor,A,Math.round(255*(A?a:1)))},b))}var D=[0,1];var O=[];function I(t,e,n,i,a,o,s,c,u,f,h){var p,d,g,m,v=[t,e],y=[0,1].map(function(){return[0,1,2,3].map(function(){return new Float32Array(16)})});for(p=0;p<2;p++)for(m=v[p],d=0;d<4;d++)for(g=0;g<16;g++)y[p][d][g]=g+16*d===m?1:0;var x=r.lines.canvasOverdrag,b=r.domain,_=r.canvasWidth,w=r.canvasHeight;return l.extendFlat({key:s,resolution:[_,w],viewBoxPosition:[n+x,i],viewBoxSize:[a,o],i:t,ii:e,dim1A:y[0][0],dim1B:y[0][1],dim1C:y[0][2],dim1D:y[0][3],dim2A:y[1][0],dim2B:y[1][1],dim2C:y[1][2],dim2D:y[1][3],colorClamp:D,scissorX:(c===u?0:n+x)+(r.pad.l-x)+r.layoutWidth*b.x[0],scissorWidth:(c===f?_-n+x:a+.5)+(c===u?n+x:0),scissorY:i+r.pad.b+r.layoutHeight*b.y[0],scissorHeight:o,viewportX:r.pad.l-x+r.layoutWidth*b.x[0],viewportY:r.pad.b+r.layoutHeight*b.y[0],viewportWidth:_,viewportHeight:w},h)}return{setColorDomain:function(t){D[0]=t[0],D[1]=t[1]},render:function(t,e,n){var i,a,o,s=t.length,l=1/0,c=-1/0;for(i=0;ic&&(c=t[i].dim2.canvasX,o=i),t[i].dim1.canvasXn._length&&(M=M.slice(0,n._length));var A,T=n.tickvals;function S(t,e){return{val:t,text:A[e]}}function C(t,e){return t.val-e.val}if(Array.isArray(T)&&T.length){A=n.ticktext,Array.isArray(A)&&A.length?A.length>T.length?A=A.slice(0,T.length):T.length>A.length&&(T=T.slice(0,A.length)):A=T.map(o.format(n.tickformat));for(var E=1;E=r||s>=n)return;var l=t.lineLayer.readPixel(a,n-1-s),c=0!==l[3],u=c?l[2]+256*(l[1]+256*l[0]):null,f={x:a,y:s,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:u};u!==M&&(c?d.hover(f):d.unhover&&d.unhover(f),M=u)}}),k.style("opacity",function(t){return t.pick?.01:1}),e.style("background","rgba(255, 255, 255, 0)");var A=e.selectAll("."+i.cn.parcoords).data(w,c);A.exit().remove(),A.enter().append("g").classed(i.cn.parcoords,!0).style("shape-rendering","crispEdges").style("pointer-events","none"),A.attr("transform",function(t){return"translate("+t.model.translateX+","+t.model.translateY+")"});var T=A.selectAll("."+i.cn.parcoordsControlView).data(u,c);T.enter().append("g").classed(i.cn.parcoordsControlView,!0),T.attr("transform",function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"});var S=T.selectAll("."+i.cn.yAxis).data(function(t){return t.dimensions},c);function C(t,e){for(var r=e.panels||(e.panels=[]),n=t.data(),i=n.length-1,a=0;aline").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),L.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default").style("user-select","none");var z=E.selectAll("."+i.cn.axisHeading).data(u,c);z.enter().append("g").classed(i.cn.axisHeading,!0);var P=z.selectAll("."+i.cn.axisTitle).data(u,c);P.enter().append("text").classed(i.cn.axisTitle,!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),P.attr("transform","translate(0,"+-i.axisTitleOffset+")").text(function(t){return t.label}).each(function(t){s.font(o.select(this),t.model.labelFont)});var D=E.selectAll("."+i.cn.axisExtent).data(u,c);D.enter().append("g").classed(i.cn.axisExtent,!0);var O=D.selectAll("."+i.cn.axisExtentTop).data(u,c);O.enter().append("g").classed(i.cn.axisExtentTop,!0),O.attr("transform","translate(0,"+-i.axisExtentOffset+")");var I=O.selectAll("."+i.cn.axisExtentTopText).data(u,c);function R(t,e){if(t.ordinal)return"";var r=t.domainScale.domain();return o.format(t.tickFormat)(r[e?r.length-1:0])}I.enter().append("text").classed(i.cn.axisExtentTopText,!0).call(y),I.text(function(t){return R(t,!0)}).each(function(t){s.font(o.select(this),t.model.rangeFont)});var B=D.selectAll("."+i.cn.axisExtentBottom).data(u,c);B.enter().append("g").classed(i.cn.axisExtentBottom,!0),B.attr("transform",function(t){return"translate(0,"+(t.model.height+i.axisExtentOffset)+")"});var F=B.selectAll("."+i.cn.axisExtentBottomText).data(u,c);F.enter().append("text").classed(i.cn.axisExtentBottomText,!0).attr("dy","0.75em").call(y),F.text(function(t){return R(t)}).each(function(t){s.font(o.select(this),t.model.rangeFont)}),h.ensureAxisBrush(E)}},{"../../components/drawing":557,"../../lib":660,"../../lib/gup":657,"./axisbrush":955,"./constants":959,"./lines":962,d3:131}],964:[function(t,e,r){"use strict";var n=t("./parcoords"),i=t("../../lib/prepare_regl");e.exports=function(t,e){var r=t._fullLayout,a=r._toppaper,o=r._paperdiv,s=r._glcontainer;i(t);var l={},c={},u=r._size;e.forEach(function(e,r){l[r]=t.data[r].dimensions,c[r]=t.data[r].dimensions.slice()});n(o,a,s,e,{width:u.w,height:u.h,margin:{t:u.t,r:u.r,b:u.b,l:u.l}},{filterChanged:function(e,r,n){var i=c[e][r],a=n.map(function(t){return t.slice()});a.length?(1===a.length&&(a=a[0]),i.constraintrange=a,a=[a]):(delete i.constraintrange,a=null);var o={};o["dimensions["+r+"].constraintrange"]=a,t.emit("plotly_restyle",[o,[e]])},hover:function(e){t.emit("plotly_hover",e)},unhover:function(e){t.emit("plotly_unhover",e)},axesMoved:function(e,r){function n(t){return!("visible"in t)||t.visible}function i(t,e,r){var n=e.indexOf(r),i=t.indexOf(n);return-1===i&&(i+=e.length),i}var a=function(t){return function(e,n){return i(r,t,e)-i(r,t,n)}}(c[e].filter(n));l[e].sort(a),c[e].filter(function(t){return!n(t)}).sort(function(t){return c[e].indexOf(t)}).forEach(function(t){l[e].splice(l[e].indexOf(t),1),l[e].splice(c[e].indexOf(t),0,t)}),t.emit("plotly_restyle")}})}},{"../../lib/prepare_regl":673,"./parcoords":963}],965:[function(t,e,r){"use strict";var n=t("../../components/color/attributes"),i=t("../../plots/font_attributes"),a=t("../../plots/attributes"),o=t("../../plots/domain").attributes,s=t("../../lib/extend").extendFlat,l=i({editType:"calc",colorEditType:"style"});e.exports={labels:{valType:"data_array",editType:"calc"},label0:{valType:"number",dflt:0,editType:"calc"},dlabel:{valType:"number",dflt:1,editType:"calc"},values:{valType:"data_array",editType:"calc"},marker:{colors:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:n.defaultLine,arrayOk:!0,editType:"style"},width:{valType:"number",min:0,dflt:0,arrayOk:!0,editType:"style"},editType:"calc"},editType:"calc"},text:{valType:"data_array",editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"style"},scalegroup:{valType:"string",dflt:"",editType:"calc"},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"],editType:"calc"},hoverinfo:s({},a.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0,editType:"calc"},textfont:s({},l,{}),insidetextfont:s({},l,{}),outsidetextfont:s({},l,{}),domain:o({name:"pie",trace:!0,editType:"calc"}),hole:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},sort:{valType:"boolean",dflt:!0,editType:"calc"},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise",editType:"calc"},rotation:{valType:"number",min:-360,max:360,dflt:0,editType:"calc"},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0,editType:"calc"}}},{"../../components/color/attributes":531,"../../lib/extend":649,"../../plots/attributes":703,"../../plots/domain":731,"../../plots/font_attributes":732}],966:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../plots/get_data").getModuleCalcData;r.name="pie",r.plot=function(t){var e=n.getModule("pie"),r=i(t.calcdata,e)[0];r.length&&e.plot(t,r)},r.clean=function(t,e,r,n){var i=n._has&&n._has("pie"),a=e._has&&e._has("pie");i&&!a&&n._pielayer.selectAll("g.trace").remove()}},{"../../plots/get_data":742,"../../registry":790}],967:[function(t,e,r){"use strict";var n,i=t("fast-isnumeric"),a=t("../../lib").isArrayOrTypedArray,o=t("tinycolor2"),s=t("../../components/color"),l=t("./helpers");function c(t,e){if(!n){var r=s.defaults;n=u(r)}var i=e||n;return i[t%i.length]}function u(t){var e,r=t.slice();for(e=0;e")}}return y}},{"../../components/color":532,"../../lib":660,"./helpers":970,"fast-isnumeric":197,tinycolor2:473}],968:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../plots/domain").defaults;e.exports=function(t,e,r,o){function s(r,a){return n.coerce(t,e,i,r,a)}var l,c=n.coerceFont,u=s("values"),f=n.isArrayOrTypedArray(u),h=s("labels");if(Array.isArray(h)&&(l=h.length,f&&(l=Math.min(l,u.length))),!Array.isArray(h)){if(!f)return void(e.visible=!1);l=u.length,s("label0"),s("dlabel")}if(l){e._length=l,s("marker.line.width")&&s("marker.line.color"),s("marker.colors"),s("scalegroup");var p=s("text"),d=s("textinfo",Array.isArray(p)?"text+percent":"percent");if(s("hovertext"),d&&"none"!==d){var g=s("textposition"),m=Array.isArray(g)||"auto"===g,v=m||"inside"===g,y=m||"outside"===g;if(v||y){var x=c(s,"textfont",o.font);v&&c(s,"insidetextfont",x),y&&c(s,"outsidetextfont",x)}}a(e,o,s),s("hole"),s("sort"),s("direction"),s("rotation"),s("pull")}else e.visible=!1}},{"../../lib":660,"../../plots/domain":731,"./attributes":965}],969:[function(t,e,r){"use strict";var n=t("../../components/fx/helpers").appendArrayMultiPointValues;e.exports=function(t,e){var r={curveNumber:e.index,pointNumbers:t.pts,data:e._input,fullData:e,label:t.label,color:t.color,value:t.v,v:t.v};return 1===t.pts.length&&(r.pointNumber=r.i=t.pts[0]),n(r,e,t.pts),r}},{"../../components/fx/helpers":571}],970:[function(t,e,r){"use strict";var n=t("../../lib");r.formatPiePercent=function(t,e){var r=(100*t).toPrecision(3);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)+"%"},r.formatPieValue=function(t,e){var r=t.toPrecision(10);return-1!==r.lastIndexOf(".")&&(r=r.replace(/[.]?0+$/,"")),n.numSeparate(r,e)},r.getFirstFilled=function(t,e){if(Array.isArray(t))for(var r=0;r0?1:-1)/2,y:a/(1+r*r/(n*n)),outside:!0}}e.exports=function(t,e){var r=t._fullLayout;!function(t,e){var r,n,i,a,o,s,l,c,u,f=[];for(i=0;il&&(l=s.pull[a]);o.r=Math.min(r,n)/(2+2*l),o.cx=e.l+e.w*(s.domain.x[1]+s.domain.x[0])/2,o.cy=e.t+e.h*(2-s.domain.y[1]-s.domain.y[0])/2,s.scalegroup&&-1===f.indexOf(s.scalegroup)&&f.push(s.scalegroup)}for(a=0;ai.vTotal/2?1:0)}(e),p.each(function(){var p=n.select(this).selectAll("g.slice").data(e);p.enter().append("g").classed("slice",!0),p.exit().remove();var m=[[[],[]],[[],[]]],v=!1;p.each(function(e){if(e.hidden)n.select(this).selectAll("path,g").remove();else{e.pointNumber=e.i,e.curveNumber=g.index,m[e.pxmid[1]<0?0:1][e.pxmid[0]<0?0:1].push(e);var a=d.cx,p=d.cy,y=n.select(this),x=y.selectAll("path.surface").data([e]),b=!1,_=!1;if(x.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),y.select("path.textline").remove(),y.on("mouseover",function(){var o=t._fullLayout,s=t._fullData[g.index];if(!t._dragging&&!1!==o.hovermode){var l=s.hoverinfo;if(Array.isArray(l)&&(l=i.castHoverinfo({hoverinfo:[c.castOption(l,e.pts)],_module:g._module},o,0)),"all"===l&&(l="label+text+value+percent+name"),"none"!==l&&"skip"!==l&&l){var h=f(e,d),m=a+e.pxmid[0]*(1-h),v=p+e.pxmid[1]*(1-h),y=r.separators,x=[];if(-1!==l.indexOf("label")&&x.push(e.label),-1!==l.indexOf("text")){var w=c.castOption(s.hovertext||s.text,e.pts);w&&x.push(w)}-1!==l.indexOf("value")&&x.push(c.formatPieValue(e.v,y)),-1!==l.indexOf("percent")&&x.push(c.formatPiePercent(e.v/d.vTotal,y));var k=g.hoverlabel,M=k.font;i.loneHover({x0:m-h*d.r,x1:m+h*d.r,y:v,text:x.join("
"),name:-1!==l.indexOf("name")?s.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:c.castOption(k.bgcolor,e.pts)||e.color,borderColor:c.castOption(k.bordercolor,e.pts),fontFamily:c.castOption(M.family,e.pts),fontSize:c.castOption(M.size,e.pts),fontColor:c.castOption(M.color,e.pts)},{container:o._hoverlayer.node(),outerContainer:o._paper.node(),gd:t}),b=!0}t.emit("plotly_hover",{points:[u(e,s)],event:n.event}),_=!0}}).on("mouseout",function(r){var a=t._fullLayout,o=t._fullData[g.index];_&&(r.originalEvent=n.event,t.emit("plotly_unhover",{points:[u(e,o)],event:n.event}),_=!1),b&&(i.loneUnhover(a._hoverlayer.node()),b=!1)}).on("click",function(){var r=t._fullLayout,a=t._fullData[g.index];t._dragging||!1===r.hovermode||(t._hoverdata=[u(e,a)],i.click(t,n.event))}),g.pull){var w=+c.castOption(g.pull,e.pts)||0;w>0&&(a+=w*e.pxmid[0],p+=w*e.pxmid[1])}e.cxFinal=a,e.cyFinal=p;var k=g.hole;if(e.v===d.vTotal){var M="M"+(a+e.px0[0])+","+(p+e.px0[1])+E(e.px0,e.pxmid,!0,1)+E(e.pxmid,e.px0,!0,1)+"Z";k?x.attr("d","M"+(a+k*e.px0[0])+","+(p+k*e.px0[1])+E(e.px0,e.pxmid,!1,k)+E(e.pxmid,e.px0,!1,k)+"Z"+M):x.attr("d",M)}else{var A=E(e.px0,e.px1,!0,1);if(k){var T=1-k;x.attr("d","M"+(a+k*e.px1[0])+","+(p+k*e.px1[1])+E(e.px1,e.px0,!1,k)+"l"+T*e.px0[0]+","+T*e.px0[1]+A+"Z")}else x.attr("d","M"+a+","+p+"l"+e.px0[0]+","+e.px0[1]+A+"Z")}var S=c.castOption(g.textposition,e.pts),C=y.selectAll("g.slicetext").data(e.text&&"none"!==S?[0]:[]);C.enter().append("g").classed("slicetext",!0),C.exit().remove(),C.each(function(){var r=s.ensureSingle(n.select(this),"text","",function(t){t.attr("data-notex",1)});r.text(e.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(o.font,"outside"===S?g.outsidetextfont:g.insidetextfont).call(l.convertToTspans,t);var i,c=o.bBox(r.node());"outside"===S?i=h(c,e):(i=function(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),i=t.width/t.height,a=Math.PI*Math.min(e.v/r.vTotal,.5),o=1-r.trace.hole,s=f(e,r),l={scale:s*r.r*2/n,rCenter:1-s,rotate:0};if(l.scale>=1)return l;var c=i+1/(2*Math.tan(a)),u=r.r*Math.min(1/(Math.sqrt(c*c+.5)+c),o/(Math.sqrt(i*i+o/2)+i)),h={scale:2*u/t.height,rCenter:Math.cos(u/r.r)-u*i/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},p=1/i,d=p+1/(2*Math.tan(a)),g=r.r*Math.min(1/(Math.sqrt(d*d+.5)+d),o/(Math.sqrt(p*p+o/2)+p)),m={scale:2*g/t.width,rCenter:Math.cos(g/r.r)-g/i/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=m.scale>h.scale?m:h;return l.scale<1&&v.scale>l.scale?v:l}(c,e,d),"auto"===S&&i.scale<1&&(r.call(o.font,g.outsidetextfont),g.outsidetextfont.family===g.insidetextfont.family&&g.outsidetextfont.size===g.insidetextfont.size||(c=o.bBox(r.node())),i=h(c,e)));var u=a+e.pxmid[0]*i.rCenter+(i.x||0),m=p+e.pxmid[1]*i.rCenter+(i.y||0);i.outside&&(e.yLabelMin=m-c.height/2,e.yLabelMid=m,e.yLabelMax=m+c.height/2,e.labelExtraX=0,e.labelExtraY=0,v=!0),r.attr("transform","translate("+u+","+m+")"+(i.scale<1?"scale("+i.scale+")":"")+(i.rotate?"rotate("+i.rotate+")":"")+"translate("+-(c.left+c.right)/2+","+-(c.top+c.bottom)/2+")")})}function E(t,r,n,i){return"a"+i*d.r+","+i*d.r+" 0 "+e.largeArc+(n?" 1 ":" 0 ")+i*(r[0]-t[0])+","+i*(r[1]-t[1])}}),v&&function(t,e){var r,n,i,a,o,s,l,u,f,h,p,d,g;function m(t,e){return t.pxmid[1]-e.pxmid[1]}function v(t,e){return e.pxmid[1]-t.pxmid[1]}function y(t,r){r||(r={});var i,u,f,p,d,g,m=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),v=n?t.yLabelMin:t.yLabelMax,y=n?t.yLabelMax:t.yLabelMin,x=t.cyFinal+o(t.px0[1],t.px1[1]),b=m-v;if(b*l>0&&(t.labelExtraY=b),Array.isArray(e.pull))for(u=0;u=(c.castOption(e.pull,f.pts)||0)||((t.pxmid[1]-f.pxmid[1])*l>0?(p=f.cyFinal+o(f.px0[1],f.px1[1]),(b=p-v-t.labelExtraY)*l>0&&(t.labelExtraY+=b)):(y+t.labelExtraY-x)*l>0&&(i=3*s*Math.abs(u-h.indexOf(t)),d=f.cxFinal+a(f.px0[0],f.px1[0]),(g=d+i-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*s>0&&(t.labelExtraX+=g)))}for(n=0;n<2;n++)for(i=n?m:v,o=n?Math.max:Math.min,l=n?1:-1,r=0;r<2;r++){for(a=r?Math.max:Math.min,s=r?1:-1,(u=t[n][r]).sort(i),f=t[1-n][r],h=f.concat(u),d=[],p=0;pMath.abs(c)?o+="l"+c*t.pxmid[0]/t.pxmid[1]+","+c+"H"+(i+t.labelExtraX+s):o+="l"+t.labelExtraX+","+l+"v"+(c-l)+"h"+s}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+s;e.append("path").classed("textline",!0).call(a.stroke,g.outsidetextfont.color).attr({"stroke-width":Math.min(2,g.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){p.selectAll("tspan").each(function(){var t=n.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":532,"../../components/drawing":557,"../../components/fx":574,"../../lib":660,"../../lib/svg_text_utils":684,"./event_data":969,"./helpers":970,d3:131}],975:[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].trace,r=n.select(this);r.style({opacity:e.opacity}),r.selectAll("path.surface").each(function(t){n.select(this).call(i,t,e)})})}},{"./style_one":976,d3:131}],976:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("./helpers").castOption;e.exports=function(t,e,r){var a=r.marker.line,o=i(a.color,e.pts)||n.defaultLine,s=i(a.width,e.pts)||0;t.style({"stroke-width":s}).call(n.fill,e.color).call(n.stroke,o)}},{"../../components/color":532,"./helpers":970}],977:[function(t,e,r){"use strict";var n=t("../scatter/attributes");e.exports={x:n.x,y:n.y,xy:{valType:"data_array",editType:"calc"},indices:{valType:"data_array",editType:"calc"},xbounds:{valType:"data_array",editType:"calc"},ybounds:{valType:"data_array",editType:"calc"},text:n.text,marker:{color:{valType:"color",arrayOk:!1,editType:"calc"},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:!1,editType:"calc"},blend:{valType:"boolean",dflt:null,editType:"calc"},sizemin:{valType:"number",min:.1,max:2,dflt:.5,editType:"calc"},sizemax:{valType:"number",min:.1,dflt:20,editType:"calc"},border:{color:{valType:"color",arrayOk:!1,editType:"calc"},arearatio:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},editType:"calc"},editType:"calc"}}},{"../scatter/attributes":990}],978:[function(t,e,r){"use strict";var n=t("gl-pointcloud2d"),i=t("../../lib/str2rgbarray"),a=t("../../plots/cartesian/autorange").expand,o=t("../scatter/get_trace_color");function s(t,e){this.scene=t,this.uid=e,this.type="pointcloud",this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.idToIndex=new Int32Array(0),this.bounds=[0,0,0,0],this.pointcloudOptions={positions:new Float32Array(0),idToIndex:this.idToIndex,sizemin:.5,sizemax:12,color:[0,0,0,1],areaRatio:1,borderColor:[0,0,0,1]},this.pointcloud=n(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}var l=s.prototype;l.handlePick=function(t){var e=this.idToIndex[t.pointId];return{trace:this,dataCoord:t.dataCoord,traceCoord:this.pickXYData?[this.pickXYData[2*e],this.pickXYData[2*e+1]]:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:this.color,name:this.name,pointIndex:e,hoverinfo:this.hoverinfo}},l.update=function(t){this.index=t.index,this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-1/0,-1/0],this.updateFast(t),this.color=o(t,{})},l.updateFast=function(t){var e,r,n,a,o,s,l=this.xData=this.pickXData=t.x,c=this.yData=this.pickYData=t.y,u=this.pickXYData=t.xy,f=t.xbounds&&t.ybounds,h=t.indices,p=this.bounds;if(u){if(n=u,e=u.length>>>1,f)p[0]=t.xbounds[0],p[2]=t.xbounds[1],p[1]=t.ybounds[0],p[3]=t.ybounds[1];else for(s=0;sp[2]&&(p[2]=a),op[3]&&(p[3]=o);if(h)r=h;else for(r=new Int32Array(e),s=0;sp[2]&&(p[2]=a),op[3]&&(p[3]=o);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var d=i(t.marker.color),g=i(t.marker.border.color),m=t.opacity*t.marker.opacity;d[3]*=m,this.pointcloudOptions.color=d;var v=t.marker.blend;if(null===v){v=l.length<100||c.length<100}this.pointcloudOptions.blend=v,g[3]*=m,this.pointcloudOptions.borderColor=g;var y=t.marker.sizemin,x=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=y,this.pointcloudOptions.sizeMax=x,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions),this.expandAxesFast(p,x/2)},l.expandAxesFast=function(t,e){var r=e||.5;a(this.scene.xaxis,[t[0],t[2]],{ppad:r}),a(this.scene.yaxis,[t[1],t[3]],{ppad:r})},l.dispose=function(){this.pointcloud.dispose()},e.exports=function(t,e){var r=new s(t,e.uid);return r.update(e),r}},{"../../lib/str2rgbarray":683,"../../plots/cartesian/autorange":705,"../scatter/get_trace_color":1e3,"gl-pointcloud2d":260}],979:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r){function a(r,a){return n.coerce(t,e,i,r,a)}a("x"),a("y"),a("xbounds"),a("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),a("text"),a("marker.color",r),a("marker.opacity"),a("marker.blend"),a("marker.sizemin"),a("marker.sizemax"),a("marker.border.color",r),a("marker.border.arearatio"),e._length=null}},{"../../lib":660,"./attributes":977}],980:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../scatter3d/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="pointcloud",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl","gl2d","showLegend"],n.meta={},e.exports=n},{"../../plots/gl2d":745,"../scatter3d/calc":1016,"./attributes":977,"./convert":978,"./defaults":979}],981:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/attributes"),a=t("../../components/color/attributes"),o=t("../../components/fx/attributes"),s=t("../../plots/domain").attributes,l=t("../../lib/extend").extendFlat,c=t("../../plot_api/edit_types").overrideAll;e.exports=c({hoverinfo:l({},i.hoverinfo,{flags:["label","text","value","percent","name"]}),hoverlabel:o.hoverlabel,domain:s({name:"sankey",trace:!0}),orientation:{valType:"enumerated",values:["v","h"],dflt:"h"},valueformat:{valType:"string",dflt:".3s"},valuesuffix:{valType:"string",dflt:""},arrangement:{valType:"enumerated",values:["snap","perpendicular","freeform","fixed"],dflt:"snap"},textfont:n({}),node:{label:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},line:{color:{valType:"color",dflt:a.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:.5,arrayOk:!0}},pad:{valType:"number",arrayOk:!1,min:0,dflt:20},thickness:{valType:"number",arrayOk:!1,min:1,dflt:20}},link:{label:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},line:{color:{valType:"color",dflt:a.defaultLine,arrayOk:!0},width:{valType:"number",min:0,dflt:0,arrayOk:!0}},source:{valType:"data_array",dflt:[]},target:{valType:"data_array",dflt:[]},value:{valType:"data_array",dflt:[]}}},"calc","nested")},{"../../components/color/attributes":531,"../../components/fx/attributes":566,"../../lib/extend":649,"../../plot_api/edit_types":691,"../../plots/attributes":703,"../../plots/domain":731,"../../plots/font_attributes":732}],982:[function(t,e,r){"use strict";var n=t("../../plot_api/edit_types").overrideAll,i=t("../../plots/get_data").getModuleCalcData,a=t("./plot"),o=t("../../components/fx/layout_attributes");r.name="sankey",r.baseLayoutAttrOverrides=n({hoverlabel:o.hoverlabel},"plot","nested"),r.plot=function(t){var e=i(t.calcdata,"sankey")[0];a(t,e)},r.clean=function(t,e,r,n){var i=n._has&&n._has("sankey"),a=e._has&&e._has("sankey");i&&!a&&n._paperdiv.selectAll(".sankey").remove()}},{"../../components/fx/layout_attributes":575,"../../plot_api/edit_types":691,"../../plots/get_data":742,"./plot":987}],983:[function(t,e,r){"use strict";var n=t("strongly-connected-components"),i=t("../../lib"),a=t("../../lib/gup").wrap;e.exports=function(t,e){return function(t,e,r){for(var a=t.length,o=i.init2dArray(a,0),s=0;s1})}(e.node.label,e.link.source,e.link.target)&&(i.error("Circularity is present in the Sankey data. Removing all nodes and links."),e.link.label=[],e.link.source=[],e.link.target=[],e.link.value=[],e.link.color=[],e.node.label=[],e.node.color=[]),a({link:e.link,node:e.node})}},{"../../lib":660,"../../lib/gup":657,"strongly-connected-components":465}],984:[function(t,e,r){"use strict";e.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"cubic-in-out",cn:{sankey:"sankey",sankeyLinks:"sankey-links",sankeyLink:"sankey-link",sankeyNodeSet:"sankey-node-set",sankeyNode:"sankey-node",nodeRect:"node-rect",nodeCapture:"node-capture",nodeCentered:"node-entered",nodeLabelGuide:"node-label-guide",nodeLabel:"node-label",nodeLabelTextPath:"node-label-text-path"}}},{}],985:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../components/color"),o=t("tinycolor2"),s=t("../../plots/domain").defaults;e.exports=function(t,e,r,l){function c(r,a){return n.coerce(t,e,i,r,a)}c("node.label"),c("node.pad"),c("node.thickness"),c("node.line.color"),c("node.line.width");var u=l.colorway;c("node.color",e.node.label.map(function(t,e){return a.addOpacity(function(t){return u[t%u.length]}(e),.8)})),c("link.label"),c("link.source"),c("link.target"),c("link.value"),c("link.line.color"),c("link.line.width"),c("link.color",e.link.value.map(function(){return o(l.paper_bgcolor).getLuminance()<.333?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)"})),s(e,l,c),c("orientation"),c("valueformat"),c("valuesuffix"),c("arrangement"),n.coerceFont(c,"textfont",n.extendFlat({},l.font)),e._length=null}},{"../../components/color":532,"../../lib":660,"../../plots/domain":731,"./attributes":981,tinycolor2:473}],986:[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.moduleType="trace",n.name="sankey",n.basePlotModule=t("./base_plot"),n.categories=["noOpacity"],n.meta={},e.exports=n},{"./attributes":981,"./base_plot":982,"./calc":983,"./defaults":985,"./plot":987}],987:[function(t,e,r){"use strict";var n=t("d3"),i=t("./render"),a=t("../../components/fx"),o=t("../../components/color"),s=t("../../lib"),l=t("./constants").cn,c=s._;function u(t){return""!==t}function f(t,e){return t.filter(function(t){return t.key===e.traceId})}function h(t,e){n.select(t).select("path").style("fill-opacity",e),n.select(t).select("rect").style("fill-opacity",e)}function p(t){n.select(t).select("text.name").style("fill","black")}function d(t){return function(e){return-1!==t.node.sourceLinks.indexOf(e.link)||-1!==t.node.targetLinks.indexOf(e.link)}}function g(t){return function(e){return-1!==e.node.sourceLinks.indexOf(t.link)||-1!==e.node.targetLinks.indexOf(t.link)}}function m(t,e,r){e&&r&&f(r,e).selectAll("."+l.sankeyLink).filter(d(e)).call(y.bind(0,e,r,!1))}function v(t,e,r){e&&r&&f(r,e).selectAll("."+l.sankeyLink).filter(d(e)).call(x.bind(0,e,r,!1))}function y(t,e,r,n){var i=n.datum().link.label;n.style("fill-opacity",.4),i&&f(e,t).selectAll("."+l.sankeyLink).filter(function(t){return t.link.label===i}).style("fill-opacity",.4),r&&f(e,t).selectAll("."+l.sankeyNode).filter(g(t)).call(m)}function x(t,e,r,n){var i=n.datum().link.label;n.style("fill-opacity",function(t){return t.tinyColorAlpha}),i&&f(e,t).selectAll("."+l.sankeyLink).filter(function(t){return t.link.label===i}).style("fill-opacity",function(t){return t.tinyColorAlpha}),r&&f(e,t).selectAll(l.sankeyNode).filter(g(t)).call(v)}function b(t,e){var r=t.hoverlabel||{},n=s.nestedProperty(r,e).get();return!Array.isArray(n)&&n}e.exports=function(t,e){var r=t._fullLayout,s=r._paper,f=r._size,d=c(t,"source:")+" ",g=c(t,"target:")+" ",_=c(t,"incoming flow count:")+" ",w=c(t,"outgoing flow count:")+" ";i(s,e,{width:f.w,height:f.h,margin:{t:f.t,r:f.r,b:f.b,l:f.l}},{linkEvents:{hover:function(e,r,i){n.select(e).call(y.bind(0,r,i,!0)),t.emit("plotly_hover",{event:n.event,points:[r.link]})},follow:function(e,i){var s=i.link.trace,l=t._fullLayout._paperdiv.node().getBoundingClientRect(),c=e.getBoundingClientRect(),f=c.left+c.width/2,m=c.top+c.height/2,v=a.loneHover({x:f-l.left,y:m-l.top,name:n.format(i.valueFormat)(i.link.value)+i.valueSuffix,text:[i.link.label||"",d+i.link.source.label,g+i.link.target.label].filter(u).join("
"),color:b(s,"bgcolor")||o.addOpacity(i.tinyColorHue,1),borderColor:b(s,"bordercolor"),fontFamily:b(s,"font.family"),fontSize:b(s,"font.size"),fontColor:b(s,"font.color"),idealAlign:n.event.x"),color:b(o,"bgcolor")||i.tinyColorHue,borderColor:b(o,"bordercolor"),fontFamily:b(o,"font.family"),fontSize:b(o,"font.size"),fontColor:b(o,"font.color"),idealAlign:"left"},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t});h(v,.85),p(v)},unhover:function(e,i,o){n.select(e).call(v,i,o),t.emit("plotly_unhover",{event:n.event,points:[i.node]}),a.loneUnhover(r._hoverlayer.node())},select:function(e,r,i){var o=r.node;o.originalEvent=n.event,t._hoverdata=[o],n.select(e).call(v,r,i),a.click(t,{target:!0})}}})}},{"../../components/color":532,"../../components/fx":574,"../../lib":660,"./constants":984,"./render":988,d3:131}],988:[function(t,e,r){"use strict";var n=t("./constants"),i=t("d3"),a=t("tinycolor2"),o=t("../../components/color"),s=t("../../components/drawing"),l=t("@plotly/d3-sankey").sankey,c=t("d3-force"),u=t("../../lib"),f=u.isArrayOrTypedArray,h=u.isIndex,p=t("../../lib/gup"),d=p.keyFun,g=p.repeat,m=p.unwrap;function v(t){t.lastDraggedX=t.x,t.lastDraggedY=t.y}function y(t){return function(e){return e.node.originalX===t.node.originalX}}function x(t){for(var e=0;e1||t.linkLineWidth>0}function T(t){return"translate("+t.translateX+","+t.translateY+")"+(t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)")}function S(t){return"translate("+(t.horizontal?0:t.labelY)+" "+(t.horizontal?t.labelY:0)+")"}function C(t){return i.svg.line()([[t.horizontal?t.left?-t.sizeAcross:t.visibleWidth+n.nodeTextOffsetHorizontal:n.nodeTextOffsetHorizontal,0],[t.horizontal?t.left?-n.nodeTextOffsetHorizontal:t.sizeAcross:t.visibleHeight-n.nodeTextOffsetHorizontal,0]])}function E(t){return t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)"}function L(t){return t.horizontal?"scale(1 1)":"scale(-1 1)"}function z(t){return t.darkBackground&&!t.horizontal?"rgb(255,255,255)":"rgb(0,0,0)"}function P(t){return t.horizontal&&t.left?"100%":"0%"}function D(t,e,r){t.on(".basic",null).on("mouseover.basic",function(t){t.interactionState.dragInProgress||(r.hover(this,t,e),t.interactionState.hovered=[this,t])}).on("mousemove.basic",function(t){t.interactionState.dragInProgress||(r.follow(this,t),t.interactionState.hovered=[this,t])}).on("mouseout.basic",function(t){t.interactionState.dragInProgress||(r.unhover(this,t,e),t.interactionState.hovered=!1)}).on("click.basic",function(t){t.interactionState.hovered&&(r.unhover(this,t,e),t.interactionState.hovered=!1),t.interactionState.dragInProgress||r.select(this,t,e)})}function O(t,e,r){var a=i.behavior.drag().origin(function(t){return t.node}).on("dragstart",function(i){if("fixed"!==i.arrangement&&(u.raiseToTop(this),i.interactionState.dragInProgress=i.node,v(i.node),i.interactionState.hovered&&(r.nodeEvents.unhover.apply(0,i.interactionState.hovered),i.interactionState.hovered=!1),"snap"===i.arrangement)){var a=i.traceId+"|"+Math.floor(i.node.originalX);i.forceLayouts[a]?i.forceLayouts[a].alpha(1):function(t,e,r){var i=r.sankey.nodes().filter(function(t){return t.originalX===r.node.originalX});r.forceLayouts[e]=c.forceSimulation(i).alphaDecay(0).force("collide",c.forceCollide().radius(function(t){return t.dy/2+r.nodePad/2}).strength(1).iterations(n.forceIterations)).force("constrain",function(t,e,r,i){return function(){for(var t=0,a=0;a0&&i.forceLayouts[e].alpha(0)}}(0,e,i,r)).stop()}(0,a,i),function(t,e,r,i){window.requestAnimationFrame(function a(){for(var o=0;o0&&window.requestAnimationFrame(a)})}(t,e,i,a)}}).on("drag",function(r){if("fixed"!==r.arrangement){var n=i.event.x,a=i.event.y;"snap"===r.arrangement?(r.node.x=n,r.node.y=a):("freeform"===r.arrangement&&(r.node.x=n),r.node.y=Math.max(r.node.dy/2,Math.min(r.size-r.node.dy/2,a))),v(r.node),"snap"!==r.arrangement&&(r.sankey.relayout(),k(t.filter(y(r)),e))}}).on("dragend",function(t){t.interactionState.dragInProgress=!1});t.on(".drag",null).call(a)}e.exports=function(t,e,r,i){var c=t.selectAll("."+n.cn.sankey).data(e.filter(function(t){return m(t).trace.visible}).map(function(t,e,r){var i,a=m(e).trace,o=a.domain,s=a.node,c=a.link,u=a.arrangement,p="h"===a.orientation,d=a.node.pad,g=a.node.thickness,v=a.node.line.color,y=a.node.line.width,b=a.link.line.color,_=a.link.line.width,w=a.valueformat,k=a.valuesuffix,M=a.textfont,A=t.width*(o.x[1]-o.x[0]),T=t.height*(o.y[1]-o.y[0]),S=[],C=f(c.color),E={},L=s.label.length;for(i=0;i0&&h(P,L)&&h(D,L)&&(D=+D,E[P=+P]=E[D]=!0,S.push({pointNumber:i,label:c.label[i],color:C?c.color[i]:c.color,source:P,target:D,value:+z}))}var O=f(s.color),I=[],R=!1,B={};for(i=0;i5?t.node.label:""}).attr("text-anchor",function(t){return t.horizontal&&t.left?"end":"start"}),F.transition().ease(n.ease).duration(n.duration).attr("startOffset",P).style("fill",z)}},{"../../components/color":532,"../../components/drawing":557,"../../lib":660,"../../lib/gup":657,"./constants":984,"@plotly/d3-sankey":43,d3:131,"d3-force":127,tinycolor2:473}],989:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;r=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],994:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0!==l&&l.showscale){var u=l.color,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,u)),n(h)||(h=i.aggNums(Math.max,null,u));var p=e[0].t.cb=s(t,c),d=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});p.fillcolor(d).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}else a.autoMargin(t,c)}},{"../../components/colorbar/draw":536,"../../components/colorscale":547,"../../lib":660,"../../plots/plots":768,"fast-isnumeric":197}],995:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("./subtypes");e.exports=function(t){a.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),a.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":539,"../../components/colorscale/has_colorscale":546,"./subtypes":1012}],996:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20,minTolerance:.2,toleranceGrowth:10,maxScreensAway:20}},{}],997:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry"),a=t("./attributes"),o=t("./constants"),s=t("./subtypes"),l=t("./xy_defaults"),c=t("./marker_defaults"),u=t("./line_defaults"),f=t("./line_shape_defaults"),h=t("./text_defaults"),p=t("./fillcolor_defaults");e.exports=function(t,e,r,d){function g(r,i){return n.coerce(t,e,a,r,i)}var m=l(t,e,d,g),v=mV!=(D=C[T][1])>=V&&(L=C[T-1][0],z=C[T][0],D-P&&(E=L+(z-L)*(V-P)/(D-P),B=Math.min(B,E),F=Math.max(F,E)));B=Math.max(B,0),F=Math.min(F,h._length);var U=s.defaultLine;return s.opacity(f.fillcolor)?U=f.fillcolor:s.opacity((f.line||{}).color)&&(U=f.line.color),n.extendFlat(t,{distance:t.maxHoverDistance,x0:B,x1:F,y0:V,y1:V,color:U}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":532,"../../components/fx":574,"../../lib":660,"../../registry":790,"./fill_hover_text":998,"./get_trace_color":1e3}],1002:[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").calc,n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style").style,n.styleOnSelect=t("./style").styleOnSelect,n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","svg","symbols","markerColorscale","errorBarsOK","showLegend","scatter-like","zoomScale"],n.meta={},e.exports=n},{"../../plots/cartesian":717,"./arrays_to_calcdata":989,"./attributes":990,"./calc":991,"./clean_data":993,"./colorbar":994,"./defaults":997,"./hover":1001,"./plot":1009,"./select":1010,"./style":1011,"./subtypes":1012}],1003:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray,i=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,s,l){var c=(t.marker||{}).color;(s("line.color",r),i(t,"line"))?a(t,e,o,s,{prefix:"line.",cLetter:"c"}):s("line.color",!n(c)&&c||r);s("line.width"),(l||{}).noDash||s("line.dash")}},{"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546,"../../lib":660}],1004:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM,i=t("../../lib"),a=i.segmentsIntersect,o=i.constrain,s=t("./constants");e.exports=function(t,e){var r,l,c,u,f,h,p,d,g,m,v,y,x,b,_,w,k=e.xaxis,M=e.yaxis,A=e.simplify,T=e.connectGaps,S=e.baseTolerance,C=e.shape,E="linear"===C,L=[],z=s.minTolerance,P=new Array(t.length),D=0;function O(e){var r=t[e],i=k.c2p(r.x),a=M.c2p(r.y);return i===n||a===n?r.intoCenter||!1:[i,a]}function I(t){var e=t[0]/k._length,r=t[1]/M._length;return(1+s.toleranceGrowth*Math.max(0,-e,e-1,-r,r-1))*S}function R(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}A||(S=z=-1);var B,F,N,j,V,U,q,H=s.maxScreensAway,G=-k._length*H,W=k._length*(1+H),Y=-M._length*H,X=M._length*(1+H),Z=[[G,Y,W,Y],[W,Y,W,X],[W,X,G,X],[G,X,G,Y]];function J(t){if(t[0]W||t[1]X)return[o(t[0],G,W),o(t[1],Y,X)]}function K(t,e){return t[0]===e[0]&&(t[0]===G||t[0]===W)||(t[1]===e[1]&&(t[1]===Y||t[1]===X)||void 0)}function Q(t,e,r){return function(n,a){var o=J(n),s=J(a),l=[];if(o&&s&&K(o,s))return l;o&&l.push(o),s&&l.push(s);var c=2*i.constrain((n[t]+a[t])/2,e,r)-((o||n)[t]+(s||a)[t]);c&&((o&&s?c>0==o[t]>s[t]?o:s:o||s)[t]+=c);return l}}function $(t){var e=t[0],r=t[1],n=e===P[D-1][0],i=r===P[D-1][1];if(!n||!i)if(D>1){var a=e===P[D-2][0],o=r===P[D-2][1];n&&(e===G||e===W)&&a?o?D--:P[D-1]=t:i&&(r===Y||r===X)&&o?a?D--:P[D-1]=t:P[D++]=t}else P[D++]=t}function tt(t){P[D-1][0]!==t[0]&&P[D-1][1]!==t[1]&&$([N,j]),$(t),V=null,N=j=0}function et(t){if(B=t[0]W?W:0,F=t[1]X?X:0,B||F){if(D)if(V){var e=q(V,t);e.length>1&&(tt(e[0]),P[D++]=e[1])}else U=q(P[D-1],t)[0],P[D++]=U;else P[D++]=[B||t[0],F||t[1]];var r=P[D-1];B&&F&&(r[0]!==B||r[1]!==F)?(V&&(N!==B&&j!==F?$(N&&j?(n=V,a=(i=t)[0]-n[0],o=(i[1]-n[1])/a,(n[1]*i[0]-i[1]*n[0])/a>0?[o>0?G:W,X]:[o>0?W:G,Y]):[N||B,j||F]):N&&j&&$([N,j])),$([B,F])):N-B&&j-F&&$([B||N,F||j]),V=t,N=B,j=F}else V&&tt(q(V,t)[0]),P[D++]=t;var n,i,a,o}for("linear"===C||"spline"===C?q=function(t,e){for(var r=[],n=0,i=0;i<4;i++){var o=Z[i],s=a(t[0],t[1],e[0],e[1],o[0],o[1],o[2],o[3]);s&&(!n||Math.abs(s.x-r[0][0])>1||Math.abs(s.y-r[0][1])>1)&&(s=[s.x,s.y],n&&R(s,t)I(h))break;c=h,(x=g[0]*d[0]+g[1]*d[1])>v?(v=x,u=h,p=!1):x=t.length||!h)break;et(h),l=h}}else et(u)}V&&$([N||V[0],j||V[1]]),L.push(P.slice(0,D))}return L}},{"../../constants/numerical":637,"../../lib":660,"./constants":996}],1005:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],1006:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i,a=null;for(i=0;i0?Math.max(e,i):0}}},{"fast-isnumeric":197}],1008:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,s,l,c){var u=o.isBubble(t),f=(t.line||{}).color;(c=c||{},f&&(r=f),l("marker.symbol"),l("marker.opacity",u?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),c.noSelect||(l("selected.marker.color"),l("unselected.marker.color"),l("selected.marker.size"),l("unselected.marker.size")),c.noLine||(l("marker.line.color",f&&!Array.isArray(f)&&e.marker.color!==f?f:u?n.background:n.defaultLine),i(t,"marker.line")&&a(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")),c.gradient)&&("none"!==l("marker.gradient.type")&&l("marker.gradient.color"))}},{"../../components/color":532,"../../components/colorscale/defaults":542,"../../components/colorscale/has_colorscale":546,"./subtypes":1012}],1009:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../registry"),a=t("../../lib"),o=t("../../components/drawing"),s=t("./subtypes"),l=t("./line_points"),c=t("./link_traces"),u=t("../../lib/polygon").tester;function f(t,e,r,c,f,h,p){var d,g;!function(t,e,r,i,o){var l=r.xaxis,c=r.yaxis,u=n.extent(a.simpleMap(l.range,l.r2c)),f=n.extent(a.simpleMap(c.range,c.r2c)),h=i[0].trace;if(!s.hasMarkers(h))return;var p=h.marker.maxdisplayed;if(0===p)return;var d=i.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[1]}),g=Math.ceil(d.length/p),m=0;o.forEach(function(t,r){var n=t[0].trace;s.hasMarkers(n)&&n.marker.maxdisplayed>0&&r0;function v(t){return m?t.transition():t}var y=r.xaxis,x=r.yaxis,b=c[0].trace,_=b.line,w=n.select(h);if(i.getComponentMethod("errorbars","plot")(w,r,p),!0===b.visible){var k,M;v(w).style("opacity",b.opacity);var A=b.fill.charAt(b.fill.length-1);"x"!==A&&"y"!==A&&(A=""),r.isRangePlot||(c[0].node3=w);var T="",S=[],C=b._prevtrace;C&&(T=C._prevRevpath||"",M=C._nextFill,S=C._polygons);var E,L,z,P,D,O,I,R,B,F="",N="",j=[],V=a.noop;if(k=b._ownFill,s.hasLines(b)||"none"!==b.fill){for(M&&M.datum(c),-1!==["hv","vh","hvh","vhv"].indexOf(_.shape)?(z=o.steps(_.shape),P=o.steps(_.shape.split("").reverse().join(""))):z=P="spline"===_.shape?function(t){var e=t[t.length-1];return t.length>1&&t[0][0]===e[0]&&t[0][1]===e[1]?o.smoothclosed(t.slice(1),_.smoothing):o.smoothopen(t,_.smoothing)}:function(t){return"M"+t.join("L")},D=function(t){return P(t.reverse())},j=l(c,{xaxis:y,yaxis:x,connectGaps:b.connectgaps,baseTolerance:Math.max(_.width||1,3)/4,shape:_.shape,simplify:_.simplify}),B=b._polygons=new Array(j.length),g=0;g1){var r=n.select(this);if(r.datum(c),t)v(r.style("opacity",0).attr("d",E).call(o.lineGroupStyle)).style("opacity",1);else{var i=v(r);i.attr("d",E),o.singleLineStyle(c,i)}}}}}var U=w.selectAll(".js-line").data(j);v(U.exit()).style("opacity",0).remove(),U.each(V(!1)),U.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(o.lineGroupStyle).each(V(!0)),o.setClipUrl(U,r.layerClipId),j.length?(k?O&&R&&(A?("y"===A?O[1]=R[1]=x.c2p(0,!0):"x"===A&&(O[0]=R[0]=y.c2p(0,!0)),v(k).attr("d","M"+R+"L"+O+"L"+F.substr(1)).call(o.singleFillStyle)):v(k).attr("d",F+"Z").call(o.singleFillStyle)):M&&("tonext"===b.fill.substr(0,6)&&F&&T?("tonext"===b.fill?v(M).attr("d",F+"Z"+T+"Z").call(o.singleFillStyle):v(M).attr("d",F+"L"+T.substr(1)+"Z").call(o.singleFillStyle),b._polygons=b._polygons.concat(S)):(H(M),b._polygons=null)),b._prevRevpath=N,b._prevPolygons=B):(k?H(k):M&&H(M),b._polygons=b._prevRevpath=b._prevPolygons=null);var q=w.selectAll(".points");d=q.data([c]),q.each(Z),d.enter().append("g").classed("points",!0).each(Z),d.exit().remove(),d.each(function(t){var e=!1===t[0].trace.cliponaxis;o.setClipUrl(n.select(this),e?null:r.layerClipId)})}function H(t){v(t).attr("d","M0,0Z")}function G(t){return t.filter(function(t){return t.vis})}function W(t){return t.id}function Y(t){if(t.ids)return W}function X(){return!1}function Z(e){var i,l=e[0].trace,c=n.select(this),u=s.hasMarkers(l),f=s.hasText(l),h=Y(l),p=X,d=X;u&&(p=l.marker.maxdisplayed||l._needsCull?G:a.identity),f&&(d=l.marker.maxdisplayed||l._needsCull?G:a.identity);var g,b=(i=c.selectAll("path.point").data(p,h)).enter().append("path").classed("point",!0);m&&b.call(o.pointStyle,l,t).call(o.translatePoints,y,x).style("opacity",0).transition().style("opacity",1),i.order(),u&&(g=o.makePointStyleFns(l)),i.each(function(e){var i=n.select(this),a=v(i);o.translatePoint(e,a,y,x)?(o.singlePointStyle(e,a,l,g,t),r.layerClipId&&o.hideOutsideRangePoint(e,a,y,x,l.xcalendar,l.ycalendar),l.customdata&&i.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):a.remove()}),m?i.exit().transition().style("opacity",0).remove():i.exit().remove(),(i=c.selectAll("g").data(d,h)).enter().append("g").classed("textpoint",!0).append("text"),i.order(),i.each(function(t){var e=n.select(this),i=v(e.select("text"));o.translatePoint(t,i,y,x)?r.layerClipId&&o.hideOutsideRangePoint(t,e,y,x,l.xcalendar,l.ycalendar):e.remove()}),i.selectAll("text").call(o.textPointStyle,l,t).each(function(t){var e=y.c2p(t.x),r=x.c2p(t.y);n.select(this).selectAll("tspan.line").each(function(){v(n.select(this)).attr({x:e,y:r})})}),i.exit().remove()}}e.exports=function(t,e,r,i,a,s){var l,u,h,p,d=!a,g=!!a&&a.duration>0;for((h=i.selectAll("g.trace").data(r,function(t){return t[0].trace.uid})).enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),c(t,e,r),function(t,e,r){var i;e.selectAll("g.trace").each(function(t){var e=n.select(this);if((i=t[0].trace)._nexttrace){if(i._nextFill=e.select(".js-fill.js-tonext"),!i._nextFill.size()){var a=":first-child";e.select(".js-fill.js-tozero").size()&&(a+=" + *"),i._nextFill=e.insert("path",a).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),i._nextFill=null;i.fill&&("tozero"===i.fill.substr(0,6)||"toself"===i.fill||"to"===i.fill.substr(0,2)&&!i._prevtrace)?(i._ownFill=e.select(".js-fill.js-tozero"),i._ownFill.size()||(i._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),i._ownFill=null),e.selectAll(".js-fill").call(o.setClipUrl,r.layerClipId)})}(0,i,e),l=0,u={};lu[e[0].trace.uid]?1:-1}),g)?(s&&(p=s()),n.transition().duration(a.duration).ease(a.easing).each("end",function(){p&&p()}).each("interrupt",function(){p&&p()}).each(function(){i.selectAll("g.trace").each(function(n,i){f(t,i,e,n,r,this,a)})})):i.selectAll("g.trace").each(function(n,i){f(t,i,e,n,r,this,a)});d&&h.exit().remove(),i.selectAll("path:not([d])").remove()}},{"../../components/drawing":557,"../../lib":660,"../../lib/polygon":672,"../../registry":790,"./line_points":1004,"./link_traces":1006,"./subtypes":1012,d3:131}],1010:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,i,a,o,s=t.cd,l=t.xaxis,c=t.yaxis,u=[],f=s[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===e)for(r=0;r=0&&(p[1]+=1),h.indexOf("top")>=0&&(p[1]-=1),h.indexOf("left")>=0&&(p[0]-=1),h.indexOf("right")>=0&&(p[0]+=1),p)),r.textColor=u(e.textfont,1,E),r.textSize=x(e.textfont.size,E,l.identity,12),r.textFont=e.textfont.family,r.textAngle=0);var O=["x","y","z"];for(r.project=[!1,!1,!1],r.projectScale=[1,1,1],r.projectOpacity=[1,1,1],n=0;n<3;++n){var I=e.projection[O[n]];(r.project[n]=I.show)&&(r.projectOpacity[n]=I.opacity,r.projectScale[n]=I.scale)}r.errorBounds=d(e,b);var R=function(t){for(var e=[0,0,0],r=[[0,0,0],[0,0,0],[0,0,0]],n=[0,0,0],i=0;i<3;i++){var a=t[i];a&&!1!==a.copy_zstyle&&(a=t[2]),a&&(e[i]=a.width/2,r[i]=c(a.color),n=a.thickness)}return{capSize:e,color:r,lineWidth:n}}([e.error_x,e.error_y,e.error_z]);return r.errorColor=R.color,r.errorLineWidth=R.lineWidth,r.errorCapSize=R.capSize,r.delaunayAxis=e.surfaceaxis,r.delaunayColor=c(e.surfacecolor),r}function _(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}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=this.textLabels:t.textLabel="";var e=t.index=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,l,c,u=this.scene.glplot.gl,f=h.solid;this.data=t;var p=b(this.scene,t);"mode"in p&&(this.mode=p.mode),"lineDashes"in p&&p.lineDashes in h&&(f=h[p.lineDashes]),this.color=_(p.scatterColor)||_(p.lineColor),this.dataPoints=p.position,e={gl:u,position:p.position,color:p.lineColor,lineWidth:p.lineWidth||1,dashes:f[0],dashScale:f[1],opacity:t.opacity,connectGaps:t.connectgaps},-1!==this.mode.indexOf("lines")?this.linePlot?this.linePlot.update(e):(this.linePlot=n(e),this.linePlot._trace=this,this.scene.glplot.add(this.linePlot)):this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose(),this.linePlot=null);var d=t.opacity;if(t.marker&&t.marker.opacity&&(d*=t.marker.opacity),r={gl:u,position:p.position,color:p.scatterColor,size:p.scatterSize,glyph:p.scatterMarker,opacity:d,orthographic:!0,lineWidth:p.scatterLineWidth,lineColor:p.scatterLineColor,project:p.project,projectScale:p.projectScale,projectOpacity:p.projectOpacity},-1!==this.mode.indexOf("markers")?this.scatterPlot?this.scatterPlot.update(r):(this.scatterPlot=i(r),this.scatterPlot._trace=this,this.scatterPlot.highlightScale=1,this.scene.glplot.add(this.scatterPlot)):this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose(),this.scatterPlot=null),c={gl:u,position:p.position,glyph:p.text,color:p.textColor,size:p.textSize,angle:p.textAngle,alignment:p.textOffset,font:p.textFont,orthographic:!0,lineWidth:0,project:!1,opacity:t.opacity},this.textLabels=t.hovertext||t.text,-1!==this.mode.indexOf("text")?this.textMarkers?this.textMarkers.update(c):(this.textMarkers=i(c),this.textMarkers._trace=this,this.textMarkers.highlightScale=1,this.scene.glplot.add(this.textMarkers)):this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose(),this.textMarkers=null),l={gl:u,position:p.position,color:p.errorColor,error:p.errorBounds,lineWidth:p.errorLineWidth,capSize:p.errorCapSize,opacity:t.opacity},this.errorBars?p.errorBounds?this.errorBars.update(l):(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose(),this.errorBars=null):p.errorBounds&&(this.errorBars=a(l),this.errorBars._trace=this,this.scene.glplot.add(this.errorBars)),p.delaunayAxis>=0){var g=function(t,e,r){var n,i=(r+1)%3,a=(r+2)%3,o=[],l=[];for(n=0;n=0&&f("surfacecolor",h||p);for(var d=["x","y","z"],g=0;g<3;++g){var m="projection."+d[g];f(m+".show")&&(f(m+".opacity"),f(m+".scale"))}var v=n.getComponentMethod("errorbars","supplyDefaults");v(t,e,r,{axis:"z"}),v(t,e,r,{axis:"y",inherit:"z"}),v(t,e,r,{axis:"x",inherit:"z"})}else e.visible=!1}},{"../../lib":660,"../../registry":790,"../scatter/line_defaults":1003,"../scatter/marker_defaults":1008,"../scatter/subtypes":1012,"../scatter/text_defaults":1013,"./attributes":1015}],1020:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl3d_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl3d_markers":635,"../../plots/gl3d":748,"../scatter/colorbar":994,"./attributes":1015,"./calc":1016,"./convert":1018,"./defaults":1019}],1021:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../components/colorbar/attributes"),s=t("../../lib/extend").extendFlat,l=n.marker,c=n.line,u=l.line;e.exports={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:s({},n.mode,{dflt:"markers"}),text:s({},n.text,{}),line:{color:c.color,width:c.width,dash:c.dash,shape:s({},c.shape,{values:["linear","spline"]}),smoothing:c.smoothing,editType:"calc"},connectgaps:n.connectgaps,fill:s({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:s({symbol:l.symbol,opacity:l.opacity,maxdisplayed:l.maxdisplayed,size:l.size,sizeref:l.sizeref,sizemin:l.sizemin,sizemode:l.sizemode,line:s({width:u.width,editType:"calc"},a("marker".line)),gradient:l.gradient,editType:"calc"},a("marker"),{showscale:l.showscale,colorbar:o}),textfont:n.textfont,textposition:n.textposition,selected:n.selected,unselected:n.unselected,hoverinfo:s({},i.hoverinfo,{flags:["a","b","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":533,"../../components/colorscale/color_attributes":540,"../../lib/extend":649,"../../plots/attributes":703,"../scatter/attributes":990}],1022:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../scatter/colorscale_calc"),a=t("../scatter/arrays_to_calcdata"),o=t("../scatter/calc_selection"),s=t("../scatter/calc").calcMarkerSize,l=t("../carpet/lookup_carpetid");e.exports=function(t,e){var r=e._carpetTrace=l(t,e);if(r&&r.visible&&"legendonly"!==r.visible){var c;e.xaxis=r.xaxis,e.yaxis=r.yaxis;var u,f,h=e._length,p=new Array(h),d=!1;for(c=0;c"),a}function w(t,e){var r;r=t.labelprefix&&t.labelprefix.length>0?t.labelprefix.replace(/ = $/,""):t._hovertitle,g.push(r+": "+e.toFixed(3)+t.labelsuffix)}}},{"../scatter/hover":1001}],1026:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("../scatter/style").style,n.styleOnSelect=t("../scatter/style").styleOnSelect,n.hoverPoints=t("./hover"),n.selectPoints=t("../scatter/select"),n.eventData=t("./event_data"),n.moduleType="trace",n.name="scattercarpet",n.basePlotModule=t("../../plots/cartesian"),n.categories=["svg","carpet","symbols","markerColorscale","showLegend","carpetDependent","zoomScale"],n.meta={},e.exports=n},{"../../plots/cartesian":717,"../scatter/colorbar":994,"../scatter/select":1010,"../scatter/style":1011,"./attributes":1021,"./calc":1022,"./defaults":1023,"./event_data":1024,"./hover":1025,"./plot":1027}],1027:[function(t,e,r){"use strict";var n=t("../scatter/plot"),i=t("../../plots/cartesian/axes"),a=t("../../components/drawing");e.exports=function(t,e,r,o){var s,l,c,u=r[0][0].carpet,f={xaxis:i.getFromId(t,u.xaxis||"x"),yaxis:i.getFromId(t,u.yaxis||"y"),plot:e.plot};for(n(t,f,r,o),s=0;s")}(u,m,p.mockAxis,c[0].t.labels),[t]}}},{"../../components/fx":574,"../../constants/numerical":637,"../../plots/cartesian/axes":706,"../scatter/fill_hover_text":998,"../scatter/get_trace_color":1e3,"./attributes":1028}],1033:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOnSelect=t("../scatter/style").styleOnSelect,n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scattergeo",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","symbols","markerColorscale","showLegend","scatter-like"],n.meta={},e.exports=n},{"../../plots/geo":736,"../scatter/colorbar":994,"../scatter/style":1011,"./attributes":1028,"./calc":1029,"./defaults":1030,"./event_data":1031,"./hover":1032,"./plot":1034,"./select":1035,"./style":1036}],1034:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../constants/numerical").BADNUM,o=t("../../lib/topojson_utils").getTopojsonFeatures,s=t("../../lib/geo_location_utils").locationToFeature,l=t("../../lib/geojson_utils"),c=t("../scatter/subtypes"),u=t("./style");function f(t,e){var r=t[0].trace;if(Array.isArray(r.locations))for(var n=o(r,e),i=r.locationmode,l=0;ld.TOO_MANY_POINTS?"rect":h.hasMarkers(e)?"rect":"round";if(o&&e.connectgaps){var l=n[0],c=n[1];for(i=0;i1&&c.extendFlat(o.line,b(t,r,n)),o.errorX||o.errorY){var s=_(t,r,n,i,a);o.errorX&&c.extendFlat(o.errorX,s.x),o.errorY&&c.extendFlat(o.errorY,s.y)}return o}function A(t,e){var r=e._scene,n=t._fullLayout,i={count:0,dirty:!0,lineOptions:[],fillOptions:[],markerOptions:[],selectedOptions:[],unselectedOptions:[],errorXOptions:[],errorYOptions:[]};return e._scene||((r=e._scene=c.extendFlat({},i,{selectBatch:null,unselectBatch:null,fill2d:!1,scatter2d:!1,error2d:!1,line2d:!1,select2d:null})).update=function(t){for(var e=new Array(r.count),n=0;n=k&&(T.marker.cluster=m.tree),S.lineOptions.push(T.line),S.errorXOptions.push(T.errorX),S.errorYOptions.push(T.errorY),S.fillOptions.push(T.fill),S.markerOptions.push(T.marker),S.selectedOptions.push(T.selected),S.unselectedOptions.push(T.unselected),S.count++,m._scene=S,m.index=S.count-1,m.x=v,m.y=y,m.positions=x,m.count=u,t.firstscatter=!1,[{x:!1,y:!1,t:m,trace:e}]},plot:function(t,e,r){if(r.length){var o=t._fullLayout,s=r[0][0].t._scene,l=o.dragmode;if(s){var c=o._size,h=o.width,p=o.height;u(t,["ANGLE_instanced_arrays","OES_element_index_uint"]);var d=o._glcanvas.data()[0].regl;if(m(t,e,r),s.dirty){if(!0===s.error2d&&(s.error2d=a(d)),!0===s.line2d&&(s.line2d=i(d)),!0===s.scatter2d&&(s.scatter2d=n(d)),!0===s.fill2d&&(s.fill2d=i(d)),s.line2d&&s.line2d.update(s.lineOptions),s.error2d){var g=(s.errorXOptions||[]).concat(s.errorYOptions||[]);s.error2d.update(g)}s.scatter2d&&s.scatter2d.update(s.markerOptions),s.fill2d&&(s.fillOptions=s.fillOptions.map(function(t,e){var n=r[e];if(!(t&&n&&n[0]&&n[0].trace))return null;var i,a,o=n[0],l=o.trace,c=o.t,u=s.lineOptions[e],f=[],h=u&&u.positions||c.positions;if("tozeroy"===l.fill)(f=(f=[h[0],0]).concat(h)).push(h[h.length-2]),f.push(0);else if("tozerox"===l.fill)(f=(f=[0,h[1]]).concat(h)).push(0),f.push(h[h.length-1]);else if("toself"===l.fill||"tonext"===l.fill){for(f=[],i=0,a=0;a=0?Math.floor((e+180)/360):Math.ceil((e-180)/360)),d=e-p;if(n.getClosest(l,function(t){var e=t.lonlat;if(e[0]===s)return 1/0;var n=i.wrap180(e[0]),a=e[1],o=h.project([n,a]),l=o.x-u.c2p([d,a]),c=o.y-f.c2p([n,r]),p=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(l*l+c*c)-p,1-3/p)},t),!1!==t.index){var g=l[t.index],m=g.lonlat,v=[i.wrap180(m[0])+p,m[1]],y=u.c2p(v),x=f.c2p(v),b=g.mrc||1;return t.x0=y-b,t.x1=y+b,t.y0=x-b,t.y1=x+b,t.color=a(c,g),t.extraText=function(t,e,r){var n=(e.hi||t.hoverinfo).split("+"),i=-1!==n.indexOf("all"),a=-1!==n.indexOf("lon"),s=-1!==n.indexOf("lat"),l=e.lonlat,c=[];function u(t){return t+"\xb0"}i||a&&s?c.push("("+u(l[0])+", "+u(l[1])+")"):a?c.push(r.lon+u(l[0])):s&&c.push(r.lat+u(l[1]));(i||-1!==n.indexOf("text"))&&o(e,t,c);return c.join("
")}(c,g,l[0].t.labels),[t]}}},{"../../components/fx":574,"../../constants/numerical":637,"../../lib":660,"../scatter/fill_hover_text":998,"../scatter/get_trace_color":1e3}],1047:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("../scattergeo/calc"),n.plot=t("./plot"),n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.selectPoints=t("./select"),n.style=function(t,e){e&&e[0].trace._glTrace.update(e)},n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend","scatterlike"],n.meta={},e.exports=n},{"../../plots/mapbox":762,"../scatter/colorbar":994,"../scattergeo/calc":1029,"./attributes":1042,"./defaults":1044,"./event_data":1045,"./hover":1046,"./plot":1048,"./select":1049}],1048:[function(t,e,r){"use strict";var n=t("./convert");function i(t,e){this.subplot=t,this.uid=e,this.sourceIds={fill:e+"-source-fill",line:e+"-source-line",circle:e+"-source-circle",symbol:e+"-source-symbol"},this.layerIds={fill:e+"-layer-fill",line:e+"-layer-line",circle:e+"-layer-circle",symbol:e+"-layer-symbol"},this.order=["fill","line","circle","symbol"]}var a=i.prototype;a.addSource=function(t,e){this.subplot.map.addSource(this.sourceIds[t],{type:"geojson",data:e.geojson})},a.setSourceData=function(t,e){this.subplot.map.getSource(this.sourceIds[t]).setData(e.geojson)},a.addLayer=function(t,e){this.subplot.map.addLayer({type:t,id:this.layerIds[t],source:this.sourceIds[t],layout:e.layout,paint:e.paint})},a.update=function(t){for(var e=this.subplot,r=n(t),i=0;i")}e.exports={hoverPoints:function(t,e,r,i){var a=n(t,e,r,i);if(a&&!1!==a[0].index){var s=a[0];if(void 0===s.index)return a;var l=t.subplot,c=s.cd[s.index],u=s.trace;if(l.isPtWithinSector(c))return s.xLabelVal=void 0,s.yLabelVal=void 0,s.extraText=o(c,u,l),a}},makeHoverPointText:o}},{"../../lib":660,"../../plots/cartesian/axes":706,"../scatter/hover":1001}],1054:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"scatterpolar",basePlotModule:t("../../plots/polar"),categories:["polar","symbols","markerColorscale","showLegend","scatter-like"],attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,hoverPoints:t("./hover").hoverPoints,selectPoints:t("../scatter/select"),meta:{}}},{"../../plots/polar":771,"../scatter/select":1010,"../scatter/style":1011,"./attributes":1050,"./calc":1051,"./defaults":1052,"./hover":1053,"./plot":1055}],1055:[function(t,e,r){"use strict";var n=t("../scatter/plot"),i=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r){var a,o,s,l={xaxis:e.xaxis,yaxis:e.yaxis,plot:e.framework,layerClipId:e._hasClipOnAxisFalse?e.clipIds.circle:null},c=e.radialAxis,u=c.range;for(s=u[0]>u[1]?function(t){return t<=0}:function(t){return t>=0},a=0;a=0?(m=o.c2r(g)-l[0],T=v,y=s.c2rad(T,b.thetaunit),E[d]=C[2*d]=m*Math.cos(y),L[d]=C[2*d+1]=m*Math.sin(y)):E[d]=L[d]=C[2*d]=C[2*d+1]=NaN;var z=a.sceneOptions(t,e,b,C);z.fill&&!f.fill2d&&(f.fill2d=!0),z.marker&&!f.scatter2d&&(f.scatter2d=!0),z.line&&!f.line2d&&(f.line2d=!0),!z.errorX&&!z.errorY||f.error2d||(f.error2d=!0),_.tree=n(C),z.marker&&S>=u&&(z.marker.cluster=_.tree),c.hasMarkers(b)&&(z.selected.positions=z.unselected.positions=z.marker.positions),f.lineOptions.push(z.line),f.errorXOptions.push(z.errorX),f.errorYOptions.push(z.errorY),f.fillOptions.push(z.fill),f.markerOptions.push(z.marker),f.selectedOptions.push(z.selected),f.unselectedOptions.push(z.unselected),f.count=r.length,_._scene=f,_.index=p,_.x=E,_.y=L,_.rawx=E,_.rawy=L,_.r=w,_.theta=k,_.positions=C,_.count=S}}),a.plot(t,e,r)},hoverPoints:function(t,e,r,n){var i=t.cd[0].t,o=i.r,s=i.theta,c=a.hoverPoints(t,e,r,n);if(c&&!1!==c[0].index){var u=c[0];if(void 0===u.index)return c;var f=t.subplot,h=f.angularAxis,p=u.cd[u.index],d=u.trace;if(p.r=o[u.index],p.theta=s[u.index],p.rad=h.c2rad(p.theta,d.thetaunit),f.isPtWithinSector(p))return u.xLabelVal=void 0,u.yLabelVal=void 0,u.extraText=l(p,d,f),c}},style:a.style,selectPoints:a.selectPoints,meta:{}}},{"../../plots/cartesian/axes":706,"../../plots/polar":771,"../scatter/colorscale_calc":995,"../scatter/subtypes":1012,"../scattergl":1041,"../scattergl/constants":1038,"../scatterpolar/hover":1053,"./attributes":1056,"./defaults":1057,"fast-isnumeric":197,"point-cluster":411}],1059:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../components/colorbar/attributes"),s=t("../../components/drawing/attributes").dash,l=t("../../lib/extend").extendFlat,c=n.marker,u=n.line,f=c.line;e.exports={a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},c:{valType:"data_array",editType:"calc"},sum:{valType:"number",dflt:0,min:0,editType:"calc"},mode:l({},n.mode,{dflt:"markers"}),text:l({},n.text,{}),hovertext:l({},n.hovertext,{}),line:{color:u.color,width:u.width,dash:s,shape:l({},u.shape,{values:["linear","spline"]}),smoothing:u.smoothing,editType:"calc"},connectgaps:n.connectgaps,cliponaxis:n.cliponaxis,fill:l({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:l({symbol:c.symbol,opacity:c.opacity,maxdisplayed:c.maxdisplayed,size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,line:l({width:f.width,editType:"calc"},a("marker.line")),gradient:c.gradient,editType:"calc"},a("marker"),{showscale:c.showscale,colorbar:o}),textfont:n.textfont,textposition:n.textposition,selected:n.selected,unselected:n.unselected,hoverinfo:l({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":533,"../../components/colorscale/color_attributes":540,"../../components/drawing/attributes":556,"../../lib/extend":649,"../../plots/attributes":703,"../scatter/attributes":990}],1060:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../scatter/colorscale_calc"),a=t("../scatter/arrays_to_calcdata"),o=t("../scatter/calc_selection"),s=t("../scatter/calc").calcMarkerSize,l=["a","b","c"],c={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,u,f,h,p,d,g=t._fullLayout[e.subplot].sum,m=e.sum||g,v={a:e.a,b:e.b,c:e.c};for(r=0;r"),o}function v(t,e){m.push(t._hovertitle+": "+i.tickText(t,e,"hover").text)}}},{"../../plots/cartesian/axes":706,"../scatter/hover":1001}],1064:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("../scatter/style").style,n.styleOnSelect=t("../scatter/style").styleOnSelect,n.hoverPoints=t("./hover"),n.selectPoints=t("../scatter/select"),n.eventData=t("./event_data"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend","scatter-like"],n.meta={},e.exports=n},{"../../plots/ternary":783,"../scatter/colorbar":994,"../scatter/select":1010,"../scatter/style":1011,"./attributes":1059,"./calc":1060,"./defaults":1061,"./event_data":1062,"./hover":1063,"./plot":1065}],1065:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e,r){var i=e.plotContainer;i.select(".scatterlayer").selectAll("*").remove();var a={xaxis:e.xaxis,yaxis:e.yaxis,plot:i,layerClipId:e._hasClipOnAxisFalse?e.clipIdRelative:null},o=e.layers.frontplot.select("g.scatterlayer");n(t,a,r,o)}},{"../scatter/plot":1009}],1066:[function(t,e,r){"use strict";var n=t("../scattergl/attributes"),i=t("../../plots/cartesian/constants").idRegex;function a(t){return{valType:"info_array",freeLength:!0,editType:"calc",items:{valType:"subplotid",regex:i[t],editType:"plot"}}}e.exports={dimensions:{_isLinkedToArray:"dimension",visible:{valType:"boolean",dflt:!0,editType:"calc"},label:{valType:"string",editType:"calc"},values:{valType:"data_array",editType:"calc+clearAxisTypes"},editType:"calc+clearAxisTypes"},text:n.text,marker:n.marker,xaxes:a("x"),yaxes:a("y"),diagonal:{visible:{valType:"boolean",dflt:!0,editType:"calc"},editType:"calc"},showupperhalf:{valType:"boolean",dflt:!0,editType:"calc"},showlowerhalf:{valType:"boolean",dflt:!0,editType:"calc"},selected:{marker:n.selected.marker,editType:"calc"},unselected:{marker:n.unselected.marker,editType:"calc"},opacity:n.opacity}},{"../../plots/cartesian/constants":711,"../scattergl/attributes":1037}],1067:[function(t,e,r){"use strict";var n=t("regl-line2d"),i=t("../../registry"),a=t("../../lib"),o=t("../../lib/prepare_regl"),s=t("../../plots/get_data").getModuleCalcData,l=t("../../plots/cartesian"),c=t("../../plots/cartesian/axis_ids"),u="splom";function f(t,e,r){for(var n=e.dimensions,i=r.matrixOptions.data.length,a=new Array(i),o=0,s=0;o1&&ra&&f?r._splomSubplots[y]=1:iv;for(r=0,n=0;r",maxDimensionCount:60,overdrag:45,releaseTransitionDuration:120,releaseTransitionEase:"cubic-out",scrollbarCaptureWidth:18,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,scrollbarOffset:5,scrollbarWidth:8,transitionDuration:100,transitionEase:"cubic-out",uplift:5,wrapSpacer:" ",wrapSplitCharacter:" ",cn:{table:"table",tableControlView:"table-control-view",scrollBackground:"scroll-background",yColumn:"y-column",columnBlock:"column-block",scrollAreaClip:"scroll-area-clip",scrollAreaClipRect:"scroll-area-clip-rect",columnBoundary:"column-boundary",columnBoundaryClippath:"column-boundary-clippath",columnBoundaryRect:"column-boundary-rect",columnCells:"column-cells",columnCell:"column-cell",cellRect:"cell-rect",cellText:"cell-text",cellTextHolder:"cell-text-holder",scrollbarKit:"scrollbar-kit",scrollbar:"scrollbar",scrollbarSlider:"scrollbar-slider",scrollbarGlyph:"scrollbar-glyph",scrollbarCaptureZone:"scrollbar-capture-zone"}}},{}],1080:[function(t,e,r){"use strict";var n=t("./constants"),i=t("../../lib/extend").extendFlat,a=t("fast-isnumeric");function o(t){if(Array.isArray(t)){for(var e=0,r=0;r=e||c===t.length-1)&&(n[i]=o,o.key=l++,o.firstRowIndex=s,o.lastRowIndex=c,o={firstRowIndex:null,lastRowIndex:null,rows:[]},i+=a,s=c+1,a=0);return n}e.exports=function(t,e){var r=l(e.cells.values),p=function(t){return t.slice(e.header.values.length,t.length)},d=l(e.header.values);d.length&&!d[0].length&&(d[0]=[""],d=l(d));var g=d.concat(p(r).map(function(){return c((d[0]||[""]).length)})),m=e.domain,v=Math.floor(t._fullLayout._size.w*(m.x[1]-m.x[0])),y=Math.floor(t._fullLayout._size.h*(m.y[1]-m.y[0])),x=e.header.values.length?g[0].map(function(){return e.header.height}):[n.emptyHeaderHeight],b=r.length?r[0].map(function(){return e.cells.height}):[],_=x.reduce(s,0),w=h(b,y-_+n.uplift),k=f(h(x,_),[]),M=f(w,k),A={},T=e._fullInput.columnorder.concat(p(r.map(function(t,e){return e}))),S=g.map(function(t,r){var n=Array.isArray(e.columnwidth)?e.columnwidth[Math.min(r,e.columnwidth.length-1)]:e.columnwidth;return a(n)?Number(n):1}),C=S.reduce(s,0);S=S.map(function(t){return t/C*v});var E=Math.max(o(e.header.line.width),o(e.cells.line.width)),L={key:e.index,translateX:m.x[0]*t._fullLayout._size.w,translateY:t._fullLayout._size.h*(1-m.y[1]),size:t._fullLayout._size,width:v,maxLineWidth:E,height:y,columnOrder:T,groupHeight:y,rowBlocks:M,headerRowBlocks:k,scrollY:0,cells:i({},e.cells,{values:r}),headerCells:i({},e.header,{values:g}),gdColumns:g.map(function(t){return t[0]}),gdColumnsOriginalOrder:g.map(function(t){return t[0]}),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:!1},columns:g.map(function(t,e){var r=A[t];return A[t]=(r||0)+1,{key:t+"__"+A[t],label:t,specIndex:e,xIndex:T[e],xScale:u,x:void 0,calcdata:void 0,columnWidth:S[e]}})};return L.columns.forEach(function(t){t.calcdata=L,t.x=u(t)}),L}},{"../../lib/extend":649,"./constants":1079,"fast-isnumeric":197}],1081:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat;r.splitToPanels=function(t){var e=[0,0],r=n({},t,{key:"header",type:"header",page:0,prevPages:e,currentRepaint:[null,null],dragHandle:!0,values:t.calcdata.headerCells.values[t.specIndex],rowBlocks:t.calcdata.headerRowBlocks,calcdata:n({},t.calcdata,{cells:t.calcdata.headerCells})});return[n({},t,{key:"cells1",type:"cells",page:0,prevPages:e,currentRepaint:[null,null],dragHandle:!1,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks}),n({},t,{key:"cells2",type:"cells",page:1,prevPages:e,currentRepaint:[null,null],dragHandle:!1,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks}),r]},r.splitToCells=function(t){var e=function(t){var e=t.rowBlocks[t.page],r=e?e.rows[0].rowIndex:0,n=e?r+e.rows.length:0;return[r,n]}(t);return(t.values||[]).slice(e[0],e[1]).map(function(r,n){return{keyWithinBlock:n+("string"==typeof r&&r.match(/[<$&> ]/)?"_keybuster_"+Math.random():""),key:e[0]+n,column:t,calcdata:t.calcdata,page:t.page,rowBlocks:t.rowBlocks,value:r}})}},{"../../lib/extend":649}],1082:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../plots/domain").defaults;e.exports=function(t,e,r,o){function s(r,a){return n.coerce(t,e,i,r,a)}a(e,o,s),s("columnwidth"),s("header.values"),s("header.format"),s("header.align"),s("header.prefix"),s("header.suffix"),s("header.height"),s("header.line.width"),s("header.line.color"),s("header.fill.color"),n.coerceFont(s,"header.font",n.extendFlat({},o.font)),function(t,e){for(var r=t.columnorder||[],n=t.header.values.length,i=r.slice(0,n),a=i.slice().sort(function(t,e){return t-e}),o=i.map(function(t){return a.indexOf(t)}),s=o.length;s/i),l=!o||s;t.mayHaveMarkup=o&&a.match(/[<&>]/);var c,u="string"==typeof(c=a)&&c.match(n.latexCheck);t.latex=u;var f,h,p=u?"":_(t.calcdata.cells.prefix,e,r)||"",d=u?"":_(t.calcdata.cells.suffix,e,r)||"",g=u?null:_(t.calcdata.cells.format,e,r)||null,m=p+(g?i.format(g)(t.value):t.value)+d;if(t.wrappingNeeded=!t.wrapped&&!l&&!u&&(f=b(m)),t.cellHeightMayIncrease=s||u||t.mayHaveMarkup||(void 0===f?b(m):f),t.needsConvertToTspans=t.mayHaveMarkup||t.wrappingNeeded||t.latex,t.wrappingNeeded){var v=(" "===n.wrapSplitCharacter?m.replace(/i&&n.push(a),i+=l}return n}(i,l,s);1===c.length&&(c[0]===i.length-1?c.unshift(c[0]-1):c.push(c[0]+1)),c[0]%2&&c.reverse(),e.each(function(t,e){t.page=c[e],t.scrollY=l}),e.attr("transform",function(t){return"translate(0 "+(D(t.rowBlocks,t.page)-t.scrollY)+")"}),t&&(C(t,r,e,c,n.prevPages,n,0),C(t,r,e,c,n.prevPages,n,1),v(r,t))}}function S(t,e,r,a){return function(o){var s=o.calcdata?o.calcdata:o,l=e.filter(function(t){return s.key===t.key}),c=r||s.scrollbarState.dragMultiplier;s.scrollY=void 0===a?s.scrollY+c*i.event.dy:a;var u=l.selectAll("."+n.cn.yColumn).selectAll("."+n.cn.columnBlock).filter(k);T(t,u,l)}}function C(t,e,r,n,i,a,o){n[o]!==i[o]&&(clearTimeout(a.currentRepaint[o]),a.currentRepaint[o]=setTimeout(function(){var a=r.filter(function(t,e){return e===o&&n[e]!==i[e]});y(t,e,a,r),i[o]=n[o]}))}function E(t,e,r){return function(){var a=i.select(e.parentNode);a.each(function(t){var e=t.fragments;a.selectAll("tspan.line").each(function(t,r){e[r].width=this.getComputedTextLength()});var r,i,o=e[e.length-1].width,s=e.slice(0,-1),l=[],c=0,u=t.column.columnWidth-2*n.cellPad;for(t.value="";s.length;)c+(i=(r=s.shift()).width+o)>u&&(t.value+=l.join(n.wrapSpacer)+n.lineBreaker,l=[],c=0),l.push(r.text),c+=i;c&&(t.value+=l.join(n.wrapSpacer)),t.wrapped=!0}),a.selectAll("tspan.line").remove(),x(a.select("."+n.cn.cellText),r,t),i.select(e.parentNode.parentNode).call(P)}}function L(t,e,r,a,o){return function(){if(!o.settledY){var s=i.select(e.parentNode),l=R(o),c=o.key-l.firstRowIndex,u=l.rows[c].rowHeight,f=o.cellHeightMayIncrease?e.parentNode.getBoundingClientRect().height+2*n.cellPad:u,h=Math.max(f,u);h-l.rows[c].rowHeight&&(l.rows[c].rowHeight=h,t.selectAll("."+n.cn.columnCell).call(P),T(null,t.filter(k),0),v(r,a,!0)),s.attr("transform",function(){var t=this.parentNode.getBoundingClientRect(),e=i.select(this.parentNode).select("."+n.cn.cellRect).node().getBoundingClientRect(),r=this.transform.baseVal.consolidate(),a=e.top-t.top+(r?r.matrix.f:n.cellPad);return"translate("+z(o,i.select(this.parentNode).select("."+n.cn.cellTextHolder).node().getBoundingClientRect().width)+" "+a+")"}),o.settledY=!0}}}function z(t,e){switch(t.align){case"left":return n.cellPad;case"right":return t.column.columnWidth-(e||0)-n.cellPad;case"center":return(t.column.columnWidth-(e||0))/2;default:return n.cellPad}}function P(t){t.attr("transform",function(t){var e=t.rowBlocks[0].auxiliaryBlocks.reduce(function(t,e){return t+O(e,1/0)},0);return"translate(0 "+(O(R(t),t.key)+e)+")"}).selectAll("."+n.cn.cellRect).attr("height",function(t){return(e=R(t),r=t.key,e.rows[r-e.firstRowIndex]).rowHeight;var e,r})}function D(t,e){for(var r=0,n=e-1;n>=0;n--)r+=I(t[n]);return r}function O(t,e){for(var r=0,n=0;n0){var y,x,b,_,w,k=t.xa,M=t.ya;"h"===h.orientation?(w=e,y="y",b=M,x="x",_=k):(w=r,y="x",b=k,x="y",_=M);var A=f[t.index];if(w>=A.span[0]&&w<=A.span[1]){var T=n.extendFlat({},t),S=_.c2p(w,!0),C=o.getKdeValue(A,h,w),E=o.getPositionOnKdePath(A,h,S),L=b._offset,z=b._length;T[y+"0"]=E[0],T[y+"1"]=E[1],T[x+"0"]=T[x+"1"]=S,T[x+"Label"]=x+": "+i.hoverLabelText(_,w)+", "+f[0].t.labels.kde+" "+C.toFixed(3),T.spikeDistance=v[0].spikeDistance;var P=y+"Spike";T[P]=v[0][P],v[0].spikeDistance=void 0,v[0][P]=void 0,m.push(T),(u={stroke:t.color})[y+"1"]=n.constrain(L+E[0],L,L+z),u[y+"2"]=n.constrain(L+E[1],L,L+z),u[x+"1"]=u[x+"2"]=_._offset+S}}}-1!==p.indexOf("points")&&(c=a.hoverOnPoints(t,e,r));var D=l.selectAll(".violinline-"+h.uid).data(u?[0]:[]);return D.enter().append("line").classed("violinline-"+h.uid,!0).attr("stroke-width",1.5),D.exit().remove(),D.attr(u),"closest"===s?c?[c]:m:c?(m.push(c),m):m}},{"../../lib":660,"../../plots/cartesian/axes":706,"../box/hover":816,"./helpers":1088}],1090:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),setPositions:t("./set_positions"),plot:t("./plot"),style:t("./style"),styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../box/select"),moduleType:"trace",name:"violin",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","oriented","box-violin","showLegend","violinLayout","zoomScale"],meta:{}}},{"../../plots/cartesian":717,"../box/select":821,"../scatter/style":1011,"./attributes":1085,"./calc":1086,"./defaults":1087,"./hover":1089,"./layout_attributes":1091,"./layout_defaults":1092,"./plot":1093,"./set_positions":1094,"./style":1095}],1091:[function(t,e,r){"use strict";var n=t("../box/layout_attributes"),i=t("../../lib").extendFlat;e.exports={violinmode:i({},n.boxmode,{}),violingap:i({},n.boxgap,{}),violingroupgap:i({},n.boxgroupgap,{})}},{"../../lib":660,"../box/layout_attributes":818}],1092:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes"),a=t("../box/layout_defaults");e.exports=function(t,e,r){a._supply(t,e,r,function(r,a){return n.coerce(t,e,i,r,a)},"violin")}},{"../../lib":660,"../box/layout_defaults":819,"./layout_attributes":1091}],1093:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../components/drawing"),o=t("../box/plot"),s=t("../scatter/line_points"),l=t("./helpers");e.exports=function(t,e,r,c){var u=t._fullLayout,f=e.xaxis,h=e.yaxis;function p(t){var e=s(t,{xaxis:f,yaxis:h,connectGaps:!0,baseTolerance:.75,shape:"spline",simplify:!0});return a.smoothopen(e[0],1)}var d=c.selectAll("g.trace.violins").data(r,function(t){return t[0].trace.uid});d.enter().append("g").attr("class","trace violins"),d.exit().remove(),d.order(),d.each(function(t){var r=t[0],a=r.t,s=r.trace,c=n.select(this);e.isRangePlot||(r.node3=c);var d=u._numViolins,g="group"===u.violinmode&&d>1,m=1-u.violingap,v=a.bdPos=a.dPos*m*(1-u.violingroupgap)/(g?d:1),y=a.bPos=g?2*a.dPos*((a.num+.5)/d-.5)*m:0;if(a.wHover=a.dPos*(g?m/d:1),!0!==s.visible||a.empty)n.select(this).remove();else{var x=e[a.valLetter+"axis"],b=e[a.posLetter+"axis"],_="both"===s.side,w=_||"positive"===s.side,k=_||"negative"===s.side,M=s.box&&s.box.visible,A=s.meanline&&s.meanline.visible,T=u._violinScaleGroupStats[s.scalegroup],S=c.selectAll("path.violin").data(i.identity);if(S.enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","violin"),S.exit().remove(),S.each(function(t){var e,r,i,o,l,c,u,f,h=n.select(this),d=t.density,g=d.length,m=t.pos+y,M=b.c2p(m);switch(s.scalemode){case"width":e=T.maxWidth/v;break;case"count":e=T.maxWidth/v*(T.maxCount/t.pts.length)}if(w){for(u=new Array(g),l=0;la&&(a=u,o=c)}}return a?i(o):s};case"rms":return function(t,e){for(var r=0,a=0,o=0;o":return function(t){return h(t)>s};case">=":return function(t){return h(t)>=s};case"[]":return function(t){var e=h(t);return e>=s[0]&&e<=s[1]};case"()":return function(t){var e=h(t);return e>s[0]&&e=s[0]&&es[0]&&e<=s[1]};case"][":return function(t){var e=h(t);return e<=s[0]||e>=s[1]};case")(":return function(t){var e=h(t);return es[1]};case"](":return function(t){var e=h(t);return e<=s[0]||e>s[1]};case")[":return function(t){var e=h(t);return e=s[1]};case"{}":return function(t){return-1!==s.indexOf(h(t))};case"}{":return function(t){return-1===s.indexOf(h(t))}}}(r,a.getDataToCoordFunc(t,e,s,i),h),x={},b={},_=0;d?(m=function(t){x[t.astr]=n.extendDeep([],t.get()),t.set(new Array(f))},v=function(t,e){var r=x[t.astr][e];t.get()[e]=r}):(m=function(t){x[t.astr]=n.extendDeep([],t.get()),t.set([])},v=function(t,e){var r=x[t.astr][e];t.get().push(r)}),M(m);for(var w=o(e.transforms,r),k=0;k1?"%{group} (%{trace})":"%{group}");var l=t.styles,c=o.styles=[];if(l)for(a=0;aMath.abs(e)){u.rotate(o,0,0,-t*a*Math.PI*d.rotateSpeed/window.innerWidth)}else{var s=d.zoomSpeed*i*e/window.innerHeight*(o-u.lastT())/100;u.pan(o,0,0,f*(Math.exp(s)-1))}},true);return d}},{"3d-view":43,"has-passive-events":379,"mouse-change":402,"mouse-event-offset":403,"mouse-wheel":405,"right-now":465}],43:[function(t,e,r){"use strict";e.exports=u;var n=t("turntable-camera-controller");var a=t("orbit-camera-controller");var i=t("matrix-camera-controller");function o(t,e){this._controllerNames=Object.keys(t);this._controllerList=this._controllerNames.map(function(e){return t[e]});this._mode=e;this._active=t[e];if(!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}var s=o.prototype;var l=[["flush",1],["idle",1],["lookAt",4],["rotate",4],["pan",4],["translate",4],["setMatrix",2],["setDistanceLimits",2],["setDistance",2]];l.forEach(function(t){var e=t[0];var r=[];for(var n=0;n halfCharStep + halfCharWidth ||\n\t\t\t\t\tfloor(uv.x) < halfCharStep - halfCharWidth) return;\n\n\t\t\t\tuv += charId * charStep;\n\t\t\t\tuv = uv / atlasSize;\n\n\t\t\t\tvec4 color = fontColor;\n\t\t\t\tvec4 mask = texture2D(atlas, uv);\n\n\t\t\t\tfloat maskY = lightness(mask);\n\t\t\t\t// float colorY = lightness(color);\n\t\t\t\tcolor.a *= maskY;\n\t\t\t\tcolor.a *= opacity;\n\n\t\t\t\t// color.a += .1;\n\n\t\t\t\t// antialiasing, see yiq color space y-channel formula\n\t\t\t\t// color.rgb += (1. - color.rgb) * (1. - mask.rgb);\n\n\t\t\t\tgl_FragColor = color;\n\t\t\t}"});var n={};return{regl:e,draw:r,atlas:n}};w.prototype.update=function t(e){var r=this;if(typeof e==="string"){e={text:e}}else if(!e){return}e=a(e,{position:"position positions coord coords coordinates",font:"font fontFace fontface typeface cssFont css-font family fontFamily",fontSize:"fontSize fontsize size font-size",text:"text texts chars characters value values symbols",align:"align alignment textAlign textbaseline",baseline:"baseline textBaseline textbaseline",direction:"dir direction textDirection",color:"color colour fill fill-color fillColor textColor textcolor",kerning:"kerning kern",range:"range dataBox",viewport:"vp viewport viewBox viewbox viewPort",opacity:"opacity alpha transparency visible visibility opaque",offset:"offset positionOffset padding shift indent indentation"},true);if(e.opacity!=null){if(Array.isArray(e.opacity)){this.opacity=e.opacity.map(function(t){return parseFloat(t)})}else{this.opacity=parseFloat(e.opacity)}}if(e.viewport!=null){this.viewport=f(e.viewport);if(w.normalViewport){this.viewport.y=this.canvas.height-this.viewport.y-this.viewport.height}this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]}if(this.viewport==null){this.viewport={x:0,y:0,width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight};this.viewportArray=[this.viewport.x,this.viewport.y,this.viewport.width,this.viewport.height]}if(e.kerning!=null){this.kerning=e.kerning}if(e.offset!=null){if(typeof e.offset==="number"){e.offset=[e.offset,0]}this.positionOffset=y(e.offset)}if(e.direction){this.direction=e.direction}if(e.range){this.range=e.range;this.scale=[1/(e.range[2]-e.range[0]),1/(e.range[3]-e.range[1])];this.translate=[-e.range[0],-e.range[1]]}if(e.scale){this.scale=e.scale}if(e.translate){this.translate=e.translate}if(!this.scale){this.scale=[1/this.viewport.width,1/this.viewport.height]}if(!this.translate){this.translate=[0,0]}if(!this.font.length&&!e.font){e.font=w.baseFontSize+"px sans-serif"}var i=false,o=false;if(e.font){(Array.isArray(e.font)?e.font:[e.font]).forEach(function(t,e){if(typeof t==="string"){try{t=n.parse(t)}catch(e){t=n.parse(w.baseFontSize+"px "+t)}}else{t=n.parse(n.stringify(t))}var a=n.stringify({size:w.baseFontSize,family:t.family,stretch:b?t.stretch:undefined,variant:t.variant,weight:t.weight,style:t.style});var s=p(t.size);var l=Math.round(s[0]*d(s[1]));if(l!==r.fontSize[e]){o=true;r.fontSize[e]=l}if(!r.font[e]||a!=r.font[e].baseString){i=true;r.font[e]=w.fonts[a];if(!r.font[e]){var u=t.family.join(", ");var c=[t.style];if(t.style!=t.variant){c.push(t.variant)}if(t.variant!=t.weight){c.push(t.weight)}if(b&&t.weight!=t.stretch){c.push(t.stretch)}r.font[e]={baseString:a,family:u,weight:t.weight,stretch:t.stretch,style:t.style,variant:t.variant,width:{},kerning:{},metrics:m(u,{origin:"top",fontSize:w.baseFontSize,fontStyle:c.join(" ")})};w.fonts[a]=r.font[e]}}})}if(i||o){this.font.forEach(function(t,a){var i=n.stringify({size:r.fontSize[a],family:t.family,stretch:b?t.stretch:undefined,variant:t.variant,weight:t.weight,style:t.style});r.fontAtlas[a]=r.shader.atlas[i];if(!r.fontAtlas[a]){var o=t.metrics;r.shader.atlas[i]=r.fontAtlas[a]={fontString:i,step:Math.ceil(r.fontSize[a]*o.bottom*.5)*2,em:r.fontSize[a],cols:0,rows:0,height:0,width:0,chars:[],ids:{},texture:r.regl.texture()}}if(e.text==null){e.text=r.text}})}if(typeof e.text==="string"&&e.position&&e.position.length>2){var s=Array(e.position.length*.5);for(var h=0;h2){var k=!e.position[0].length;var M=c.mallocFloat(this.count*2);for(var A=0,T=0;A1?r.align[e]:r.align[0];if(typeof n==="number"){return n}switch(n){case"right":case"end":return-t;case"center":case"centre":case"middle":return-t*.5}return 0})}if(this.baseline==null&&e.baseline==null){e.baseline=0}if(e.baseline!=null){this.baseline=e.baseline;if(!Array.isArray(this.baseline)){this.baseline=[this.baseline]}this.baselineOffset=this.baseline.map(function(t,e){var n=(r.font[e]||r.font[0]).metrics;var a=0;a+=n.bottom*.5;if(typeof t==="number"){a+=t-n.baseline}else{a+=-n[t]}if(!w.normalViewport){a*=-1}return a})}if(e.color!=null){if(!e.color){e.color="transparent"}if(typeof e.color==="string"||!isNaN(e.color)){this.color=l(e.color,"uint8")}else{var G;if(typeof e.color[0]==="number"&&e.color.length>this.counts.length){var W=e.color.length;G=c.mallocUint8(W);var Y=(e.color.subarray||e.color.slice).bind(e.color);for(var X=0;X4||this.baselineOffset.length>1||this.align&&this.align.length>1||this.fontAtlas.length>1||this.positionOffset.length>2;if(J){var K=Math.max(this.position.length*.5||0,this.color.length*.25||0,this.baselineOffset.length||0,this.alignOffset.length||0,this.font.length||0,this.opacity.length||0,this.positionOffset.length*.5||0);this.batch=Array(K);for(var Q=0;Q1?r.counts[Q]:r.counts[0],offset:r.textOffsets.length>1?r.textOffsets[Q]:r.textOffsets[0],color:!r.color?[0,0,0,255]:r.color.length<=4?r.color:r.color.subarray(Q*4,Q*4+4),opacity:Array.isArray(r.opacity)?r.opacity[Q]:r.opacity,baseline:r.baselineOffset[Q]!=null?r.baselineOffset[Q]:r.baselineOffset[0],align:!r.align?0:r.alignOffset[Q]!=null?r.alignOffset[Q]:r.alignOffset[0],atlas:r.fontAtlas[Q]||r.fontAtlas[0],positionOffset:r.positionOffset.length>2?r.positionOffset.subarray(Q*2,Q*2+2):r.positionOffset}}}else{if(this.count){this.batch=[{count:this.count,offset:0,color:this.color||[0,0,0,255],opacity:Array.isArray(this.opacity)?this.opacity[0]:this.opacity,baseline:this.baselineOffset[0],align:this.alignOffset?this.alignOffset[0]:0,atlas:this.fontAtlas[0],positionOffset:this.positionOffset}]}else{this.batch=[]}}}};w.prototype.destroy=function t(){};w.prototype.kerning=true;w.prototype.position={constant:new Float32Array(2)};w.prototype.translate=null;w.prototype.scale=null;w.prototype.font=null;w.prototype.text="";w.prototype.positionOffset=[0,0];w.prototype.opacity=1;w.prototype.color=new Uint8Array([0,0,0,255]);w.prototype.alignOffset=[0,0];w.normalViewport=false;w.maxAtlasSize=1024;w.atlasCanvas=document.createElement("canvas");w.atlasContext=w.atlasCanvas.getContext("2d",{alpha:false});w.baseFontSize=64;w.fonts={};function k(t){return typeof t==="function"&&t._gl&&t.prop&&t.texture&&t.buffer}e.exports=w},{"color-normalize":45,"css-font":126,"detect-kerning":150,"es6-weak-map":208,"flatten-vertex-data":48,"font-atlas":217,"font-measure":218,"gl-util/context":304,"is-plain-obj":390,"object-assign":421,"parse-rect":426,"parse-unit":428,"pick-by-alias":432,regl:463,"to-px":501,"typedarray-pool":507}],45:[function(t,e,r){"use strict";var n=t("color-rgba");var a=t("clamp");var i=t("dtype");e.exports=function t(e,r){if(r==="float"||!r)r="array";if(r==="uint")r="uint8";if(r==="uint_clamped")r="uint8_clamped";var o=i(r);var s=new o(4);if(e instanceof o){if(Array.isArray(e)){return e.slice()}s.set(e);return s}var t=r!=="uint8"&&r!=="uint8_clamped";if(e instanceof Uint8Array||e instanceof Uint8ClampedArray){s[0]=e[0];s[1]=e[1];s[2]=e[2];s[3]=e[3]!=null?e[3]:255;if(t){s[0]/=255;s[1]/=255;s[2]/=255;s[3]/=255}return s}if(!e.length||typeof e==="string"){e=n(e);e[0]/=255;e[1]/=255;e[2]/=255}if(!t){s[0]=a(Math.round(e[0]*255),0,255);s[1]=a(Math.round(e[1]*255),0,255);s[2]=a(Math.round(e[2]*255),0,255);s[3]=e[3]==null?255:a(Math.floor(e[3]*255),0,255)}else{s[0]=e[0];s[1]=e[1];s[2]=e[2];s[3]=e[3]!=null?e[3]:1}return s}},{clamp:102,"color-rgba":47,dtype:153}],46:[function(t,e,r){(function(r){"use strict";var n=t("color-name");var a=t("is-plain-obj");var i=t("defined");e.exports=s;var o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function s(t){var e,s=[],l=1,u;if(typeof t==="string"){if(n[t]){s=n[t].slice();u="rgb"}else if(t==="transparent"){l=0;u="rgb";s=[0,0,0]}else if(/^#[A-Fa-f0-9]+$/.test(t)){var c=t.slice(1);var f=c.length;var h=f<=4;l=1;if(h){s=[parseInt(c[0]+c[0],16),parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16)];if(f===4){l=parseInt(c[3]+c[3],16)/255}}else{s=[parseInt(c[0]+c[1],16),parseInt(c[2]+c[3],16),parseInt(c[4]+c[5],16)];if(f===8){l=parseInt(c[6]+c[7],16)/255}}if(!s[0])s[0]=0;if(!s[1])s[1]=0;if(!s[2])s[2]=0;u="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var p=e[1];var c=p.replace(/a$/,"");u=c;var f=c==="cmyk"?4:c==="gray"?1:3;s=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t)){if(e===f)return parseFloat(t)/100;if(c==="rgb")return parseFloat(t)*255/100;return parseFloat(t)}else if(c[e]==="h"){if(/deg$/.test(t)){return parseFloat(t)}else if(o[t]!==undefined){return o[t]}}return parseFloat(t)});if(p===c)s.push(1);l=s[f]===undefined?1:s[f];s=s.slice(0,f)}else if(t.length>10&&/[0-9](?:\s|\/)/.test(t)){s=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)});u=t.match(/([a-z])/ig).join("").toLowerCase()}}else if(!isNaN(t)){u="rgb";s=[t>>>16,(t&65280)>>>8,t&255]}else if(a(t)){var d=i(t.r,t.red,t.R,null);if(d!==null){u="rgb";s=[d,i(t.g,t.green,t.G),i(t.b,t.blue,t.B)]}else{u="hsl";s=[i(t.h,t.hue,t.H),i(t.s,t.saturation,t.S),i(t.l,t.lightness,t.L,t.b,t.brightness)]}l=i(t.a,t.alpha,t.opacity,1);if(t.opacity!=null)l/=100}else if(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t)){s=[t[0],t[1],t[2]];u="rgb";l=t.length===4?t[3]:1}return{space:u,values:s,alpha:l}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"color-name":106,defined:148,"is-plain-obj":390}],47:[function(t,e,r){"use strict";var n=t("color-parse");var a=t("color-space/hsl");var i=t("clamp");e.exports=function t(e){var r,o,s;var l=n(e);if(!l.space)return[];r=Array(3);r[0]=i(l.values[0],0,255);r[1]=i(l.values[1],0,255);r[2]=i(l.values[2],0,255);if(l.space[0]==="h"){r=a.rgb(r)}r.push(i(l.alpha,0,1));return r}},{clamp:102,"color-parse":46,"color-space/hsl":110}],48:[function(t,e,r){var n=t("dtype");e.exports=a;function a(t,e,r){if(!t)throw new TypeError("must specify data as first parameter");r=+(r||0)|0;if(Array.isArray(t)&&(t[0]&&typeof t[0][0]==="number")){var a=t[0].length;var i=t.length*a;var o,s,l,u;if(!e||typeof e==="string"){e=new(n(e||"float32"))(i+r)}var c=e.length-r;if(i!==c){throw new Error("source length "+i+" ("+a+"x"+t.length+")"+" does not match destination length "+c)}for(o=0,l=r;o0;--t){f(a*=.99);h();c(a);h()}function u(){var t=e.min(n,function(t){return(o[1]-(t.length-1)*i)/e.sum(t,m)});n.forEach(function(e){e.forEach(function(e,r){e.y=r;e.dy=e.value*t})});l.forEach(function(e){e.dy=e.value*t})}function c(t){n.forEach(function(n){n.forEach(function(n){if(n.targetLinks.length){var a=e.sum(n.targetLinks,r)/e.sum(n.targetLinks,m);n.y+=(a-g(n))*t}})});function r(t){return g(t.source)*t.value}}function f(t){n.slice().reverse().forEach(function(n){n.forEach(function(n){if(n.sourceLinks.length){var a=e.sum(n.sourceLinks,r)/e.sum(n.sourceLinks,m);n.y+=(a-g(n))*t}})});function r(t){return g(t.target)*t.value}}function h(){n.forEach(function(t){var e,r,n=0,a=t.length,s;t.sort(p);for(s=0;s0)e.y+=r;n=e.y+e.dy+i}r=n-i-o[1];if(r>0){n=e.y-=r;for(s=a-2;s>=0;--s){e=t[s];r=e.y+e.dy+i-n;if(r>0)e.y-=r;n=e.y}}})}function p(t,e){return t.y-e.y}}function v(){s.forEach(function(r){r.sourceLinks.sort(e);r.targetLinks.sort(t)});s.forEach(function(t){var e=0,r=0;t.sourceLinks.forEach(function(t){t.sy=e;e+=t.dy});t.targetLinks.forEach(function(t){t.ty=r;r+=t.dy})});function t(t,e){return t.source.y-e.source.y||t.originalIndex-e.originalIndex}function e(t,e){return t.target.y-e.target.y||t.originalIndex-e.originalIndex}}function g(t){return t.y+t.dy/2}function m(t){return t.value}return t};t.sankey=a;Object.defineProperty(t,"__esModule",{value:true})})},{"d3-array":139,"d3-collection":140,"d3-interpolate":144}],50:[function(t,e,r){"use strict";var n=typeof WeakMap==="undefined"?t("weak-map"):WeakMap;var a=t("gl-buffer");var i=t("gl-vao");var o=new n;function s(t){var e=o.get(t);var r=e&&(e._triangleBuffer.handle||e._triangleBuffer.buffer);if(!r||!t.isBuffer(r)){var n=a(t,new Float32Array([-1,-1,-1,4,4,-1]));e=i(t,[{buffer:n,type:t.FLOAT,size:2}]);e._triangleBuffer=n;o.set(t,e)}e.bind();t.drawArrays(t.TRIANGLES,0,3);e.unbind()}e.exports=s},{"gl-buffer":230,"gl-vao":308,"weak-map":517}],51:[function(t,e,r){e.exports=n;function n(t){var e=0;var r=0;var n=0;var a=0;return t.map(function(t){t=t.slice();var i=t[0];var o=i.toUpperCase();if(i!=o){t[0]=o;switch(i){case"a":t[6]+=n;t[7]+=a;break;case"v":t[1]+=a;break;case"h":t[1]+=n;break;default:for(var s=1;sa)a=t[o];if(t[o]=0){var s=a.indexOf("\n",o+1);a=a.substring(s+1)}this.stack=a}}};i.inherits(f.AssertionError,Error);function d(t,e){if(typeof t==="string"){return t.length=0;f--){if(l[f]!==u[f])return false}for(f=l.length-1;f>=0;f--){c=l[f];if(!x(t[c],e[c],r,n))return false}return true}f.notDeepEqual=function t(e,r,n){if(x(e,r,false)){m(e,r,n,"notDeepEqual",f.notDeepEqual)}};f.notDeepStrictEqual=w;function w(t,e,r){if(x(t,e,true)){m(t,e,r,"notDeepStrictEqual",w)}}f.strictEqual=function t(e,r,n){if(e!==r){m(e,r,n,"===",f.strictEqual)}};f.notStrictEqual=function t(e,r,n){if(e===r){m(e,r,n,"!==",f.notStrictEqual)}};function k(t,e){if(!t||!e){return false}if(Object.prototype.toString.call(e)=="[object RegExp]"){return e.test(t)}try{if(t instanceof e){return true}}catch(t){}if(Error.isPrototypeOf(e)){return false}return e.call({},t)===true}function M(t){var e;try{t()}catch(t){e=t}return e}function A(t,e,r,n){var a;if(typeof e!=="function"){throw new TypeError('"block" argument must be a function')}if(typeof r==="string"){n=r;r=null}a=M(e);n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:".");if(t&&!a){m(a,r,"Missing expected exception"+n)}var o=typeof n==="string";var s=!t&&i.isError(a);var l=!t&&a&&!r;if(s&&o&&k(a,r)||l){m(a,r,"Got unwanted exception"+n)}if(t&&a&&r&&!k(a,r)||!t&&a){throw a}}f.throws=function(t,e,r){A(true,t,e,r)};f.doesNotThrow=function(t,e,r){A(false,t,e,r)};f.ifError=function(t){if(t)throw t};var T=Object.keys||function(t){var e=[];for(var r in t){if(o.call(t,r))e.push(r)}return e}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"util/":514}],60:[function(t,e,r){e.exports=function t(e){return atob(e)}},{}],61:[function(t,e,r){"use strict";e.exports=i;var n=t("robust-linear-solve");function a(t){var e=0;for(var r=0;r0){throw new Error("Invalid string. Length must be a multiple of 4")}return t[e-2]==="="?2:t[e-1]==="="?1:0}function c(t){return t.length*3/4-u(t)}function f(t){var e,r,n,o,s;var l=t.length;o=u(t);s=new i(l*3/4-o);r=o>0?l-4:l;var c=0;for(e=0;e>16&255;s[c++]=n>>8&255;s[c++]=n&255}if(o===2){n=a[t.charCodeAt(e)]<<2|a[t.charCodeAt(e+1)]>>4;s[c++]=n&255}else if(o===1){n=a[t.charCodeAt(e)]<<10|a[t.charCodeAt(e+1)]<<4|a[t.charCodeAt(e+2)]>>2;s[c++]=n>>8&255;s[c++]=n&255}return s}function h(t){return n[t>>18&63]+n[t>>12&63]+n[t>>6&63]+n[t&63]}function p(t,e,r){var n;var a=[];for(var i=e;iu?u:l+s))}if(a===1){e=t[r-1];i+=n[e>>2];i+=n[e<<4&63];i+="=="}else if(a===2){e=(t[r-2]<<8)+t[r-1];i+=n[e>>10];i+=n[e>>4&63];i+=n[e<<2&63];i+="="}o.push(i);return o.join("")}},{}],63:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=a;function a(t,e){return n(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))}},{"./lib/rationalize":73}],64:[function(t,e,r){"use strict";e.exports=n;function n(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],65:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=a;function a(t,e){return n(t[0].mul(e[1]),t[1].mul(e[0]))}},{"./lib/rationalize":73}],66:[function(t,e,r){"use strict";var n=t("./is-rat");var a=t("./lib/is-bn");var i=t("./lib/num-to-bn");var o=t("./lib/str-to-bn");var s=t("./lib/rationalize");var l=t("./div");e.exports=u;function u(t,e){if(n(t)){if(e){return l(t,u(e))}return[t[0].clone(),t[1].clone()]}var r=0;var c,f;if(a(t)){c=t.clone()}else if(typeof t==="string"){c=o(t)}else if(t===0){return[i(0),i(1)]}else if(t===Math.floor(t)){c=i(t)}else{while(t!==Math.floor(t)){t=t*Math.pow(2,256);r-=256}c=i(t)}if(n(e)){c.mul(e[1]);f=e[0].clone()}else if(a(e)){f=e.clone()}else if(typeof e==="string"){f=o(e)}else if(!e){f=i(1)}else if(e===Math.floor(e)){f=i(e)}else{while(e!==Math.floor(e)){e=e*Math.pow(2,256);r+=256}f=i(e)}if(r>0){c=c.ushln(r)}else if(r<0){f=f.ushln(-r)}return s(c,f)}},{"./div":65,"./is-rat":67,"./lib/is-bn":71,"./lib/num-to-bn":72,"./lib/rationalize":73,"./lib/str-to-bn":74}],67:[function(t,e,r){"use strict";var n=t("./lib/is-bn");e.exports=a;function a(t){return Array.isArray(t)&&t.length===2&&n(t[0])&&n(t[1])}},{"./lib/is-bn":71}],68:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=a;function a(t){return t.cmp(new n(0))}},{"bn.js":82}],69:[function(t,e,r){"use strict";var n=t("./bn-sign");e.exports=a;function a(t){var e=t.length;var r=t.words;var a=0;if(e===1){a=r[0]}else if(e===2){a=r[0]+r[1]*67108864}else{for(var i=0;i20){return 52}return r+32}},{"bit-twiddle":80,"double-bits":151}],71:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=a;function a(t){return t&&typeof t==="object"&&Boolean(t.words)}},{"bn.js":82}],72:[function(t,e,r){"use strict";var n=t("bn.js");var a=t("double-bits");e.exports=i;function i(t){var e=a.exponent(t);if(e<52){return new n(t)}else{return new n(t*Math.pow(2,52-e)).ushln(e-52)}}},{"bn.js":82,"double-bits":151}],73:[function(t,e,r){"use strict";var n=t("./num-to-bn");var a=t("./bn-sign");e.exports=i;function i(t,e){var r=a(t);var i=a(e);if(r===0){return[n(0),n(1)]}if(i===0){return[n(0),n(0)]}if(i<0){t=t.neg();e=e.neg()}var o=t.gcd(e);if(o.cmpn(1)){return[t.div(o),e.div(o)]}return[t,e]}},{"./bn-sign":68,"./num-to-bn":72}],74:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=a;function a(t){return new n(t)}},{"bn.js":82}],75:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=a;function a(t,e){return n(t[0].mul(e[0]),t[1].mul(e[1]))}},{"./lib/rationalize":73}],76:[function(t,e,r){"use strict";var n=t("./lib/bn-sign");e.exports=a;function a(t){return n(t[0])*n(t[1])}},{"./lib/bn-sign":68}],77:[function(t,e,r){"use strict";var n=t("./lib/rationalize");e.exports=a;function a(t,e){return n(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))}},{"./lib/rationalize":73}],78:[function(t,e,r){"use strict";var n=t("./lib/bn-to-num");var a=t("./lib/ctz");e.exports=i;function i(t){var e=t[0];var r=t[1];if(e.cmpn(0)===0){return 0}var i=e.abs().divmod(r.abs());var o=i.div;var s=n(o);var l=i.mod;var u=e.negative!==r.negative?-1:1;if(l.cmpn(0)===0){return u*s}if(s){var c=a(s)+4;var f=n(l.ushln(c).divRound(r));return u*(s+f*Math.pow(2,-c))}else{var h=r.bitLength()-l.bitLength()+53;var f=n(l.ushln(h).divRound(r));if(h<1023){return u*f*Math.pow(2,-h)}f*=Math.pow(2,-1023);return u*f*Math.pow(2,1023-h)}}},{"./lib/bn-to-num":69,"./lib/ctz":70}],79:[function(t,e,r){"use strict";function n(t,e,r,n,a,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",a?".get(m)":"[m]"];if(i){if(e.indexOf("c")<0){o.push(";if(x===y){return m}else if(x<=y){")}else{o.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){")}}else{o.push(";if(",e,"){i=m;")}if(r){o.push("l=m+1}else{h=m-1}")}else{o.push("h=m-1}else{l=m+1}")}o.push("}");if(i){o.push("return -1};")}else{o.push("return i};")}return o.join("")}function a(t,e,r,a){var i=new Function([n("A","x"+t+"y",e,["y"],false,a),n("B","x"+t+"y",e,["y"],true,a),n("P","c(x,y)"+t+"0",e,["y","c"],false,a),n("Q","c(x,y)"+t+"0",e,["y","c"],true,a),"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 i()}e.exports={ge:a(">=",false,"GE"),gt:a(">",false,"GT"),lt:a("<",true,"LT"),le:a("<=",true,"LE"),eq:a("-",true,"EQ",true)}},{}],80:[function(t,e,r){"use strict";"use restrict";var n=32;r.INT_BITS=n;r.INT_MAX=2147483647;r.INT_MIN=-1<0)-(t<0)};r.abs=function(t){var e=t>>n-1;return(t^e)-e};r.min=function(t,e){return e^(t^e)&-(t65535)<<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;return 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){t=t-(t>>>1&1431655765);t=(t&858993459)+(t>>>2&858993459);return(t+(t>>>4)&252645135)*16843009>>>24};function a(t){var e=32;t&=-t;if(t)e--;if(t&65535)e-=16;if(t&16711935)e-=8;if(t&252645135)e-=4;if(t&858993459)e-=2;if(t&1431655765)e-=1;return e}r.countTrailingZeros=a;r.nextPow2=function(t){t+=t===0;--t;t|=t>>>1;t|=t>>>2;t|=t>>>4;t|=t>>>8;t|=t>>>16;return t+1};r.prevPow2=function(t){t|=t>>>1;t|=t>>>2;t|=t>>>4;t|=t>>>8;t|=t>>>16;return t-(t>>>1)};r.parity=function(t){t^=t>>>16;t^=t>>>8;t^=t>>>4;t&=15;return 27030>>>t&1};var i=new Array(256);(function(t){for(var e=0;e<256;++e){var r=e,n=e,a=7;for(r>>>=1;r;r>>>=1){n<<=1;n|=r&1;--a}t[e]=n<>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]};r.interleave2=function(t,e){t&=65535;t=(t|t<<8)&16711935;t=(t|t<<4)&252645135;t=(t|t<<2)&858993459;t=(t|t<<1)&1431655765;e&=65535;e=(e|e<<8)&16711935;e=(e|e<<4)&252645135;e=(e|e<<2)&858993459;e=(e|e<<1)&1431655765;return t|e<<1};r.deinterleave2=function(t,e){t=t>>>e&1431655765;t=(t|t>>>1)&858993459;t=(t|t>>>2)&252645135;t=(t|t>>>4)&16711935;t=(t|t>>>16)&65535;return t<<16>>16};r.interleave3=function(t,e,r){t&=1023;t=(t|t<<16)&4278190335;t=(t|t<<8)&251719695;t=(t|t<<4)&3272356035;t=(t|t<<2)&1227133513;e&=1023;e=(e|e<<16)&4278190335;e=(e|e<<8)&251719695;e=(e|e<<4)&3272356035;e=(e|e<<2)&1227133513;t|=e<<1;r&=1023;r=(r|r<<16)&4278190335;r=(r|r<<8)&251719695;r=(r|r<<4)&3272356035;r=(r|r<<2)&1227133513;return t|r<<2};r.deinterleave3=function(t,e){t=t>>>e&1227133513;t=(t|t>>>2)&3272356035;t=(t|t>>>4)&251719695;t=(t|t>>>8)&4278190335;t=(t|t>>>16)&1023;return t<<22>>22};r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>a(t)+1}},{}],81:[function(t,e,r){"use strict";var n=t("clamp");e.exports=i;var a=1e20;function i(t,e){if(!e)e={};var r=e.cutoff==null?.25:e.cutoff;var i=e.radius==null?8:e.radius;var s=e.channel||0;var l,u,c,f,h,p,d,v,g,m,y;if(ArrayBuffer.isView(t)||Array.isArray(t)){if(!e.width||!e.height)throw Error("For raw data width and height should be provided by options");l=e.width,u=e.height;f=t;if(!e.stride)p=Math.floor(t.length/l/u);else p=e.stride}else{if(window.HTMLCanvasElement&&t instanceof window.HTMLCanvasElement){v=t;d=v.getContext("2d");l=v.width,u=v.height;g=d.getImageData(0,0,l,u);f=g.data;p=4}else if(window.CanvasRenderingContext2D&&t instanceof window.CanvasRenderingContext2D){v=t.canvas;d=t;l=v.width,u=v.height;g=d.getImageData(0,0,l,u);f=g.data;p=4}else if(window.ImageData&&t instanceof window.ImageData){g=t;l=t.width,u=t.height;f=g.data;p=4}}c=Math.max(l,u);if(window.Uint8ClampedArray&&f instanceof window.Uint8ClampedArray||window.Uint8Array&&f instanceof window.Uint8Array){h=f;f=Array(l*u);for(m=0,y=h.length;m0)return e;return r};i.min=function t(e,r){if(e.cmp(r)<0)return e;return r};i.prototype._init=function t(e,r,a){if(typeof e==="number"){return this._initNumber(e,r,a)}if(typeof e==="object"){return this._initArray(e,r,a)}if(r==="hex"){r=16}n(r===(r|0)&&r>=2&&r<=36);e=e.toString().replace(/\s+/g,"");var i=0;if(e[0]==="-"){i++}if(r===16){this._parseHex(e,i)}else{this._parseBase(e,r,i)}if(e[0]==="-"){this.negative=1}this.strip();if(a!=="le")return;this._initArray(this.toArray(),r,a)};i.prototype._initNumber=function t(e,r,a){if(e<0){this.negative=1;e=-e}if(e<67108864){this.words=[e&67108863];this.length=1}else if(e<4503599627370496){this.words=[e&67108863,e/67108864&67108863];this.length=2}else{n(e<9007199254740992);this.words=[e&67108863,e/67108864&67108863,1];this.length=3}if(a!=="le")return;this._initArray(this.toArray(),r,a)};i.prototype._initArray=function t(e,r,a){n(typeof e.length==="number");if(e.length<=0){this.words=[0];this.length=1;return this}this.length=Math.ceil(e.length/3);this.words=new Array(this.length);for(var i=0;i=0;i-=3){s=e[i]|e[i-1]<<8|e[i-2]<<16;this.words[o]|=s<>>26-l&67108863;l+=24;if(l>=26){l-=26;o++}}}else if(a==="le"){for(i=0,o=0;i>>26-l&67108863;l+=24;if(l>=26){l-=26;o++}}}return this.strip()};function s(t,e,r){var n=0;var a=Math.min(t.length,r);for(var i=e;i=49&&o<=54){n|=o-49+10}else if(o>=17&&o<=22){n|=o-17+10}else{n|=o&15}}return n}i.prototype._parseHex=function t(e,r){this.length=Math.ceil((e.length-r)/6);this.words=new Array(this.length);for(var n=0;n=r;n-=6){i=s(e,n,n+6);this.words[a]|=i<>>26-o&4194303;o+=24;if(o>=26){o-=26;a++}}if(n+6!==r){i=s(e,r,n+6);this.words[a]|=i<>>26-o&4194303}this.strip()};function l(t,e,r,n){var a=0;var i=Math.min(t.length,r);for(var o=e;o=49){a+=s-49+10}else if(s>=17){a+=s-17+10}else{a+=s}}return a}i.prototype._parseBase=function t(e,r,n){this.words=[0];this.length=1;for(var a=0,i=1;i<=67108863;i*=r){a++}a--;i=i/r|0;var o=e.length-n;var s=o%a;var u=Math.min(o,o-s)+n;var c=0;for(var f=n;f1&&this.words[this.length-1]===0){this.length--}return this._normSign()};i.prototype._normSign=function t(){if(this.length===1&&this.words[0]===0){this.negative=0}return this};i.prototype.inspect=function t(){return(this.red?""};var u=["","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"];var c=[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];var f=[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,r){e=e||10;r=r|0||1;var a;if(e===16||e==="hex"){a="";var i=0;var o=0;for(var s=0;s>>24-i&16777215;if(o!==0||s!==this.length-1){a=u[6-h.length]+h+a}else{a=h+a}i+=2;if(i>=26){i-=26;s--}}if(o!==0){a=o.toString(16)+a}while(a.length%r!==0){a="0"+a}if(this.negative!==0){a="-"+a}return a}if(e===(e|0)&&e>=2&&e<=36){var p=c[e];var d=f[e];a="";var v=this.clone();v.negative=0;while(!v.isZero()){var g=v.modn(d).toString(e);v=v.idivn(d);if(!v.isZero()){a=u[p-g.length]+g+a}else{a=g+a}}if(this.isZero()){a="0"+a}while(a.length%r!==0){a="0"+a}if(this.negative!==0){a="-"+a}return a}n(false,"Base should be between 2 and 36")};i.prototype.toNumber=function t(){var e=this.words[0];if(this.length===2){e+=this.words[1]*67108864}else if(this.length===3&&this.words[2]===1){e+=4503599627370496+this.words[1]*67108864}else if(this.length>2){n(false,"Number can only safely store up to 53 bits")}return this.negative!==0?-e:e};i.prototype.toJSON=function t(){return this.toString(16)};i.prototype.toBuffer=function t(e,r){n(typeof o!=="undefined");return this.toArrayLike(o,e,r)};i.prototype.toArray=function t(e,r){return this.toArrayLike(Array,e,r)};i.prototype.toArrayLike=function t(e,r,a){var i=this.byteLength();var o=a||Math.max(1,i);n(i<=o,"byte array longer than desired length");n(o>0,"Requested array length <= 0");this.strip();var s=r==="le";var l=new e(o);var u,c;var f=this.clone();if(!s){for(c=0;c=4096){n+=13;r>>>=13}if(r>=64){n+=7;r>>>=7}if(r>=8){n+=4;r>>>=4}if(r>=2){n+=2;r>>>=2}return n+r}}i.prototype._zeroBits=function t(e){if(e===0)return 26;var r=e;var n=0;if((r&8191)===0){n+=13;r>>>=13}if((r&127)===0){n+=7;r>>>=7}if((r&15)===0){n+=4;r>>>=4}if((r&3)===0){n+=2;r>>>=2}if((r&1)===0){n++}return n};i.prototype.bitLength=function t(){var e=this.words[this.length-1];var r=this._countBits(e);return(this.length-1)*26+r};function h(t){var e=new Array(t.bitLength());for(var r=0;r>>a}return e}i.prototype.zeroBits=function t(){if(this.isZero())return 0;var e=0;for(var r=0;re.length)return this.clone().ior(e);return e.clone().ior(this)};i.prototype.uor=function t(e){if(this.length>e.length)return this.clone().iuor(e);return e.clone().iuor(this)};i.prototype.iuand=function t(e){var r;if(this.length>e.length){r=e}else{r=this}for(var n=0;ne.length)return this.clone().iand(e);return e.clone().iand(this)};i.prototype.uand=function t(e){if(this.length>e.length)return this.clone().iuand(e);return e.clone().iuand(this)};i.prototype.iuxor=function t(e){var r;var n;if(this.length>e.length){r=this;n=e}else{r=e;n=this}for(var a=0;ae.length)return this.clone().ixor(e);return e.clone().ixor(this)};i.prototype.uxor=function t(e){if(this.length>e.length)return this.clone().iuxor(e);return e.clone().iuxor(this)};i.prototype.inotn=function t(e){n(typeof e==="number"&&e>=0);var r=Math.ceil(e/26)|0;var a=e%26;this._expand(r);if(a>0){r--}for(var i=0;i0){this.words[i]=~this.words[i]&67108863>>26-a}return this.strip()};i.prototype.notn=function t(e){return this.clone().inotn(e)};i.prototype.setn=function t(e,r){n(typeof e==="number"&&e>=0);var a=e/26|0;var i=e%26;this._expand(a+1);if(r){this.words[a]=this.words[a]|1<e.length){n=this;a=e}else{n=e;a=this}var i=0;for(var o=0;o>>26}for(;i!==0&&o>>26}this.length=n.length;if(i!==0){this.words[this.length]=i;this.length++}else if(n!==this){for(;oe.length)return this.clone().iadd(e);return e.clone().iadd(this)};i.prototype.isub=function t(e){if(e.negative!==0){e.negative=0;var r=this.iadd(e);e.negative=1;return r._normSign()}else if(this.negative!==0){this.negative=0;this.iadd(e);this.negative=1;return this._normSign()}var n=this.cmp(e);if(n===0){this.negative=0;this.length=1;this.words[0]=0;return this}var a,i;if(n>0){a=this;i=e}else{a=e;i=this}var o=0;for(var s=0;s>26;this.words[s]=r&67108863}for(;o!==0&&s>26;this.words[s]=r&67108863}if(o===0&&s>>26;var f=l&67108863;var h=Math.min(u,e.length-1);for(var p=Math.max(0,u-t.length+1);p<=h;p++){var d=u-p|0;a=t.words[d]|0;i=e.words[p]|0;o=a*i+f;c+=o/67108864|0;f=o&67108863}r.words[u]=f|0;l=c|0}if(l!==0){r.words[u]=l|0}else{r.length--}return r.strip()}var d=function t(e,r,n){var a=e.words;var i=r.words;var o=n.words;var s=0;var l;var u;var c;var f=a[0]|0;var h=f&8191;var p=f>>>13;var d=a[1]|0;var v=d&8191;var g=d>>>13;var m=a[2]|0;var y=m&8191;var x=m>>>13;var b=a[3]|0;var _=b&8191;var w=b>>>13;var k=a[4]|0;var M=k&8191;var A=k>>>13;var T=a[5]|0;var S=T&8191;var E=T>>>13;var C=a[6]|0;var L=C&8191;var I=C>>>13;var z=a[7]|0;var P=z&8191;var O=z>>>13;var D=a[8]|0;var R=D&8191;var B=D>>>13;var F=a[9]|0;var N=F&8191;var j=F>>>13;var V=i[0]|0;var U=V&8191;var q=V>>>13;var H=i[1]|0;var G=H&8191;var W=H>>>13;var Y=i[2]|0;var X=Y&8191;var Z=Y>>>13;var $=i[3]|0;var J=$&8191;var K=$>>>13;var Q=i[4]|0;var tt=Q&8191;var et=Q>>>13;var rt=i[5]|0;var nt=rt&8191;var at=rt>>>13;var it=i[6]|0;var ot=it&8191;var st=it>>>13;var lt=i[7]|0;var ut=lt&8191;var ct=lt>>>13;var ft=i[8]|0;var ht=ft&8191;var pt=ft>>>13;var dt=i[9]|0;var vt=dt&8191;var gt=dt>>>13;n.negative=e.negative^r.negative;n.length=19;l=Math.imul(h,U);u=Math.imul(h,q);u=u+Math.imul(p,U)|0;c=Math.imul(p,q);var mt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(mt>>>26)|0;mt&=67108863;l=Math.imul(v,U);u=Math.imul(v,q);u=u+Math.imul(g,U)|0;c=Math.imul(g,q);l=l+Math.imul(h,G)|0;u=u+Math.imul(h,W)|0;u=u+Math.imul(p,G)|0;c=c+Math.imul(p,W)|0;var yt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(yt>>>26)|0;yt&=67108863;l=Math.imul(y,U);u=Math.imul(y,q);u=u+Math.imul(x,U)|0;c=Math.imul(x,q);l=l+Math.imul(v,G)|0;u=u+Math.imul(v,W)|0;u=u+Math.imul(g,G)|0;c=c+Math.imul(g,W)|0;l=l+Math.imul(h,X)|0;u=u+Math.imul(h,Z)|0;u=u+Math.imul(p,X)|0;c=c+Math.imul(p,Z)|0;var xt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(xt>>>26)|0;xt&=67108863;l=Math.imul(_,U);u=Math.imul(_,q);u=u+Math.imul(w,U)|0;c=Math.imul(w,q);l=l+Math.imul(y,G)|0;u=u+Math.imul(y,W)|0;u=u+Math.imul(x,G)|0;c=c+Math.imul(x,W)|0;l=l+Math.imul(v,X)|0;u=u+Math.imul(v,Z)|0;u=u+Math.imul(g,X)|0;c=c+Math.imul(g,Z)|0;l=l+Math.imul(h,J)|0;u=u+Math.imul(h,K)|0;u=u+Math.imul(p,J)|0;c=c+Math.imul(p,K)|0;var bt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(bt>>>26)|0;bt&=67108863;l=Math.imul(M,U);u=Math.imul(M,q);u=u+Math.imul(A,U)|0;c=Math.imul(A,q);l=l+Math.imul(_,G)|0;u=u+Math.imul(_,W)|0;u=u+Math.imul(w,G)|0;c=c+Math.imul(w,W)|0;l=l+Math.imul(y,X)|0;u=u+Math.imul(y,Z)|0;u=u+Math.imul(x,X)|0;c=c+Math.imul(x,Z)|0;l=l+Math.imul(v,J)|0;u=u+Math.imul(v,K)|0;u=u+Math.imul(g,J)|0;c=c+Math.imul(g,K)|0;l=l+Math.imul(h,tt)|0;u=u+Math.imul(h,et)|0;u=u+Math.imul(p,tt)|0;c=c+Math.imul(p,et)|0;var _t=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(_t>>>26)|0;_t&=67108863;l=Math.imul(S,U);u=Math.imul(S,q);u=u+Math.imul(E,U)|0;c=Math.imul(E,q);l=l+Math.imul(M,G)|0;u=u+Math.imul(M,W)|0;u=u+Math.imul(A,G)|0;c=c+Math.imul(A,W)|0;l=l+Math.imul(_,X)|0;u=u+Math.imul(_,Z)|0;u=u+Math.imul(w,X)|0;c=c+Math.imul(w,Z)|0;l=l+Math.imul(y,J)|0;u=u+Math.imul(y,K)|0;u=u+Math.imul(x,J)|0;c=c+Math.imul(x,K)|0;l=l+Math.imul(v,tt)|0;u=u+Math.imul(v,et)|0;u=u+Math.imul(g,tt)|0;c=c+Math.imul(g,et)|0;l=l+Math.imul(h,nt)|0;u=u+Math.imul(h,at)|0;u=u+Math.imul(p,nt)|0;c=c+Math.imul(p,at)|0;var wt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(wt>>>26)|0;wt&=67108863;l=Math.imul(L,U);u=Math.imul(L,q);u=u+Math.imul(I,U)|0;c=Math.imul(I,q);l=l+Math.imul(S,G)|0;u=u+Math.imul(S,W)|0;u=u+Math.imul(E,G)|0;c=c+Math.imul(E,W)|0;l=l+Math.imul(M,X)|0;u=u+Math.imul(M,Z)|0;u=u+Math.imul(A,X)|0;c=c+Math.imul(A,Z)|0;l=l+Math.imul(_,J)|0;u=u+Math.imul(_,K)|0;u=u+Math.imul(w,J)|0;c=c+Math.imul(w,K)|0;l=l+Math.imul(y,tt)|0;u=u+Math.imul(y,et)|0;u=u+Math.imul(x,tt)|0;c=c+Math.imul(x,et)|0;l=l+Math.imul(v,nt)|0;u=u+Math.imul(v,at)|0;u=u+Math.imul(g,nt)|0;c=c+Math.imul(g,at)|0;l=l+Math.imul(h,ot)|0;u=u+Math.imul(h,st)|0;u=u+Math.imul(p,ot)|0;c=c+Math.imul(p,st)|0;var kt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(kt>>>26)|0;kt&=67108863;l=Math.imul(P,U);u=Math.imul(P,q);u=u+Math.imul(O,U)|0;c=Math.imul(O,q);l=l+Math.imul(L,G)|0;u=u+Math.imul(L,W)|0;u=u+Math.imul(I,G)|0;c=c+Math.imul(I,W)|0;l=l+Math.imul(S,X)|0;u=u+Math.imul(S,Z)|0;u=u+Math.imul(E,X)|0;c=c+Math.imul(E,Z)|0;l=l+Math.imul(M,J)|0;u=u+Math.imul(M,K)|0;u=u+Math.imul(A,J)|0;c=c+Math.imul(A,K)|0;l=l+Math.imul(_,tt)|0;u=u+Math.imul(_,et)|0;u=u+Math.imul(w,tt)|0;c=c+Math.imul(w,et)|0;l=l+Math.imul(y,nt)|0;u=u+Math.imul(y,at)|0;u=u+Math.imul(x,nt)|0;c=c+Math.imul(x,at)|0;l=l+Math.imul(v,ot)|0;u=u+Math.imul(v,st)|0;u=u+Math.imul(g,ot)|0;c=c+Math.imul(g,st)|0;l=l+Math.imul(h,ut)|0;u=u+Math.imul(h,ct)|0;u=u+Math.imul(p,ut)|0;c=c+Math.imul(p,ct)|0;var Mt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(Mt>>>26)|0;Mt&=67108863;l=Math.imul(R,U);u=Math.imul(R,q);u=u+Math.imul(B,U)|0;c=Math.imul(B,q);l=l+Math.imul(P,G)|0;u=u+Math.imul(P,W)|0;u=u+Math.imul(O,G)|0;c=c+Math.imul(O,W)|0;l=l+Math.imul(L,X)|0;u=u+Math.imul(L,Z)|0;u=u+Math.imul(I,X)|0;c=c+Math.imul(I,Z)|0;l=l+Math.imul(S,J)|0;u=u+Math.imul(S,K)|0;u=u+Math.imul(E,J)|0;c=c+Math.imul(E,K)|0;l=l+Math.imul(M,tt)|0;u=u+Math.imul(M,et)|0;u=u+Math.imul(A,tt)|0;c=c+Math.imul(A,et)|0;l=l+Math.imul(_,nt)|0;u=u+Math.imul(_,at)|0;u=u+Math.imul(w,nt)|0;c=c+Math.imul(w,at)|0;l=l+Math.imul(y,ot)|0;u=u+Math.imul(y,st)|0;u=u+Math.imul(x,ot)|0;c=c+Math.imul(x,st)|0;l=l+Math.imul(v,ut)|0;u=u+Math.imul(v,ct)|0;u=u+Math.imul(g,ut)|0;c=c+Math.imul(g,ct)|0;l=l+Math.imul(h,ht)|0;u=u+Math.imul(h,pt)|0;u=u+Math.imul(p,ht)|0;c=c+Math.imul(p,pt)|0;var At=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(At>>>26)|0;At&=67108863;l=Math.imul(N,U);u=Math.imul(N,q);u=u+Math.imul(j,U)|0;c=Math.imul(j,q);l=l+Math.imul(R,G)|0;u=u+Math.imul(R,W)|0;u=u+Math.imul(B,G)|0;c=c+Math.imul(B,W)|0;l=l+Math.imul(P,X)|0;u=u+Math.imul(P,Z)|0;u=u+Math.imul(O,X)|0;c=c+Math.imul(O,Z)|0;l=l+Math.imul(L,J)|0;u=u+Math.imul(L,K)|0;u=u+Math.imul(I,J)|0;c=c+Math.imul(I,K)|0;l=l+Math.imul(S,tt)|0;u=u+Math.imul(S,et)|0;u=u+Math.imul(E,tt)|0;c=c+Math.imul(E,et)|0;l=l+Math.imul(M,nt)|0;u=u+Math.imul(M,at)|0;u=u+Math.imul(A,nt)|0;c=c+Math.imul(A,at)|0;l=l+Math.imul(_,ot)|0;u=u+Math.imul(_,st)|0;u=u+Math.imul(w,ot)|0;c=c+Math.imul(w,st)|0;l=l+Math.imul(y,ut)|0;u=u+Math.imul(y,ct)|0;u=u+Math.imul(x,ut)|0;c=c+Math.imul(x,ct)|0;l=l+Math.imul(v,ht)|0;u=u+Math.imul(v,pt)|0;u=u+Math.imul(g,ht)|0;c=c+Math.imul(g,pt)|0;l=l+Math.imul(h,vt)|0;u=u+Math.imul(h,gt)|0;u=u+Math.imul(p,vt)|0;c=c+Math.imul(p,gt)|0;var Tt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(Tt>>>26)|0;Tt&=67108863;l=Math.imul(N,G);u=Math.imul(N,W);u=u+Math.imul(j,G)|0;c=Math.imul(j,W);l=l+Math.imul(R,X)|0;u=u+Math.imul(R,Z)|0;u=u+Math.imul(B,X)|0;c=c+Math.imul(B,Z)|0;l=l+Math.imul(P,J)|0;u=u+Math.imul(P,K)|0;u=u+Math.imul(O,J)|0;c=c+Math.imul(O,K)|0;l=l+Math.imul(L,tt)|0;u=u+Math.imul(L,et)|0;u=u+Math.imul(I,tt)|0;c=c+Math.imul(I,et)|0;l=l+Math.imul(S,nt)|0;u=u+Math.imul(S,at)|0;u=u+Math.imul(E,nt)|0;c=c+Math.imul(E,at)|0;l=l+Math.imul(M,ot)|0;u=u+Math.imul(M,st)|0;u=u+Math.imul(A,ot)|0;c=c+Math.imul(A,st)|0;l=l+Math.imul(_,ut)|0;u=u+Math.imul(_,ct)|0;u=u+Math.imul(w,ut)|0;c=c+Math.imul(w,ct)|0;l=l+Math.imul(y,ht)|0;u=u+Math.imul(y,pt)|0;u=u+Math.imul(x,ht)|0;c=c+Math.imul(x,pt)|0;l=l+Math.imul(v,vt)|0;u=u+Math.imul(v,gt)|0;u=u+Math.imul(g,vt)|0;c=c+Math.imul(g,gt)|0;var St=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(St>>>26)|0;St&=67108863;l=Math.imul(N,X);u=Math.imul(N,Z);u=u+Math.imul(j,X)|0;c=Math.imul(j,Z);l=l+Math.imul(R,J)|0;u=u+Math.imul(R,K)|0;u=u+Math.imul(B,J)|0;c=c+Math.imul(B,K)|0;l=l+Math.imul(P,tt)|0;u=u+Math.imul(P,et)|0;u=u+Math.imul(O,tt)|0;c=c+Math.imul(O,et)|0;l=l+Math.imul(L,nt)|0;u=u+Math.imul(L,at)|0;u=u+Math.imul(I,nt)|0;c=c+Math.imul(I,at)|0;l=l+Math.imul(S,ot)|0;u=u+Math.imul(S,st)|0;u=u+Math.imul(E,ot)|0;c=c+Math.imul(E,st)|0;l=l+Math.imul(M,ut)|0;u=u+Math.imul(M,ct)|0;u=u+Math.imul(A,ut)|0;c=c+Math.imul(A,ct)|0;l=l+Math.imul(_,ht)|0;u=u+Math.imul(_,pt)|0;u=u+Math.imul(w,ht)|0;c=c+Math.imul(w,pt)|0;l=l+Math.imul(y,vt)|0;u=u+Math.imul(y,gt)|0;u=u+Math.imul(x,vt)|0;c=c+Math.imul(x,gt)|0;var Et=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(Et>>>26)|0;Et&=67108863;l=Math.imul(N,J);u=Math.imul(N,K);u=u+Math.imul(j,J)|0;c=Math.imul(j,K);l=l+Math.imul(R,tt)|0;u=u+Math.imul(R,et)|0;u=u+Math.imul(B,tt)|0;c=c+Math.imul(B,et)|0;l=l+Math.imul(P,nt)|0;u=u+Math.imul(P,at)|0;u=u+Math.imul(O,nt)|0;c=c+Math.imul(O,at)|0;l=l+Math.imul(L,ot)|0;u=u+Math.imul(L,st)|0;u=u+Math.imul(I,ot)|0;c=c+Math.imul(I,st)|0;l=l+Math.imul(S,ut)|0;u=u+Math.imul(S,ct)|0;u=u+Math.imul(E,ut)|0;c=c+Math.imul(E,ct)|0;l=l+Math.imul(M,ht)|0;u=u+Math.imul(M,pt)|0;u=u+Math.imul(A,ht)|0;c=c+Math.imul(A,pt)|0;l=l+Math.imul(_,vt)|0;u=u+Math.imul(_,gt)|0;u=u+Math.imul(w,vt)|0;c=c+Math.imul(w,gt)|0;var Ct=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(Ct>>>26)|0;Ct&=67108863;l=Math.imul(N,tt);u=Math.imul(N,et);u=u+Math.imul(j,tt)|0;c=Math.imul(j,et);l=l+Math.imul(R,nt)|0;u=u+Math.imul(R,at)|0;u=u+Math.imul(B,nt)|0;c=c+Math.imul(B,at)|0;l=l+Math.imul(P,ot)|0;u=u+Math.imul(P,st)|0;u=u+Math.imul(O,ot)|0;c=c+Math.imul(O,st)|0;l=l+Math.imul(L,ut)|0;u=u+Math.imul(L,ct)|0;u=u+Math.imul(I,ut)|0;c=c+Math.imul(I,ct)|0;l=l+Math.imul(S,ht)|0;u=u+Math.imul(S,pt)|0;u=u+Math.imul(E,ht)|0;c=c+Math.imul(E,pt)|0;l=l+Math.imul(M,vt)|0;u=u+Math.imul(M,gt)|0;u=u+Math.imul(A,vt)|0;c=c+Math.imul(A,gt)|0;var Lt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(Lt>>>26)|0;Lt&=67108863;l=Math.imul(N,nt);u=Math.imul(N,at);u=u+Math.imul(j,nt)|0;c=Math.imul(j,at);l=l+Math.imul(R,ot)|0;u=u+Math.imul(R,st)|0;u=u+Math.imul(B,ot)|0;c=c+Math.imul(B,st)|0;l=l+Math.imul(P,ut)|0;u=u+Math.imul(P,ct)|0;u=u+Math.imul(O,ut)|0;c=c+Math.imul(O,ct)|0;l=l+Math.imul(L,ht)|0;u=u+Math.imul(L,pt)|0;u=u+Math.imul(I,ht)|0;c=c+Math.imul(I,pt)|0;l=l+Math.imul(S,vt)|0;u=u+Math.imul(S,gt)|0;u=u+Math.imul(E,vt)|0;c=c+Math.imul(E,gt)|0;var It=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(It>>>26)|0;It&=67108863;l=Math.imul(N,ot);u=Math.imul(N,st);u=u+Math.imul(j,ot)|0;c=Math.imul(j,st);l=l+Math.imul(R,ut)|0;u=u+Math.imul(R,ct)|0;u=u+Math.imul(B,ut)|0;c=c+Math.imul(B,ct)|0;l=l+Math.imul(P,ht)|0;u=u+Math.imul(P,pt)|0;u=u+Math.imul(O,ht)|0;c=c+Math.imul(O,pt)|0;l=l+Math.imul(L,vt)|0;u=u+Math.imul(L,gt)|0;u=u+Math.imul(I,vt)|0;c=c+Math.imul(I,gt)|0;var zt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(zt>>>26)|0;zt&=67108863;l=Math.imul(N,ut);u=Math.imul(N,ct);u=u+Math.imul(j,ut)|0;c=Math.imul(j,ct);l=l+Math.imul(R,ht)|0;u=u+Math.imul(R,pt)|0;u=u+Math.imul(B,ht)|0;c=c+Math.imul(B,pt)|0;l=l+Math.imul(P,vt)|0;u=u+Math.imul(P,gt)|0;u=u+Math.imul(O,vt)|0;c=c+Math.imul(O,gt)|0;var Pt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(Pt>>>26)|0;Pt&=67108863;l=Math.imul(N,ht);u=Math.imul(N,pt);u=u+Math.imul(j,ht)|0;c=Math.imul(j,pt);l=l+Math.imul(R,vt)|0;u=u+Math.imul(R,gt)|0;u=u+Math.imul(B,vt)|0;c=c+Math.imul(B,gt)|0;var Ot=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(Ot>>>26)|0;Ot&=67108863;l=Math.imul(N,vt);u=Math.imul(N,gt);u=u+Math.imul(j,vt)|0;c=Math.imul(j,gt);var Dt=(s+l|0)+((u&8191)<<13)|0;s=(c+(u>>>13)|0)+(Dt>>>26)|0;Dt&=67108863;o[0]=mt;o[1]=yt;o[2]=xt;o[3]=bt;o[4]=_t;o[5]=wt;o[6]=kt;o[7]=Mt;o[8]=At;o[9]=Tt;o[10]=St;o[11]=Et;o[12]=Ct;o[13]=Lt;o[14]=It;o[15]=zt;o[16]=Pt;o[17]=Ot;o[18]=Dt;if(s!==0){o[19]=s;n.length++}return n};if(!Math.imul){d=p}function v(t,e,r){r.negative=e.negative^t.negative;r.length=t.length+e.length;var n=0;var a=0;for(var i=0;i>>26)|0;a+=o>>>26;o&=67108863}r.words[i]=s;n=o;o=a}if(n!==0){r.words[i]=n}else{r.length--}return r.strip()}function g(t,e,r){var n=new m;return n.mulp(t,e,r)}i.prototype.mulTo=function t(e,r){var n;var a=this.length+e.length;if(this.length===10&&e.length===10){n=d(this,e,r)}else if(a<63){n=p(this,e,r)}else if(a<1024){n=v(this,e,r)}else{n=g(this,e,r)}return n};function m(t,e){this.x=t;this.y=e}m.prototype.makeRBT=function t(e){var r=new Array(e);var n=i.prototype._countBits(e)-1;for(var a=0;a>=1}return a};m.prototype.permute=function t(e,r,n,a,i,o){for(var s=0;s>>1){i++}return 1<>>13;a[2*s+1]=o&8191;o=o>>>13}for(s=2*r;s>=26;r+=i/67108864|0;r+=o>>>26;this.words[a]=o&67108863}if(r!==0){this.words[a]=r;this.length++}return this};i.prototype.muln=function t(e){return this.clone().imuln(e)};i.prototype.sqr=function t(){return this.mul(this)};i.prototype.isqr=function t(){return this.imul(this.clone())};i.prototype.pow=function t(e){var r=h(e);if(r.length===0)return new i(1);var n=this;for(var a=0;a=0);var r=e%26;var a=(e-r)/26;var i=67108863>>>26-r<<26-r;var o;if(r!==0){var s=0;for(o=0;o>>26-r}if(s){this.words[o]=s;this.length++}}if(a!==0){for(o=this.length-1;o>=0;o--){this.words[o+a]=this.words[o]}for(o=0;o=0);var i;if(r){i=(r-r%26)/26}else{i=0}var o=e%26;var s=Math.min((e-o)/26,this.length);var l=67108863^67108863>>>o<s){this.length-=s;for(c=0;c=0&&(f!==0||c>=i);c--){var h=this.words[c]|0;this.words[c]=f<<26-o|h>>>o;f=h&l}if(u&&f!==0){u.words[u.length++]=f}if(this.length===0){this.words[0]=0;this.length=1}return this.strip()};i.prototype.ishrn=function t(e,r,a){n(this.negative===0);return this.iushrn(e,r,a)};i.prototype.shln=function t(e){return this.clone().ishln(e)};i.prototype.ushln=function t(e){return this.clone().iushln(e)};i.prototype.shrn=function t(e){return this.clone().ishrn(e)};i.prototype.ushrn=function t(e){return this.clone().iushrn(e)};i.prototype.testn=function t(e){n(typeof e==="number"&&e>=0);var r=e%26;var a=(e-r)/26;var i=1<=0);var r=e%26;var a=(e-r)/26;n(this.negative===0,"imaskn works only with positive numbers");if(this.length<=a){return this}if(r!==0){a++}this.length=Math.min(a,this.length);if(r!==0){var i=67108863^67108863>>>r<=67108864;r++){this.words[r]-=67108864;if(r===this.length-1){this.words[r+1]=1}else{this.words[r+1]++}}this.length=Math.max(this.length,r+1);return this};i.prototype.isubn=function t(e){n(typeof e==="number");n(e<67108864);if(e<0)return this.iaddn(-e);if(this.negative!==0){this.negative=0;this.iaddn(e);this.negative=1;return this}this.words[0]-=e;if(this.length===1&&this.words[0]<0){this.words[0]=-this.words[0];this.negative=1}else{for(var r=0;r>26)-(u/67108864|0);this.words[o+a]=s&67108863}for(;o>26;this.words[o+a]=s&67108863}if(l===0)return this.strip();n(l===-1);l=0;for(o=0;o>26;this.words[o]=s&67108863}this.negative=1;return this.strip()};i.prototype._wordDiv=function t(e,r){var n=this.length-e.length;var a=this.clone();var o=e;var s=o.words[o.length-1]|0;var l=this._countBits(s);n=26-l;if(n!==0){o=o.ushln(n);a.iushln(n);s=o.words[o.length-1]|0}var u=a.length-o.length;var c;if(r!=="mod"){c=new i(null);c.length=u+1;c.words=new Array(c.length);for(var f=0;f=0;p--){var d=(a.words[o.length+p]|0)*67108864+(a.words[o.length+p-1]|0);d=Math.min(d/s|0,67108863);a._ishlnsubmul(o,d,p);while(a.negative!==0){d--;a.negative=0;a._ishlnsubmul(o,1,p);if(!a.isZero()){a.negative^=1}}if(c){c.words[p]=d}}if(c){c.strip()}a.strip();if(r!=="div"&&n!==0){a.iushrn(n)}return{div:c||null,mod:a}};i.prototype.divmod=function t(e,r,a){n(!e.isZero());if(this.isZero()){return{div:new i(0),mod:new i(0)}}var o,s,l;if(this.negative!==0&&e.negative===0){l=this.neg().divmod(e,r);if(r!=="mod"){o=l.div.neg()}if(r!=="div"){s=l.mod.neg();if(a&&s.negative!==0){s.iadd(e)}}return{div:o,mod:s}}if(this.negative===0&&e.negative!==0){l=this.divmod(e.neg(),r);if(r!=="mod"){o=l.div.neg()}return{div:o,mod:l.mod}}if((this.negative&e.negative)!==0){l=this.neg().divmod(e.neg(),r);if(r!=="div"){s=l.mod.neg();if(a&&s.negative!==0){s.isub(e)}}return{div:l.div,mod:s}}if(e.length>this.length||this.cmp(e)<0){return{div:new i(0),mod:this}}if(e.length===1){if(r==="div"){return{div:this.divn(e.words[0]),mod:null}}if(r==="mod"){return{div:null,mod:new i(this.modn(e.words[0]))}}return{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}}return this._wordDiv(e,r)};i.prototype.div=function t(e){return this.divmod(e,"div",false).div};i.prototype.mod=function t(e){return this.divmod(e,"mod",false).mod};i.prototype.umod=function t(e){return this.divmod(e,"mod",true).mod};i.prototype.divRound=function t(e){var r=this.divmod(e);if(r.mod.isZero())return r.div;var n=r.div.negative!==0?r.mod.isub(e):r.mod;var a=e.ushrn(1);var i=e.andln(1);var o=n.cmp(a);if(o<0||i===1&&o===0)return r.div;return r.div.negative!==0?r.div.isubn(1):r.div.iaddn(1)};i.prototype.modn=function t(e){n(e<=67108863);var r=(1<<26)%e;var a=0;for(var i=this.length-1;i>=0;i--){a=(r*a+(this.words[i]|0))%e}return a};i.prototype.idivn=function t(e){n(e<=67108863);var r=0;for(var a=this.length-1;a>=0;a--){var i=(this.words[a]|0)+r*67108864;this.words[a]=i/e|0;r=i%e}return this.strip()};i.prototype.divn=function t(e){return this.clone().idivn(e)};i.prototype.egcd=function t(e){n(e.negative===0);n(!e.isZero());var r=this;var a=e.clone();if(r.negative!==0){r=r.umod(e)}else{r=r.clone()}var o=new i(1);var s=new i(0);var l=new i(0);var u=new i(1);var c=0;while(r.isEven()&&a.isEven()){r.iushrn(1);a.iushrn(1);++c}var f=a.clone();var h=r.clone();while(!r.isZero()){for(var p=0,d=1;(r.words[0]&d)===0&&p<26;++p,d<<=1);if(p>0){r.iushrn(p);while(p-- >0){if(o.isOdd()||s.isOdd()){o.iadd(f);s.isub(h)}o.iushrn(1);s.iushrn(1)}}for(var v=0,g=1;(a.words[0]&g)===0&&v<26;++v,g<<=1);if(v>0){a.iushrn(v);while(v-- >0){if(l.isOdd()||u.isOdd()){l.iadd(f);u.isub(h)}l.iushrn(1);u.iushrn(1)}}if(r.cmp(a)>=0){r.isub(a);o.isub(l);s.isub(u)}else{a.isub(r);l.isub(o);u.isub(s)}}return{a:l,b:u,gcd:a.iushln(c)}};i.prototype._invmp=function t(e){n(e.negative===0);n(!e.isZero());var r=this;var a=e.clone();if(r.negative!==0){r=r.umod(e)}else{r=r.clone()}var o=new i(1);var s=new i(0);var l=a.clone();while(r.cmpn(1)>0&&a.cmpn(1)>0){for(var u=0,c=1;(r.words[0]&c)===0&&u<26;++u,c<<=1);if(u>0){r.iushrn(u);while(u-- >0){if(o.isOdd()){o.iadd(l)}o.iushrn(1)}}for(var f=0,h=1;(a.words[0]&h)===0&&f<26;++f,h<<=1);if(f>0){a.iushrn(f);while(f-- >0){if(s.isOdd()){s.iadd(l)}s.iushrn(1)}}if(r.cmp(a)>=0){r.isub(a);o.isub(s)}else{a.isub(r);s.isub(o)}}var p;if(r.cmpn(1)===0){p=o}else{p=s}if(p.cmpn(0)<0){p.iadd(e)}return p};i.prototype.gcd=function t(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var r=this.clone();var n=e.clone();r.negative=0;n.negative=0;for(var a=0;r.isEven()&&n.isEven();a++){r.iushrn(1);n.iushrn(1)}do{while(r.isEven()){r.iushrn(1)}while(n.isEven()){n.iushrn(1)}var i=r.cmp(n);if(i<0){var o=r;r=n;n=o}else if(i===0||n.cmpn(1)===0){break}r.isub(n)}while(true);return n.iushln(a)};i.prototype.invm=function t(e){return this.egcd(e).a.umod(e)};i.prototype.isEven=function t(){return(this.words[0]&1)===0};i.prototype.isOdd=function t(){return(this.words[0]&1)===1};i.prototype.andln=function t(e){return this.words[0]&e};i.prototype.bincn=function t(e){n(typeof e==="number");var r=e%26;var a=(e-r)/26;var i=1<>>26;l&=67108863;this.words[s]=l}if(o!==0){this.words[s]=o;this.length++}return this};i.prototype.isZero=function t(){return this.length===1&&this.words[0]===0};i.prototype.cmpn=function t(e){var r=e<0;if(this.negative!==0&&!r)return-1;if(this.negative===0&&r)return 1;this.strip();var a;if(this.length>1){a=1}else{if(r){e=-e}n(e<=67108863,"Number is too big");var i=this.words[0]|0;a=i===e?0:ie.length)return 1;if(this.length=0;n--){var a=this.words[n]|0;var i=e.words[n]|0;if(a===i)continue;if(ai){r=1}break}return r};i.prototype.gtn=function t(e){return this.cmpn(e)===1};i.prototype.gt=function t(e){return this.cmp(e)===1};i.prototype.gten=function t(e){return this.cmpn(e)>=0};i.prototype.gte=function t(e){return this.cmp(e)>=0};i.prototype.ltn=function t(e){return this.cmpn(e)===-1};i.prototype.lt=function t(e){return this.cmp(e)===-1};i.prototype.lten=function t(e){return this.cmpn(e)<=0};i.prototype.lte=function t(e){return this.cmp(e)<=0};i.prototype.eqn=function t(e){return this.cmpn(e)===0};i.prototype.eq=function t(e){return this.cmp(e)===0};i.red=function t(e){return new M(e)};i.prototype.toRed=function t(e){n(!this.red,"Already a number in reduction context");n(this.negative===0,"red works only with positives");return e.convertTo(this)._forceRed(e)};i.prototype.fromRed=function t(){n(this.red,"fromRed works only with numbers in reduction context");return this.red.convertFrom(this)};i.prototype._forceRed=function t(e){this.red=e;return this};i.prototype.forceRed=function t(e){n(!this.red,"Already a number in reduction context");return this._forceRed(e)};i.prototype.redAdd=function t(e){n(this.red,"redAdd works only with red numbers");return this.red.add(this,e)};i.prototype.redIAdd=function t(e){n(this.red,"redIAdd works only with red numbers");return this.red.iadd(this,e)};i.prototype.redSub=function t(e){n(this.red,"redSub works only with red numbers");return this.red.sub(this,e)};i.prototype.redISub=function t(e){n(this.red,"redISub works only with red numbers");return this.red.isub(this,e)};i.prototype.redShl=function t(e){n(this.red,"redShl works only with red numbers");return this.red.shl(this,e)};i.prototype.redMul=function t(e){n(this.red,"redMul works only with red numbers");this.red._verify2(this,e);return this.red.mul(this,e)};i.prototype.redIMul=function t(e){n(this.red,"redMul works only with red numbers");this.red._verify2(this,e);return this.red.imul(this,e)};i.prototype.redSqr=function t(){n(this.red,"redSqr works only with red numbers");this.red._verify1(this);return this.red.sqr(this)};i.prototype.redISqr=function t(){n(this.red,"redISqr works only with red numbers");this.red._verify1(this);return this.red.isqr(this)};i.prototype.redSqrt=function t(){n(this.red,"redSqrt works only with red numbers");this.red._verify1(this);return this.red.sqrt(this)};i.prototype.redInvm=function t(){n(this.red,"redInvm works only with red numbers");this.red._verify1(this);return this.red.invm(this)};i.prototype.redNeg=function t(){n(this.red,"redNeg works only with red numbers");this.red._verify1(this);return this.red.neg(this)};i.prototype.redPow=function t(e){n(this.red&&!e.red,"redPow(normalNum)");this.red._verify1(this);return this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function x(t,e){this.name=t;this.p=new i(e,16);this.n=this.p.bitLength();this.k=new i(1).iushln(this.n).isub(this.p);this.tmp=this._tmp()}x.prototype._tmp=function t(){var e=new i(null);e.words=new Array(Math.ceil(this.n/13));return e};x.prototype.ireduce=function t(e){var r=e;var n;do{this.split(r,this.tmp);r=this.imulK(r);r=r.iadd(this.tmp);n=r.bitLength()}while(n>this.n);var a=n0){r.isub(this.p)}else{r.strip()}return r};x.prototype.split=function t(e,r){e.iushrn(this.n,0,r)};x.prototype.imulK=function t(e){return e.imul(this.k)};function b(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}a(b,x);b.prototype.split=function t(e,r){var n=4194303;var a=Math.min(e.length,9);for(var i=0;i>>22;o=s}o>>>=22;e.words[i-10]=o;if(o===0&&e.length>10){e.length-=10}else{e.length-=9}};b.prototype.imulK=function t(e){e.words[e.length]=0;e.words[e.length+1]=0;e.length+=2;var r=0;for(var n=0;n>>=26;e.words[n]=i;r=a}if(r!==0){e.words[e.length++]=r}return e};i._prime=function t(e){if(y[e])return y[e];var t;if(e==="k256"){t=new b}else if(e==="p224"){t=new _}else if(e==="p192"){t=new w}else if(e==="p25519"){t=new k}else{throw new Error("Unknown prime "+e)}y[e]=t;return t};function M(t){if(typeof t==="string"){var e=i._prime(t);this.m=e.p;this.prime=e}else{n(t.gtn(1),"modulus must be greater than 1");this.m=t;this.prime=null}}M.prototype._verify1=function t(e){n(e.negative===0,"red works only with positives");n(e.red,"red works only with red numbers")};M.prototype._verify2=function t(e,r){n((e.negative|r.negative)===0,"red works only with positives");n(e.red&&e.red===r.red,"red works only with red numbers")};M.prototype.imod=function t(e){if(this.prime)return this.prime.ireduce(e)._forceRed(this);return e.umod(this.m)._forceRed(this)};M.prototype.neg=function t(e){if(e.isZero()){return e.clone()}return this.m.sub(e)._forceRed(this)};M.prototype.add=function t(e,r){this._verify2(e,r);var n=e.add(r);if(n.cmp(this.m)>=0){n.isub(this.m)}return n._forceRed(this)};M.prototype.iadd=function t(e,r){this._verify2(e,r);var n=e.iadd(r);if(n.cmp(this.m)>=0){n.isub(this.m)}return n};M.prototype.sub=function t(e,r){this._verify2(e,r);var n=e.sub(r);if(n.cmpn(0)<0){n.iadd(this.m)}return n._forceRed(this)};M.prototype.isub=function t(e,r){this._verify2(e,r);var n=e.isub(r);if(n.cmpn(0)<0){n.iadd(this.m)}return n};M.prototype.shl=function t(e,r){this._verify1(e);return this.imod(e.ushln(r))};M.prototype.imul=function t(e,r){this._verify2(e,r);return this.imod(e.imul(r))};M.prototype.mul=function t(e,r){this._verify2(e,r);return this.imod(e.mul(r))};M.prototype.isqr=function t(e){return this.imul(e,e.clone())};M.prototype.sqr=function t(e){return this.mul(e,e)};M.prototype.sqrt=function t(e){if(e.isZero())return e.clone();var r=this.m.andln(3);n(r%2===1);if(r===3){var a=this.m.add(new i(1)).iushrn(2);return this.pow(e,a)}var o=this.m.subn(1);var s=0;while(!o.isZero()&&o.andln(1)===0){s++;o.iushrn(1)}n(!o.isZero());var l=new i(1).toRed(this);var u=l.redNeg();var c=this.m.subn(1).iushrn(1);var f=this.m.bitLength();f=new i(2*f*f).toRed(this);while(this.pow(f,c).cmp(u)!==0){f.redIAdd(u)}var h=this.pow(f,o);var p=this.pow(e,o.addn(1).iushrn(1));var d=this.pow(e,o);var v=s;while(d.cmp(l)!==0){var g=d;for(var m=0;g.cmp(l)!==0;m++){g=g.redSqr()}n(m=0;o--){var f=r.words[o];for(var h=c-1;h>=0;h--){var p=f>>h&1;if(s!==a[0]){s=this.sqr(s)}if(p===0&&l===0){u=0;continue}l<<=1;l|=p;u++;if(u!==n&&(o!==0||h!==0))continue;s=this.mul(s,a[l]);u=0;l=0}c=26}return s};M.prototype.convertTo=function t(e){var r=e.umod(this.m);return r===e?r.clone():r};M.prototype.convertFrom=function t(e){var r=e.clone();r.red=null;return r};i.mont=function t(e){return new A(e)};function A(t){M.call(this,t);this.shift=this.m.bitLength();if(this.shift%26!==0){this.shift+=26-this.shift%26}this.r=new i(1).iushln(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=this.minv.umod(this.r);this.minv=this.r.sub(this.minv)}a(A,M);A.prototype.convertTo=function t(e){return this.imod(e.ushln(this.shift))};A.prototype.convertFrom=function t(e){var r=this.imod(e.mul(this.rinv));r.red=null;return r};A.prototype.imul=function t(e,r){if(e.isZero()||r.isZero()){e.words[0]=0;e.length=1;return e}var n=e.imul(r);var a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);var i=n.isub(a).iushrn(this.shift);var o=i;if(i.cmp(this.m)>=0){o=i.isub(this.m)}else if(i.cmpn(0)<0){o=i.iadd(this.m)}return o._forceRed(this)};A.prototype.mul=function t(e,r){if(e.isZero()||r.isZero())return new i(0)._forceRed(this);var n=e.mul(r);var a=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);var o=n.isub(a).iushrn(this.shift);var s=o;if(o.cmp(this.m)>=0){s=o.isub(this.m)}else if(o.cmpn(0)<0){s=o.iadd(this.m)}return s._forceRed(this)};A.prototype.invm=function t(e){var r=this.imod(e._invmp(this.m).mul(this.r2));return r._forceRed(this)}})(typeof e==="undefined"||e,this)},{buffer:91}],83:[function(t,e,r){"use strict";e.exports=n;function n(t){var e,r,n;var a=t.length;var i=0;for(e=0;e>>1;if(c<=0){return}var f;var h=n.mallocDouble(2*c*l);var p=n.mallocInt32(l);l=s(t,c,h,p);if(l>0){if(c===1&&o){a.init(l);f=a.sweepComplete(c,r,0,l,h,p,0,l,h,p)}else{var d=n.mallocDouble(2*c*u);var v=n.mallocInt32(u);u=s(e,c,d,v);if(u>0){a.init(l+u);if(c===1){f=a.sweepBipartite(c,r,0,l,h,p,0,u,d,v)}else{f=i(c,r,o,l,h,p,u,d,v)}n.free(d);n.free(v)}}n.free(h);n.free(p)}return f}var u;function c(t,e){u.push([t,e])}function f(t){u=[];l(t,t,c,true);return u}function h(t,e){u=[];l(t,e,c,false);return u}function p(t,e,r){var n;switch(arguments.length){case 1:return f(t);case 2:if(typeof e==="function"){return l(t,t,e,true)}else{return h(t,e)}case 3:return l(t,e,r,false);default:throw new Error("box-intersect: Invalid arguments")}}},{"./lib/intersect":86,"./lib/sweep":90,"typedarray-pool":507}],85:[function(t,e,r){"use strict";var n="d";var a="ax";var i="vv";var o="fp";var s="es";var l="rs";var u="re";var c="rb";var f="ri";var h="rp";var p="bs";var d="be";var v="bb";var g="bi";var m="bp";var y="rv";var x="Q";var b=[n,a,i,l,u,c,f,p,d,v,g];function _(t,e,r){var o="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":"");var _=["function ",o,"(",b.join(),"){","var ",s,"=2*",n,";"];var w="for(var i="+l+","+h+"="+s+"*"+l+";"+"i<"+u+";"+"++i,"+h+"+="+s+"){"+"var x0="+c+"["+a+"+"+h+"],"+"x1="+c+"["+a+"+"+h+"+"+n+"],"+"xi="+f+"[i];";var k="for(var j="+p+","+m+"="+s+"*"+p+";"+"j<"+d+";"+"++j,"+m+"+="+s+"){"+"var y0="+v+"["+a+"+"+m+"],"+(r?"y1="+v+"["+a+"+"+m+"+"+n+"],":"")+"yi="+g+"[j];";if(t){_.push(w,x,":",k)}else{_.push(k,x,":",w)}if(r){_.push("if(y1"+d+"-"+p+"){");if(t){i(true,false);a.push("}else{");i(false,false)}else{a.push("if("+o+"){");i(true,true);a.push("}else{");i(true,false);a.push("}}else{if("+o+"){");i(false,true);a.push("}else{");i(false,false);a.push("}")}a.push("}}return "+e);var s=r.join("")+a.join("");var c=new Function(s);return c()}r.partial=w(false);r.full=w(true)},{}],86:[function(t,e,r){"use strict";e.exports=C;var n=t("typedarray-pool");var a=t("bit-twiddle");var i=t("./brute");var o=i.partial;var s=i.full;var l=t("./sweep");var u=t("./median");var c=t("./partition");var f=128;var h=1<<22;var p=1<<22;var d=c("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]);var v=c("lo===p0",["p0"]);var g=c("lo0){L-=1;var P=L*b;var O=k[P];var D=k[P+1];var R=k[P+2];var B=k[P+3];var F=k[P+4];var N=k[P+5];var j=L*_;var V=M[j];var U=M[j+1];var q=N&1;var H=!!(N&16);var G=a;var W=i;var Y=w;var X=C;if(q){G=w;W=C;Y=a;X=i}if(N&2){R=g(t,O,D,R,G,W,U);if(D>=R){continue}}if(N&4){D=m(t,O,D,R,G,W,V);if(D>=R){continue}}var Z=R-D;var $=F-B;if(H){if(t*Z*(Z+$)r&&a[f+e]>u;--c,f-=o){var h=f;var p=f+o;for(var d=0;d>>1;var h=2*t;var p=f;var d=s[h*f+e];while(u=x){p=y;d=x}else if(m>=_){p=g;d=m}else{p=b;d=_}}else{if(x>=_){p=y;d=x}else if(_>=m){p=g;d=m}else{p=b;d=_}}var w=h*(c-1);var k=h*p;for(var M=0;M=0){a.push("lo=e[k+n]")}if(t.indexOf("hi")>=0){a.push("hi=e[k+o]")}r.push(n.replace("_",a.join()).replace("$",t));return Function.apply(void 0,r)}},{}],89:[function(t,e,r){"use strict";e.exports=a;var n=32;function a(t,e){if(e<=4*n){i(0,e-1,t)}else{h(0,e-1,t)}}function i(t,e,r){var n=2*(t+1);for(var a=t+1;a<=e;++a){var i=r[n++];var o=r[n++];var s=a;var l=n-2;while(s-- >t){var u=r[l-2];var c=r[l-1];if(ur[e+1]}return true}function f(t,e,r,n){t*=2;var a=n[t];if(a>1,g=v-a,m=v+a,y=p,x=g,b=v,_=m,w=d,k=t+1,M=e-1,A=0;if(c(y,x,r)){A=y;y=x;x=A}if(c(_,w,r)){A=_;_=w;w=A}if(c(y,b,r)){A=y;y=b;b=A}if(c(x,b,r)){A=x;x=b;b=A}if(c(y,_,r)){A=y;y=_;_=A}if(c(b,_,r)){A=b;b=_;_=A}if(c(x,w,r)){A=x;x=w;w=A}if(c(x,b,r)){A=x;x=b;b=A}if(c(_,w,r)){A=_;_=w;w=A}var T=r[2*x];var S=r[2*x+1];var E=r[2*_];var C=r[2*_+1];var L=2*y;var I=2*b;var z=2*w;var P=2*p;var O=2*v;var D=2*d;for(var R=0;R<2;++R){var B=r[L+R];var F=r[I+R];var N=r[z+R];r[P+R]=B;r[O+R]=F;r[D+R]=N}s(g,t,r);s(m,e,r);for(var j=k;j<=M;++j){if(f(j,T,S,r)){if(j!==k){o(j,k,r)}++k}else{if(!f(j,E,C,r)){while(true){if(!f(M,E,C,r)){if(--M>>1;i(d,S);var E=0;var C=0;for(var k=0;k=o){L=L-o|0;g(c,f,C--,L)}else if(L>=0){g(l,u,E--,L)}else if(L<=-o){L=-L-o|0;for(var I=0;I>>1;i(d,E);var C=0;var L=0;var I=0;for(var M=0;M>1===d[2*M+3]>>1){P=2;M+=1}if(z<0){var O=-(z>>1)-1;for(var D=0;D>1)-1;if(P===0){g(l,u,C--,O)}else if(P===1){g(c,f,L--,O)}else if(P===2){g(h,p,I--,O)}}}}function b(t,e,r,n,a,s,c,f,h,p,v,y){var x=0;var b=2*t;var _=e;var w=e+t;var k=1;var M=1;if(n){M=o}else{k=o}for(var A=a;A>>1;i(d,C);var L=0;for(var A=0;A=o){z=!n;T-=o}else{z=!!n;T-=1}if(z){m(l,u,L++,T)}else{var P=y[T];var O=b*T;var D=v[O+e+1];var R=v[O+e+1+t];t:for(var B=0;B>>1;i(d,k);var M=0;for(var x=0;x=o){l[M++]=b-o}else{b-=1;var T=p[b];var S=g*b;var E=h[S+e+1];var C=h[S+e+1+t];t:for(var L=0;L=0;--L){if(l[L]===b){for(var O=L+1;Oi){throw new RangeError("Invalid typed array length")}var e=new Uint8Array(t);e.__proto__=l.prototype;return e}function l(t,e,r){if(typeof t==="number"){if(typeof e==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return h(t)}return u(t,e,r)}if(typeof Symbol!=="undefined"&&Symbol.species&&l[Symbol.species]===l){Object.defineProperty(l,Symbol.species,{value:null,configurable:true,enumerable:false,writable:false})}l.poolSize=8192;function u(t,e,r){if(typeof t==="number"){throw new TypeError('"value" argument must not be a number')}if(J(t)||t&&J(t.buffer)){return v(t,e,r)}if(typeof t==="string"){return p(t,e)}return g(t)}l.from=function(t,e,r){return u(t,e,r)};l.prototype.__proto__=Uint8Array.prototype;l.__proto__=Uint8Array;function c(t){if(typeof t!=="number"){throw new TypeError('"size" argument must be of type number')}else if(t<0){throw new RangeError('"size" argument must not be negative')}}function f(t,e,r){c(t);if(t<=0){return s(t)}if(e!==undefined){return typeof r==="string"?s(t).fill(e,r):s(t).fill(e)}return s(t)}l.alloc=function(t,e,r){return f(t,e,r)};function h(t){c(t);return s(t<0?0:m(t)|0)}l.allocUnsafe=function(t){return h(t)};l.allocUnsafeSlow=function(t){return h(t)};function p(t,e){if(typeof e!=="string"||e===""){e="utf8"}if(!l.isEncoding(e)){throw new TypeError("Unknown encoding: "+e)}var r=x(t,e)|0;var n=s(r);var a=n.write(t,e);if(a!==r){n=n.slice(0,a)}return n}function d(t){var e=t.length<0?0:m(t.length)|0;var r=s(e);for(var n=0;n=i){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+i.toString(16)+" bytes")}return t|0}function y(t){if(+t!=t){t=0}return l.alloc(+t)}l.isBuffer=function t(e){return e!=null&&e._isBuffer===true};l.compare=function t(e,r){if(!l.isBuffer(e)||!l.isBuffer(r)){throw new TypeError("Arguments must be Buffers")}if(e===r)return 0;var n=e.length;var a=r.length;for(var i=0,o=Math.min(n,a);i>>1;case"base64":return Z(t).length;default:if(n)return W(t).length;e=(""+e).toLowerCase();n=true}}}l.byteLength=x;function b(t,e,r){var n=false;if(e===undefined||e<0){e=0}if(e>this.length){return""}if(r===undefined||r>this.length){r=this.length}if(r<=0){return""}r>>>=0;e>>>=0;if(r<=e){return""}if(!t)t="utf8";while(true){switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return I(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return L(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase();n=true}}}l.prototype._isBuffer=true;function _(t,e,r){var n=t[e];t[e]=t[r];t[r]=n}l.prototype.swap16=function t(){var e=this.length;if(e%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var r=0;r0){e=this.toString("hex",0,n).match(/.{2}/g).join(" ");if(this.length>n)e+=" ... "}return""};l.prototype.compare=function t(e,r,n,a,i){if(!l.isBuffer(e)){throw new TypeError("Argument must be a Buffer")}if(r===undefined){r=0}if(n===undefined){n=e?e.length:0}if(a===undefined){a=0}if(i===undefined){i=this.length}if(r<0||n>e.length||a<0||i>this.length){throw new RangeError("out of range index")}if(a>=i&&r>=n){return 0}if(a>=i){return-1}if(r>=n){return 1}r>>>=0;n>>>=0;a>>>=0;i>>>=0;if(this===e)return 0;var o=i-a;var s=n-r;var u=Math.min(o,s);var c=this.slice(a,i);var f=e.slice(r,n);for(var h=0;h2147483647){r=2147483647}else if(r<-2147483648){r=-2147483648}r=+r;if(K(r)){r=a?0:t.length-1}if(r<0)r=t.length+r;if(r>=t.length){if(a)return-1;else r=t.length-1}else if(r<0){if(a)r=0;else return-1}if(typeof e==="string"){e=l.from(e,n)}if(l.isBuffer(e)){if(e.length===0){return-1}return k(t,e,r,n,a)}else if(typeof e==="number"){e=e&255;if(typeof Uint8Array.prototype.indexOf==="function"){if(a){return Uint8Array.prototype.indexOf.call(t,e,r)}else{return Uint8Array.prototype.lastIndexOf.call(t,e,r)}}return k(t,[e],r,n,a)}throw new TypeError("val must be string, number or Buffer")}function k(t,e,r,n,a){var i=1;var o=t.length;var s=e.length;if(n!==undefined){n=String(n).toLowerCase();if(n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le"){if(t.length<2||e.length<2){return-1}i=2;o/=2;s/=2;r/=2}}function l(t,e){if(i===1){return t[e]}else{return t.readUInt16BE(e*i)}}var u;if(a){var c=-1;for(u=r;uo)r=o-s;for(u=r;u>=0;u--){var f=true;for(var h=0;ha){n=a}}var i=e.length;if(n>i/2){n=i/2}for(var o=0;o>>0;if(isFinite(n)){n=n>>>0;if(a===undefined)a="utf8"}else{a=n;n=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var i=this.length-r;if(n===undefined||n>i)n=i;if(e.length>0&&(n<0||r<0)||r>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!a)a="utf8";var o=false;for(;;){switch(a){case"hex":return M(this,e,r,n);case"utf8":case"utf-8":return A(this,e,r,n);case"ascii":return T(this,e,r,n);case"latin1":case"binary":return S(this,e,r,n);case"base64":return E(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase();o=true}}};l.prototype.toJSON=function t(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function L(t,e,r){if(e===0&&r===t.length){return n.fromByteArray(t)}else{return n.fromByteArray(t.slice(e,r))}}function I(t,e,r){r=Math.min(t.length,r);var n=[];var a=e;while(a239?4:i>223?3:i>191?2:1;if(a+s<=r){var l,u,c,f;switch(s){case 1:if(i<128){o=i}break;case 2:l=t[a+1];if((l&192)===128){f=(i&31)<<6|l&63;if(f>127){o=f}}break;case 3:l=t[a+1];u=t[a+2];if((l&192)===128&&(u&192)===128){f=(i&15)<<12|(l&63)<<6|u&63;if(f>2047&&(f<55296||f>57343)){o=f}}break;case 4:l=t[a+1];u=t[a+2];c=t[a+3];if((l&192)===128&&(u&192)===128&&(c&192)===128){f=(i&15)<<18|(l&63)<<12|(u&63)<<6|c&63;if(f>65535&&f<1114112){o=f}}}}if(o===null){o=65533;s=1}else if(o>65535){o-=65536;n.push(o>>>10&1023|55296);o=56320|o&1023}n.push(o);a+=s}return P(n)}var z=4096;function P(t){var e=t.length;if(e<=z){return String.fromCharCode.apply(String,t)}var r="";var n=0;while(nn)r=n;var a="";for(var i=e;in){e=n}if(r<0){r+=n;if(r<0)r=0}else if(r>n){r=n}if(rr)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUIntLE=function t(e,r,n){e=e>>>0;r=r>>>0;if(!n)F(e,r,this.length);var a=this[e];var i=1;var o=0;while(++o>>0;r=r>>>0;if(!n){F(e,r,this.length)}var a=this[e+--r];var i=1;while(r>0&&(i*=256)){a+=this[e+--r]*i}return a};l.prototype.readUInt8=function t(e,r){e=e>>>0;if(!r)F(e,1,this.length);return this[e]};l.prototype.readUInt16LE=function t(e,r){e=e>>>0;if(!r)F(e,2,this.length);return this[e]|this[e+1]<<8};l.prototype.readUInt16BE=function t(e,r){e=e>>>0;if(!r)F(e,2,this.length);return this[e]<<8|this[e+1]};l.prototype.readUInt32LE=function t(e,r){e=e>>>0;if(!r)F(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};l.prototype.readUInt32BE=function t(e,r){e=e>>>0;if(!r)F(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};l.prototype.readIntLE=function t(e,r,n){e=e>>>0;r=r>>>0;if(!n)F(e,r,this.length);var a=this[e];var i=1;var o=0;while(++o=i)a-=Math.pow(2,8*r);return a};l.prototype.readIntBE=function t(e,r,n){e=e>>>0;r=r>>>0;if(!n)F(e,r,this.length);var a=r;var i=1;var o=this[e+--a];while(a>0&&(i*=256)){o+=this[e+--a]*i}i*=128;if(o>=i)o-=Math.pow(2,8*r);return o};l.prototype.readInt8=function t(e,r){e=e>>>0;if(!r)F(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};l.prototype.readInt16LE=function t(e,r){e=e>>>0;if(!r)F(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};l.prototype.readInt16BE=function t(e,r){e=e>>>0;if(!r)F(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};l.prototype.readInt32LE=function t(e,r){e=e>>>0;if(!r)F(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};l.prototype.readInt32BE=function t(e,r){e=e>>>0;if(!r)F(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};l.prototype.readFloatLE=function t(e,r){e=e>>>0;if(!r)F(e,4,this.length);return a.read(this,e,true,23,4)};l.prototype.readFloatBE=function t(e,r){e=e>>>0;if(!r)F(e,4,this.length);return a.read(this,e,false,23,4)};l.prototype.readDoubleLE=function t(e,r){e=e>>>0;if(!r)F(e,8,this.length);return a.read(this,e,true,52,8)};l.prototype.readDoubleBE=function t(e,r){e=e>>>0;if(!r)F(e,8,this.length);return a.read(this,e,false,52,8)};function N(t,e,r,n,a,i){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||et.length)throw new RangeError("Index out of range")}l.prototype.writeUIntLE=function t(e,r,n,a){e=+e;r=r>>>0;n=n>>>0;if(!a){var i=Math.pow(2,8*n)-1;N(this,e,r,n,i,0)}var o=1;var s=0;this[r]=e&255;while(++s>>0;n=n>>>0;if(!a){var i=Math.pow(2,8*n)-1;N(this,e,r,n,i,0)}var o=n-1;var s=1;this[r+o]=e&255;while(--o>=0&&(s*=256)){this[r+o]=e/s&255}return r+n};l.prototype.writeUInt8=function t(e,r,n){e=+e;r=r>>>0;if(!n)N(this,e,r,1,255,0);this[r]=e&255;return r+1};l.prototype.writeUInt16LE=function t(e,r,n){e=+e;r=r>>>0;if(!n)N(this,e,r,2,65535,0);this[r]=e&255;this[r+1]=e>>>8;return r+2};l.prototype.writeUInt16BE=function t(e,r,n){e=+e;r=r>>>0;if(!n)N(this,e,r,2,65535,0);this[r]=e>>>8;this[r+1]=e&255;return r+2};l.prototype.writeUInt32LE=function t(e,r,n){e=+e;r=r>>>0;if(!n)N(this,e,r,4,4294967295,0);this[r+3]=e>>>24;this[r+2]=e>>>16;this[r+1]=e>>>8;this[r]=e&255;return r+4};l.prototype.writeUInt32BE=function t(e,r,n){e=+e;r=r>>>0;if(!n)N(this,e,r,4,4294967295,0);this[r]=e>>>24;this[r+1]=e>>>16;this[r+2]=e>>>8;this[r+3]=e&255;return r+4};l.prototype.writeIntLE=function t(e,r,n,a){e=+e;r=r>>>0;if(!a){var i=Math.pow(2,8*n-1);N(this,e,r,n,i-1,-i)}var o=0;var s=1;var l=0;this[r]=e&255;while(++o>0)-l&255}return r+n};l.prototype.writeIntBE=function t(e,r,n,a){e=+e;r=r>>>0;if(!a){var i=Math.pow(2,8*n-1);N(this,e,r,n,i-1,-i)}var o=n-1;var s=1;var l=0;this[r+o]=e&255;while(--o>=0&&(s*=256)){if(e<0&&l===0&&this[r+o+1]!==0){l=1}this[r+o]=(e/s>>0)-l&255}return r+n};l.prototype.writeInt8=function t(e,r,n){e=+e;r=r>>>0;if(!n)N(this,e,r,1,127,-128);if(e<0)e=255+e+1;this[r]=e&255;return r+1};l.prototype.writeInt16LE=function t(e,r,n){e=+e;r=r>>>0;if(!n)N(this,e,r,2,32767,-32768);this[r]=e&255;this[r+1]=e>>>8;return r+2};l.prototype.writeInt16BE=function t(e,r,n){e=+e;r=r>>>0;if(!n)N(this,e,r,2,32767,-32768);this[r]=e>>>8;this[r+1]=e&255;return r+2};l.prototype.writeInt32LE=function t(e,r,n){e=+e;r=r>>>0;if(!n)N(this,e,r,4,2147483647,-2147483648);this[r]=e&255;this[r+1]=e>>>8;this[r+2]=e>>>16;this[r+3]=e>>>24;return r+4};l.prototype.writeInt32BE=function t(e,r,n){e=+e;r=r>>>0;if(!n)N(this,e,r,4,2147483647,-2147483648);if(e<0)e=4294967295+e+1;this[r]=e>>>24;this[r+1]=e>>>16;this[r+2]=e>>>8;this[r+3]=e&255;return r+4};function j(t,e,r,n,a,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function V(t,e,r,n,i){e=+e;r=r>>>0;if(!i){j(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38)}a.write(t,e,r,n,23,4);return r+4}l.prototype.writeFloatLE=function t(e,r,n){return V(this,e,r,true,n)};l.prototype.writeFloatBE=function t(e,r,n){return V(this,e,r,false,n)};function U(t,e,r,n,i){e=+e;r=r>>>0;if(!i){j(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308)}a.write(t,e,r,n,52,8);return r+8}l.prototype.writeDoubleLE=function t(e,r,n){return U(this,e,r,true,n)};l.prototype.writeDoubleBE=function t(e,r,n){return U(this,e,r,false,n)};l.prototype.copy=function t(e,r,n,a){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(!n)n=0;if(!a&&a!==0)a=this.length;if(r>=e.length)r=e.length;if(!r)r=0;if(a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");if(a>this.length)a=this.length;if(e.length-r=0;--o){e[o+r]=this[o+n]}}else{Uint8Array.prototype.set.call(e,this.subarray(n,a),r)}return i};l.prototype.fill=function t(e,r,n,a){if(typeof e==="string"){if(typeof r==="string"){a=r;r=0;n=this.length}else if(typeof n==="string"){a=n;n=this.length}if(a!==undefined&&typeof a!=="string"){throw new TypeError("encoding must be a string")}if(typeof a==="string"&&!l.isEncoding(a)){throw new TypeError("Unknown encoding: "+a)}if(e.length===1){var i=e.charCodeAt(0);if(a==="utf8"&&i<128||a==="latin1"){e=i}}}else if(typeof e==="number"){e=e&255}if(r<0||this.length>>0;n=n===undefined?this.length:n>>>0;if(!e)e=0;var o;if(typeof e==="number"){for(o=r;o55295&&r<57344){if(!a){if(r>56319){if((e-=3)>-1)i.push(239,191,189);continue}else if(o+1===n){if((e-=3)>-1)i.push(239,191,189);continue}a=r;continue}if(r<56320){if((e-=3)>-1)i.push(239,191,189);a=r;continue}r=(a-55296<<10|r-56320)+65536}else if(a){if((e-=3)>-1)i.push(239,191,189)}a=null;if(r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else{throw new Error("Invalid code point")}}return i}function Y(t){var e=[];for(var r=0;r>8;a=r%256;i.push(a);i.push(n)}return i}function Z(t){return n.toByteArray(H(t))}function $(t,e,r,n){for(var a=0;a=e.length||a>=t.length)break;e[a+r]=t[a]}return a}function J(t){return t instanceof ArrayBuffer||t!=null&&t.constructor!=null&&t.constructor.name==="ArrayBuffer"&&typeof t.byteLength==="number"}function K(t){return t!==t}},{"base64-js":62,ieee754:380}],93:[function(t,e,r){"use strict";var n=t("./lib/monotone");var a=t("./lib/triangulation");var i=t("./lib/delaunay");var o=t("./lib/filter");e.exports=f;function s(t){return[Math.min(t[0],t[1]),Math.max(t[0],t[1])]}function l(t,e){return t[0]-e[0]||t[1]-e[1]}function u(t){return t.map(s).sort(l)}function c(t,e,r){if(e in t){return t[e]}return r}function f(t,e,r){if(!Array.isArray(e)){r=e||{};e=[]}else{r=r||{};e=e||[]}var s=!!c(r,"delaunay",true);var l=!!c(r,"interior",true);var f=!!c(r,"exterior",true);var h=!!c(r,"infinity",false);if(!l&&!f||t.length===0){return[]}var p=n(t,e);if(s||l!==f||h){var d=a(t.length,u(e));for(var v=0;v0){var c=r.pop();var s=r.pop();var f=-1,h=-1;var l=o[s];for(var d=1;d=0){continue}e.flip(s,c);i(t,e,r,f,s,h);i(t,e,r,s,h,f);i(t,e,r,h,c,f);i(t,e,r,c,f,h)}}},{"binary-search-bounds":98,"robust-in-sphere":469}],95:[function(t,e,r){"use strict";var n=t("binary-search-bounds");e.exports=u;function a(t,e,r,n,a,i,o){this.cells=t;this.neighbor=e;this.flags=n;this.constraint=r;this.active=a;this.next=i;this.boundary=o}var i=a.prototype;function o(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}i.locate=function(){var t=[0,0,0];return function(e,r,a){var i=e,s=r,l=a;if(r0||o.length>0){while(i.length>0){var p=i.pop();if(u[p]===-a){continue}u[p]=a;var d=c[p];for(var v=0;v<3;++v){var g=h[3*p+v];if(g>=0&&u[g]===0){if(f[3*p+v]){o.push(g)}else{i.push(g);u[g]=a}}}}var m=o;o=i;i=m;o.length=0;a=-a}var y=l(c,u,e);if(r){return y.concat(n.boundary)}return y}},{"binary-search-bounds":98}],96:[function(t,e,r){"use strict";var n=t("binary-search-bounds");var a=t("robust-orientation")[3];var i=0;var o=1;var s=2;e.exports=g;function l(t,e,r,n,a){this.a=t;this.b=e;this.idx=r;this.lowerIds=n;this.upperIds=a}function u(t,e,r,n){this.a=t;this.b=e;this.type=r;this.idx=n}function c(t,e){var r=t.a[0]-e.a[0]||t.a[1]-e.a[1]||t.type-e.type;if(r){return r}if(t.type!==i){r=a(t.a,t.b,e.b);if(r){return r}}return t.idx-e.idx}function f(t,e){return a(t.a,t.b,e)}function h(t,e,r,i,o){var s=n.lt(e,i,f);var l=n.gt(e,i,f);for(var u=s;u1&&a(r[h[p-2]],r[h[p-1]],i)>0){t.push([h[p-1],h[p-2],o]);p-=1}h.length=p;h.push(o);var d=c.upperIds;var p=d.length;while(p>1&&a(r[d[p-2]],r[d[p-1]],i)<0){t.push([d[p-2],d[p-1],o]);p-=1}d.length=p;d.push(o)}}function p(t,e){var r;if(t.a[0]m[0]){a.push(new u(m,g,s,f),new u(g,m,o,f))}}a.sort(c);var y=a[0].a[0]-(1+Math.abs(a[0].a[0]))*Math.pow(2,-52);var x=[new l([y,1],[y,0],-1,[],[],[],[])];var b=[];for(var f=0,_=a.length;f<_;++f){var w=a[f];var k=w.type;if(k===i){h(b,x,t,w.a,w.idx)}else if(k===s){d(x,t,w)}else{v(x,t,w)}}return b}},{"binary-search-bounds":98,"robust-orientation":471}],97:[function(t,e,r){"use strict";var n=t("binary-search-bounds");e.exports=s;function a(t,e){this.stars=t;this.edges=e}var i=a.prototype;function o(t,e,r){for(var n=1,a=t.length;n=0}}();i.removeTriangle=function(t,e,r){var n=this.stars;o(n[t],e,r);o(n[e],r,t);o(n[r],t,e)};i.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r);n[e].push(r,t);n[r].push(t,e)};i.opposite=function(t,e){var r=this.stars[e];for(var n=1,a=r.length;n>>1,x=a[m]"];if(a){if(e.indexOf("c")<0){i.push(";if(x===y){return m}else if(x<=y){")}else{i.push(";var p=c(x,y);if(p===0){return m}else if(p<=0){")}}else{i.push(";if(",e,"){i=m;")}if(r){i.push("l=m+1}else{h=m-1}")}else{i.push("h=m-1}else{l=m+1}")}i.push("}");if(a){i.push("return -1};")}else{i.push("return i};")}return i.join("")}function a(t,e,r,a){var i=new Function([n("A","x"+t+"y",e,["y"],a),n("P","c(x,y)"+t+"0",e,["y","c"],a),"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 i()}e.exports={ge:a(">=",false,"GE"),gt:a(">",false,"GT"),lt:a("<",true,"LT"),le:a("<=",true,"LE"),eq:a("-",true,"EQ",true)}},{}],99:[function(t,e,r){"use strict";e.exports=n;function n(t){var e=1;for(var r=1;rr?r:t:te?e:t}},{}],103:[function(t,e,r){"use strict";e.exports=M;var n=t("union-find");var a=t("box-intersect");var i=t("robust-segment-intersect");var o=t("big-rat");var s=t("big-rat/cmp");var l=t("big-rat/to-float");var u=t("rat-vec");var c=t("nextafter");var f=t("./lib/rat-seg-intersect");function h(t){var e=l(t);return[c(e,-Infinity),c(e,Infinity)]}function p(t,e){var r=new Array(e.length);for(var n=0;n=0;--i){var x=n[i];c=x[0];var b=e[c];var _=b[0];var w=b[1];var k=t[_];var M=t[w];if((k[0]-M[0]||k[1]-M[1])<0){var A=_;_=w;w=A}b[0]=_;var T=b[1]=x[1];var S;if(a){S=b[2]}while(i>0&&n[i-1][0]===c){var x=n[--i];var E=x[1];if(a){e.push([T,E,S])}else{e.push([T,E])}T=E}if(a){e.push([T,w,S])}else{e.push([T,w])}}return h}function y(t,e,r){var i=e.length;var o=new n(i);var s=[];for(var l=0;le[2]){return 1}return 0}function _(t,e,r){if(t.length===0){return}if(e){for(var n=0;n0||o.length>0}return true}function M(t,e,r){var n;if(r){n=e;var a=new Array(e.length);for(var i=0;i>>24;var n=(t&16711680)>>>16;var a=(t&65280)>>>8;var i=t&255;if(e===false)return[r,n,a,i];return[r/255,n/255,a/255,i/255]}},{clamp:102}],106:[function(t,e,r){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],107:[function(t,e,r){"use strict";var n=t("color-rgba");var a=t("clamp");var i=t("dtype");e.exports=function t(e,r){if(r==="float"||!r)r="array";if(r==="uint")r="uint8";if(r==="uint_clamped")r="uint8_clamped";var o=i(r);var s=new o(4);if(e instanceof o){if(Array.isArray(e)){return e.slice()}s.set(e);return s}var t=r!=="uint8"&&r!=="uint8_clamped";if(e instanceof Uint8Array||e instanceof Uint8ClampedArray){s[0]=e[0];s[1]=e[1];s[2]=e[2];s[3]=e[3]!=null?e[3]:255;if(t){s[0]/=255;s[1]/=255;s[2]/=255;s[3]/=255}return s}if(!e.length||typeof e==="string"){e=n(e);e[0]/=255;e[1]/=255;e[2]/=255}if(!t){s[0]=a(Math.round(e[0]*255),0,255);s[1]=a(Math.round(e[1]*255),0,255);s[2]=a(Math.round(e[2]*255),0,255);s[3]=e[3]==null?255:a(Math.floor(e[3]*255),0,255)}else{s[0]=e[0];s[1]=e[1];s[2]=e[2];s[3]=e[3]!=null?e[3]:1}return s}},{clamp:102,"color-rgba":109,dtype:153}],108:[function(t,e,r){(function(r){"use strict";var n=t("color-name");var a=t("is-plain-obj");var i=t("defined");e.exports=s;var o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function s(t){var e,s=[],l=1,u;if(typeof t==="string"){if(n[t]){s=n[t].slice();u="rgb"}else if(t==="transparent"){l=0;u="rgb";s=[0,0,0]}else if(/^#[A-Fa-f0-9]+$/.test(t)){var c=t.slice(1);var f=c.length;var h=f<=4;l=1;if(h){s=[parseInt(c[0]+c[0],16),parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16)];if(f===4){l=parseInt(c[3]+c[3],16)/255}}else{s=[parseInt(c[0]+c[1],16),parseInt(c[2]+c[3],16),parseInt(c[4]+c[5],16)];if(f===8){l=parseInt(c[6]+c[7],16)/255}}if(!s[0])s[0]=0;if(!s[1])s[1]=0;if(!s[2])s[2]=0;u="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var p=e[1];var c=p.replace(/a$/,"");u=c;var f=c==="cmyk"?4:c==="gray"?1:3;s=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t)){if(e===f)return parseFloat(t)/100;if(c==="rgb")return parseFloat(t)*255/100;return parseFloat(t)}else if(c[e]==="h"){if(/deg$/.test(t)){return parseFloat(t)}else if(o[t]!==undefined){return o[t]}}return parseFloat(t)});if(p===c)s.push(1);l=s[f]===undefined?1:s[f];s=s.slice(0,f)}else if(t.length>10&&/[0-9](?:\s|\/)/.test(t)){s=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)});u=t.match(/([a-z])/ig).join("").toLowerCase()}}else if(typeof t==="number"){u="rgb";s=[t>>>16,(t&65280)>>>8,t&255]}else if(a(t)){var d=i(t.r,t.red,t.R,null);if(d!==null){u="rgb";s=[d,i(t.g,t.green,t.G),i(t.b,t.blue,t.B)]}else{u="hsl";s=[i(t.h,t.hue,t.H),i(t.s,t.saturation,t.S),i(t.l,t.lightness,t.L,t.b,t.brightness)]}l=i(t.a,t.alpha,t.opacity,1);if(t.opacity!=null)l/=100}else if(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t)){s=[t[0],t[1],t[2]];u="rgb";l=t.length===4?t[3]:1}return{space:u,values:s,alpha:l}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"color-name":106,defined:148,"is-plain-obj":390}],109:[function(t,e,r){"use strict";var n=t("color-parse");var a=t("color-space/hsl");var i=t("clamp");e.exports=function t(e){var r,o,s;if(typeof e!=="string")throw Error("Argument should be a string");var l=n(e);if(!l.space)return[];r=Array(3);r[0]=i(l.values[0],0,255);r[1]=i(l.values[1],0,255);r[2]=i(l.values[2],0,255);if(l.space[0]==="h"){r=a.rgb(r)}r.push(i(l.alpha,0,1));return r}},{clamp:102,"color-parse":108,"color-space/hsl":110}],110:[function(t,e,r){"use strict";var n=t("./rgb");e.exports={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e=t[0]/360,r=t[1]/100,n=t[2]/100,a,i,o,s,l;if(r===0){l=n*255;return[l,l,l]}if(n<.5){i=n*(1+r)}else{i=n+r-n*r}a=2*n-i;s=[0,0,0];for(var u=0;u<3;u++){o=e+1/3*-(u-1);if(o<0){o++}else if(o>1){o--}if(6*o<1){l=a+(i-a)*6*o}else if(2*o<1){l=i}else if(3*o<2){l=a+(i-a)*(2/3-o)*6}else{l=a}s[u]=l*255}return s}};n.hsl=function(t){var e=t[0]/255,r=t[1]/255,n=t[2]/255,a=Math.min(e,r,n),i=Math.max(e,r,n),o=i-a,s,l,u;if(i===a){s=0}else if(e===i){s=(r-n)/o}else if(r===i){s=2+(n-e)/o}else if(n===i){s=4+(e-r)/o}s=Math.min(s*60,360);if(s<0){s+=360}u=(a+i)/2;if(i===a){l=0}else if(u<=.5){l=o/(i+a)}else{l=o/(2-i-a)}return[s,l*100,u*100]}},{"./rgb":111}],111:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],112:[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:1,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]}},{}],113:[function(t,e,r){"use strict";var n=t("./colorScale");var a=t("lerp");e.exports=i;function i(t){var e,r,i,u,c,f,h,p,d,v,g,m,y,x=[],b=[],_=[],w=[];if(!t)t={};d=(t.nshades||72)-1;p=t.format||"hex";h=t.colormap;if(!h)h="jet";if(typeof h==="string"){h=h.toLowerCase();if(!n[h]){throw Error(h+" not a supported colorscale")}f=n[h]}else if(Array.isArray(h)){f=h.slice()}else{throw Error("unsupported colormap option",h)}if(f.length>d){throw new Error(h+" map requires nshades to be at least size "+f.length)}if(!Array.isArray(t.alpha)){if(typeof t.alpha==="number"){g=[t.alpha,t.alpha]}else{g=[1,1]}}else if(t.alpha.length!==2){g=[1,1]}else{g=t.alpha.slice()}e=f.map(function(t){return Math.round(t.index*d)});g[0]=Math.min(Math.max(g[0],0),1);g[1]=Math.min(Math.max(g[1],0),1);var k=f.map(function(t,e){var r=f[e].index;var n=f[e].rgb.slice();if(n.length===4&&n[3]>=0&&n[3]<=1){return n}n[3]=g[0]+(g[1]-g[0])*r;return n});var v=[];for(y=0;y=0}function u(t,e,r,i){var o=n(e,r,i);if(o===0){var s=a(n(t,e,r));var u=a(n(t,e,i));if(s===u){if(s===0){var c=l(t,e,r);var f=l(t,e,i);if(c===f){return 0}else if(c){return 1}else{return-1}}return 0}else if(u===0){if(s>0){return-1}else if(l(t,e,i)){return-1}else{return 1}}else if(s===0){if(u>0){return 1}else if(l(t,e,r)){return 1}else{return-1}}return a(u-s)}var h=n(t,e,r);if(h>0){if(o>0&&n(t,e,i)>0){return 1}return-1}else if(h<0){if(o>0||n(t,e,i)>0){return 1}return-1}else{var p=n(t,e,i);if(p>0){return 1}else{if(l(t,e,r)){return 1}else{return-1}}}}},{"robust-orientation":471,"robust-product":472,"robust-sum":476,signum:477,"two-sum":506}],115:[function(t,e,r){e.exports=i;var n=Math.min;function a(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]||n(t[0],t[1])-n(e[0],e[1]);case 3:var o=t[0]+t[1],s=e[0]+e[1];i=o+t[2]-(s+e[2]);if(i){return i}var l=n(t[0],t[1]),u=n(e[0],e[1]);return n(l,t[2])-n(u,e[2])||n(l+t[2],o)-n(u+e[2],s);case 4:var c=t[0],f=t[1],h=t[2],p=t[3],d=e[0],v=e[1],g=e[2],m=e[3];return c+f+h+p-(d+v+g+m)||n(c,f,h,p)-n(d,v,g,m,d)||n(c+f,c+h,c+p,f+h,f+p,h+p)-n(d+v,d+g,d+m,v+g,v+m,g+m)||n(c+f+h,c+f+p,c+h+p,f+h+p)-n(d+v+g,d+v+m,d+g+m,v+g+m);default:var y=t.slice().sort(a);var x=e.slice().sort(a);for(var b=0;bt[r][0]){r=n}}if(er){return[[r],[e]]}else{return[[e]]}}},{}],119:[function(t,e,r){"use strict";e.exports=a;var n=t("monotone-convex-hull-2d");function a(t){var e=n(t);var r=e.length;if(r<=2){return[]}var a=new Array(r);var i=e[r-1];for(var o=0;o=e[l]){s+=1}}i[o]=s}}}return t}function s(t,e){try{return n(t,true)}catch(u){var r=a(t);if(r.length<=e){return[]}var s=i(t,r);var l=n(s,true);return o(l,r)}}},{"affine-hull":53,"incremental-convex-hull":381}],121:[function(t,e,r){e.exports={AFG:"afghan",ALA:"\\b\\wland",ALB:"albania",DZA:"algeria",ASM:"^(?=.*americ).*samoa",AND:"andorra",AGO:"angola",AIA:"anguill?a",ATA:"antarctica",ATG:"antigua",ARG:"argentin",ARM:"armenia",ABW:"^(?!.*bonaire).*\\baruba",AUS:"australia",AUT:"^(?!.*hungary).*austria|\\baustri.*\\bemp",AZE:"azerbaijan",BHS:"bahamas",BHR:"bahrain",BGD:"bangladesh|^(?=.*east).*paki?stan",BRB:"barbados",BLR:"belarus|byelo",BEL:"^(?!.*luxem).*belgium",BLZ:"belize|^(?=.*british).*honduras",BEN:"benin|dahome",BMU:"bermuda",BTN:"bhutan",BOL:"bolivia",BES:"^(?=.*bonaire).*eustatius|^(?=.*carib).*netherlands|\\bbes.?islands",BIH:"herzegovina|bosnia",BWA:"botswana|bechuana",BVT:"bouvet",BRA:"brazil",IOT:"british.?indian.?ocean",BRN:"brunei",BGR:"bulgaria",BFA:"burkina|\\bfaso|upper.?volta",BDI:"burundi",CPV:"verde",KHM:"cambodia|kampuchea|khmer",CMR:"cameroon",CAN:"canada",CYM:"cayman",CAF:"\\bcentral.african.republic",TCD:"\\bchad",CHL:"\\bchile",CHN:"^(?!.*\\bmac)(?!.*\\bhong)(?!.*\\btai)(?!.*\\brep).*china|^(?=.*peo)(?=.*rep).*china",CXR:"christmas",CCK:"\\bcocos|keeling",COL:"colombia",COM:"comoro",COG:"^(?!.*\\bdem)(?!.*\\bd[\\.]?r)(?!.*kinshasa)(?!.*zaire)(?!.*belg)(?!.*l.opoldville)(?!.*free).*\\bcongo",COK:"\\bcook",CRI:"costa.?rica",CIV:"ivoire|ivory",HRV:"croatia",CUB:"\\bcuba",CUW:"^(?!.*bonaire).*\\bcura(c|\xe7)ao",CYP:"cyprus",CSK:"czechoslovakia",CZE:"^(?=.*rep).*czech|czechia|bohemia",COD:"\\bdem.*congo|congo.*\\bdem|congo.*\\bd[\\.]?r|\\bd[\\.]?r.*congo|belgian.?congo|congo.?free.?state|kinshasa|zaire|l.opoldville|drc|droc|rdc",DNK:"denmark",DJI:"djibouti",DMA:"dominica(?!n)",DOM:"dominican.rep",ECU:"ecuador",EGY:"egypt",SLV:"el.?salvador",GNQ:"guine.*eq|eq.*guine|^(?=.*span).*guinea",ERI:"eritrea",EST:"estonia",ETH:"ethiopia|abyssinia",FLK:"falkland|malvinas",FRO:"faroe|faeroe",FJI:"fiji",FIN:"finland",FRA:"^(?!.*\\bdep)(?!.*martinique).*france|french.?republic|\\bgaul",GUF:"^(?=.*french).*guiana",PYF:"french.?polynesia|tahiti",ATF:"french.?southern",GAB:"gabon",GMB:"gambia",GEO:"^(?!.*south).*georgia",DDR:"german.?democratic.?republic|democratic.?republic.*germany|east.germany",DEU:"^(?!.*east).*germany|^(?=.*\\bfed.*\\brep).*german",GHA:"ghana|gold.?coast",GIB:"gibraltar",GRC:"greece|hellenic|hellas",GRL:"greenland",GRD:"grenada",GLP:"guadeloupe",GUM:"\\bguam",GTM:"guatemala",GGY:"guernsey",GIN:"^(?!.*eq)(?!.*span)(?!.*bissau)(?!.*portu)(?!.*new).*guinea",GNB:"bissau|^(?=.*portu).*guinea",GUY:"guyana|british.?guiana",HTI:"haiti",HMD:"heard.*mcdonald",VAT:"holy.?see|vatican|papal.?st",HND:"^(?!.*brit).*honduras",HKG:"hong.?kong",HUN:"^(?!.*austr).*hungary",ISL:"iceland",IND:"india(?!.*ocea)",IDN:"indonesia",IRN:"\\biran|persia",IRQ:"\\biraq|mesopotamia",IRL:"(^ireland)|(^republic.*ireland)",IMN:"^(?=.*isle).*\\bman",ISR:"israel",ITA:"italy",JAM:"jamaica",JPN:"japan",JEY:"jersey",JOR:"jordan",KAZ:"kazak",KEN:"kenya|british.?east.?africa|east.?africa.?prot",KIR:"kiribati",PRK:"^(?=.*democrat|people|north|d.*p.*.r).*\\bkorea|dprk|korea.*(d.*p.*r)",KWT:"kuwait",KGZ:"kyrgyz|kirghiz",LAO:"\\blaos?\\b",LVA:"latvia",LBN:"lebanon",LSO:"lesotho|basuto",LBR:"liberia",LBY:"libya",LIE:"liechtenstein",LTU:"lithuania",LUX:"^(?!.*belg).*luxem",MAC:"maca(o|u)",MDG:"madagascar|malagasy",MWI:"malawi|nyasa",MYS:"malaysia",MDV:"maldive",MLI:"\\bmali\\b",MLT:"\\bmalta",MHL:"marshall",MTQ:"martinique",MRT:"mauritania",MUS:"mauritius",MYT:"\\bmayotte",MEX:"\\bmexic",FSM:"fed.*micronesia|micronesia.*fed",MCO:"monaco",MNG:"mongolia",MNE:"^(?!.*serbia).*montenegro",MSR:"montserrat",MAR:"morocco|\\bmaroc",MOZ:"mozambique",MMR:"myanmar|burma",NAM:"namibia",NRU:"nauru",NPL:"nepal",NLD:"^(?!.*\\bant)(?!.*\\bcarib).*netherlands",ANT:"^(?=.*\\bant).*(nether|dutch)",NCL:"new.?caledonia",NZL:"new.?zealand",NIC:"nicaragua",NER:"\\bniger(?!ia)",NGA:"nigeria",NIU:"niue",NFK:"norfolk",MNP:"mariana",NOR:"norway",OMN:"\\boman|trucial",PAK:"^(?!.*east).*paki?stan",PLW:"palau",PSE:"palestin|\\bgaza|west.?bank",PAN:"panama",PNG:"papua|new.?guinea",PRY:"paraguay",PER:"peru",PHL:"philippines",PCN:"pitcairn",POL:"poland",PRT:"portugal",PRI:"puerto.?rico",QAT:"qatar",KOR:"^(?!.*d.*p.*r)(?!.*democrat)(?!.*people)(?!.*north).*\\bkorea(?!.*d.*p.*r)",MDA:"moldov|b(a|e)ssarabia",REU:"r(e|\xe9)union",ROU:"r(o|u|ou)mania",RUS:"\\brussia|soviet.?union|u\\.?s\\.?s\\.?r|socialist.?republics",RWA:"rwanda",BLM:"barth(e|\xe9)lemy",SHN:"helena",KNA:"kitts|\\bnevis",LCA:"\\blucia",MAF:"^(?=.*collectivity).*martin|^(?=.*france).*martin(?!ique)|^(?=.*french).*martin(?!ique)",SPM:"miquelon",VCT:"vincent",WSM:"^(?!.*amer).*samoa",SMR:"san.?marino",STP:"\\bs(a|\xe3)o.?tom(e|\xe9)",SAU:"\\bsa\\w*.?arabia",SEN:"senegal",SRB:"^(?!.*monte).*serbia",SYC:"seychell",SLE:"sierra",SGP:"singapore",SXM:"^(?!.*martin)(?!.*saba).*maarten",SVK:"^(?!.*cze).*slovak",SVN:"slovenia",SLB:"solomon",SOM:"somali",ZAF:"south.africa|s\\\\..?africa",SGS:"south.?georgia|sandwich",SSD:"\\bs\\w*.?sudan",ESP:"spain",LKA:"sri.?lanka|ceylon",SDN:"^(?!.*\\bs(?!u)).*sudan",SUR:"surinam|dutch.?guiana",SJM:"svalbard",SWZ:"swaziland",SWE:"sweden",CHE:"switz|swiss",SYR:"syria",TWN:"taiwan|taipei|formosa|^(?!.*peo)(?=.*rep).*china",TJK:"tajik",THA:"thailand|\\bsiam",MKD:"macedonia|fyrom",TLS:"^(?=.*leste).*timor|^(?=.*east).*timor",TGO:"togo",TKL:"tokelau",TON:"tonga",TTO:"trinidad|tobago",TUN:"tunisia",TUR:"turkey",TKM:"turkmen",TCA:"turks",TUV:"tuvalu",UGA:"uganda",UKR:"ukrain",ARE:"emirates|^u\\.?a\\.?e\\.?$|united.?arab.?em",GBR:"united.?kingdom|britain|^u\\.?k\\.?$",TZA:"tanzania",USA:"united.?states\\b(?!.*islands)|\\bu\\.?s\\.?a\\.?\\b|^\\s*u\\.?s\\.?\\b(?!.*islands)",UMI:"minor.?outlying.?is",URY:"uruguay",UZB:"uzbek",VUT:"vanuatu|new.?hebrides",VEN:"venezuela",VNM:"^(?!.*republic).*viet.?nam|^(?=.*socialist).*viet.?nam",VGB:"^(?=.*\\bu\\.?\\s?k).*virgin|^(?=.*brit).*virgin|^(?=.*kingdom).*virgin",VIR:"^(?=.*\\bu\\.?\\s?s).*virgin|^(?=.*states).*virgin",WLF:"futuna|wallis",ESH:"western.sahara",YEM:"^(?!.*arab)(?!.*north)(?!.*sana)(?!.*peo)(?!.*dem)(?!.*south)(?!.*aden)(?!.*\\bp\\.?d\\.?r).*yemen",YMD:"^(?=.*peo).*yemen|^(?!.*rep)(?=.*dem).*yemen|^(?=.*south).*yemen|^(?=.*aden).*yemen|^(?=.*\\bp\\.?d\\.?r).*yemen",YUG:"yugoslavia",ZMB:"zambia|northern.?rhodesia",EAZ:"zanzibar",ZWE:"zimbabwe|^(?!.*northern).*rhodesia"}},{}],122:[function(t,e,r){e.exports=["xx-small","x-small","small","medium","large","x-large","xx-large","larger","smaller"]},{}],123:[function(t,e,r){e.exports=["normal","condensed","semi-condensed","extra-condensed","ultra-condensed","expanded","semi-expanded","extra-expanded","ultra-expanded"]},{}],124:[function(t,e,r){e.exports=["normal","italic","oblique"]},{}],125:[function(t,e,r){e.exports=["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"]},{}],126:[function(t,e,r){"use strict";e.exports={parse:t("./parse"),stringify:t("./stringify")}},{"./parse":128,"./stringify":129}],127:[function(t,e,r){"use strict";var n=t("css-font-size-keywords");e.exports={isSize:function t(e){return/^[\d\.]/.test(e)||e.indexOf("/")!==-1||n.indexOf(e)!==-1}}},{"css-font-size-keywords":122}],128:[function(t,e,r){"use strict";var n=t("unquote");var a=t("css-global-keywords");var i=t("css-system-font-keywords");var o=t("css-font-weight-keywords");var s=t("css-font-style-keywords");var l=t("css-font-stretch-keywords");var u=t("string-split-by");var c=t("./lib/util").isSize;e.exports=h;var f=h.cache={};function h(t){if(typeof t!=="string")throw new Error("Font argument must be a string.");if(f[t])return f[t];if(t===""){throw new Error("Cannot parse an empty string.")}if(i.indexOf(t)!==-1){return f[t]={system:t}}var e={style:"normal",variant:"normal",weight:"normal",stretch:"normal",lineHeight:"normal",size:"1rem",family:["serif"]};var r=u(t,/\s+/);var h;while(h=r.shift()){if(a.indexOf(h)!==-1){["style","variant","weight","stretch"].forEach(function(t){e[t]=h});return f[t]=e}if(s.indexOf(h)!==-1){e.style=h;continue}if(h==="normal"||h==="small-caps"){e.variant=h;continue}if(l.indexOf(h)!==-1){e.stretch=h;continue}if(o.indexOf(h)!==-1){e.weight=h;continue}if(c(h)){var d=u(h,"/");e.size=d[0];if(d[1]!=null){e.lineHeight=p(d[1])}else if(r[0]==="/"){r.shift();e.lineHeight=p(r.shift())}if(!r.length){throw new Error("Missing required font-family.")}e.family=u(r.join(" "),/\s*,\s*/).map(n);return f[t]=e}throw new Error("Unknown or unsupported font token: "+h)}throw new Error("Missing required font-size.")}function p(t){var e=parseFloat(t);if(e.toString()===t){return e}return t}},{"./lib/util":127,"css-font-stretch-keywords":123,"css-font-style-keywords":124,"css-font-weight-keywords":125,"css-global-keywords":130,"css-system-font-keywords":131,"string-split-by":490,unquote:510}],129:[function(t,e,r){"use strict";var n=t("pick-by-alias");var a=t("./lib/util").isSize;var i=d(t("css-global-keywords"));var o=d(t("css-system-font-keywords"));var s=d(t("css-font-weight-keywords"));var l=d(t("css-font-style-keywords"));var u=d(t("css-font-stretch-keywords"));var c={normal:1,"small-caps":1};var f={serif:1,"sans-serif":1,monospace:1,cursive:1,fantasy:1,"system-ui":1};var h={style:"normal",variant:"normal",weight:"normal",stretch:"normal",size:"1rem",lineHeight:"normal",family:"serif"};e.exports=function t(e){e=n(e,{style:"style fontstyle fontStyle font-style slope distinction",variant:"variant font-variant fontVariant fontvariant var capitalization",weight:"weight w font-weight fontWeight fontweight",stretch:"stretch font-stretch fontStretch fontstretch width",size:"size s font-size fontSize fontsize height em emSize",lineHeight:"lh line-height lineHeight lineheight leading",family:"font family fontFamily font-family fontfamily type typeface face",system:"system reserved default global"});if(e.system){if(e.system)p(e.system,o);return e.system}p(e.style,l);p(e.variant,c);p(e.weight,s);p(e.stretch,u);if(e.size==null)e.size=h.size;if(typeof e.size==="number")e.size+="px";if(!a)throw Error("Bad size value `"+e.size+"`");if(!e.family)e.family=h.family;if(Array.isArray(e.family)){if(!e.family.length)e.family=[h.family];e.family=e.family.map(function(t){return f[t]?t:'"'+t+'"'}).join(", ")}var r=[];r.push(e.style);if(e.variant!==e.style)r.push(e.variant);if(e.weight!==e.variant&&e.weight!==e.style)r.push(e.weight);if(e.stretch!==e.weight&&e.stretch!==e.variant&&e.stretch!==e.style)r.push(e.stretch);r.push(e.size+(e.lineHeight==null||e.lineHeight==="normal"||e.lineHeight+""==="1"?"":"/"+e.lineHeight));r.push(e.family);return r.filter(Boolean).join(" ")};function p(t,e){if(t&&!e[t]&&!i[t])throw Error("Unknown keyword `"+t+"`");return t}function d(t){var e={};for(var r=0;r=0;--c){i[c]=o*t[c]+s*e[c]+l*r[c]+u*n[c]}return i}return o*t+s*e+l*r[c]+u*n}function a(t,e,r,n,a,i){var o=a-1,s=a*a,l=o*o,u=(1+2*a)*l,c=a*l,f=s*(3-2*a),h=s*o;if(t.length){if(!i){i=new Array(t.length)}for(var p=t.length-1;p>=0;--p){i[p]=u*t[p]+c*e[p]+f*r[p]+h*n[p]}return i}return u*t+c*e+f*r+h*n}e.exports=a;e.exports.derivative=n},{}],133:[function(t,e,r){"use strict";var n=t("./lib/thunk.js");function a(){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=false}function i(t){var e=new a;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;i0){throw new Error("cwise: pre() block may not reference array args")}if(i0){throw new Error("cwise: post() block may not reference array args")}}else if(o==="scalar"){e.scalarArgs.push(i);e.shimArgs.push("scalar"+i)}else if(o==="index"){e.indexArgs.push(i);if(i0){throw new Error("cwise: pre() block may not reference array index")}if(i0){throw new Error("cwise: post() block may not reference array index")}}else if(o==="shape"){e.shapeArgs.push(i);if(ir.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")}e.debug=!!t.printCode||!!t.debug;e.funcName=t.funcName||"cwise";e.blockSize=t.blockSize||64;return n(e)}e.exports=i},{"./lib/thunk.js":135}],134:[function(t,e,r){"use strict";var n=t("uniq");function a(t,e,r){var n=t.length,a=e.arrayArgs.length,i=e.indexArgs.length>0,o=[],s=[],l=0,u=0,c,f;for(c=0;c0){o.push("var "+s.join(","))}for(c=n-1;c>=0;--c){l=t[c];o.push(["for(i",c,"=0;i",c,"0){o.push(["index[",u,"]-=s",u].join(""))}o.push(["++index[",l,"]"].join(""))}o.push("}")}return o.join("\n")}function i(t,e,r,n){var i=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,u=[];for(var c=0;c0;){"].join(""));u.push(["if(j",c,"<",s,"){"].join(""));u.push(["s",e[c],"=j",c].join(""));u.push(["j",c,"=0"].join(""));u.push(["}else{s",e[c],"=",s].join(""));u.push(["j",c,"-=",s,"}"].join(""));if(l){u.push(["index[",e[c],"]=j",c].join(""))}}for(var c=0;c0){r=r&&e[n]===e[n-1]}}if(r){return e[0]}return e.join("")}function u(t,e){var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0;var u=new Array(t.arrayArgs.length);var c=new Array(t.arrayArgs.length);for(var f=0;f0){_.push("shape=SS.slice(0)")}if(t.indexArgs.length>0){var w=new Array(r);for(var f=0;f0){b.push("var "+_.join(","))}for(var f=0;f3){b.push(s(t.pre,t,c))}var T=s(t.body,t,c);var S=o(g);if(S3){b.push(s(t.post,t,c))}if(t.debug){console.log("-----Generated cwise routine for ",e,":\n"+b.join("\n")+"\n----------")}var E=[t.funcName||"unnamed","_cwise_loop_",u[0].join("s"),"m",S,l(c)].join("");var C=new Function(["function ",E,"(",x.join(","),"){",b.join("\n"),"} return ",E].join(""));return C()}e.exports=u},{uniq:509}],135:[function(t,e,r){"use strict";var n=t("./compile.js");function a(t){var e=["'use strict'","var CACHED={}"];var r=[];var a=t.funcName+"_cwise_thunk";e.push(["return function ",a,"(",t.shimArgs.join(","),"){"].join(""));var i=[];var o=[];var s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")];var l=[],u=[];for(var c=0;c0){l.push("array"+t.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[c])));u.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[c])+"]")}}if(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--\x3e0;) {");e.push("if (!("+u.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')");e.push("}")}for(var c=0;ce?1:t>=e?0:NaN};var r=function(t){if(t.length===1)t=n(t);return{left:function(e,r,n,a){if(n==null)n=0;if(a==null)a=e.length;while(n>>1;if(t(e[i],r)<0)n=i+1;else a=i}return n},right:function(e,r,n,a){if(n==null)n=0;if(a==null)a=e.length;while(n>>1;if(t(e[i],r)>0)a=i;else n=i+1}return n}}};function n(t){return function(r,n){return e(t(r),n)}}var a=r(e);var i=a.right;var o=a.left;var s=function(t,e){if(e==null)e=l;var r=0,n=t.length-1,a=t[0],i=new Array(n<0?0:n);while(rt?1:e>=t?0:NaN};var f=function(t){return t===null?NaN:+t};var h=function(t,e){var r=t.length,n=0,a=-1,i=0,o,s,l=0;if(e==null){while(++a1)return l/(n-1)};var p=function(t,e){var r=h(t,e);return r?Math.sqrt(r):r};var d=function(t,e){var r=t.length,n=-1,a,i,o;if(e==null){while(++n=a){i=o=a;while(++na)i=a;if(o=a){i=o=a;while(++na)i=a;if(o0)return[t];if(n=e0){t=Math.ceil(t/s);e=Math.floor(e/s);o=new Array(i=Math.ceil(e-t+1));while(++a=0?(i>=_?10:i>=w?5:i>=k?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(i>=_?10:i>=w?5:i>=k?2:1)}function T(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),a=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),i=n/a;if(i>=_)a*=10;else if(i>=w)a*=5;else if(i>=k)a*=2;return ef)h.pop(),--p;var d=new Array(p+1),v;for(a=0;a<=p;++a){v=d[a]=[];v.x0=a>0?h[a-1]:c;v.x1=a=1)return+r(t[n-1],n-1,t);var n,a=(n-1)*e,i=Math.floor(a),o=+r(t[i],i,t),s=+r(t[i+1],i+1,t);return o+(s-o)*(a-i)};var L=function(t,r,n){t=m.call(t,f).sort(e);return Math.ceil((n-r)/(2*(C(t,.75)-C(t,.25))*Math.pow(t.length,-1/3)))};var I=function(t,e,r){return Math.ceil((r-e)/(3.5*p(t)*Math.pow(t.length,-1/3)))};var z=function(t,e){var r=t.length,n=-1,a,i;if(e==null){while(++n=a){i=a;while(++ni){i=a}}}}}else{while(++n=a){i=a;while(++ni){i=a}}}}}return i};var P=function(t,e){var r=t.length,n=r,a=-1,i,o=0;if(e==null){while(++a=0){o=t[e];r=o.length;while(--r>=0){i[--a]=o[r]}}return i};var R=function(t,e){var r=t.length,n=-1,a,i;if(e==null){while(++n=a){i=a;while(++na){i=a}}}}}else{while(++n=a){i=a;while(++na){i=a}}}}}return i};var B=function(t,e){var r=e.length,n=new Array(r);while(r--)n[r]=t[e[r]];return n};var F=function(t,r){if(!(n=t.length))return;var n,a=0,i=0,o,s=t[i];if(r==null)r=e;while(++a=t.length){if(r!=null)e.sort(r);return a!=null?a(e):e}var l=-1,u=e.length,f=t[i++],h,p,d=n(),v,g=o();while(++lt.length)return r;var i,o=e[n-1];if(a!=null&&n>=t.length)i=r.entries();else i=[],r.each(function(t,e){i.push({key:e,values:f(t,n)})});return o!=null?i.sort(function(t,e){return o(t.key,e.key)}):i}return u={object:function(t){return c(t,0,i,o)},map:function(t){return c(t,0,s,l)},entries:function(t){return f(c(t,0,s,l),0)},key:function(e){t.push(e);return u},sortKeys:function(r){e[t.length-1]=r;return u},sortValues:function(t){r=t;return u},rollup:function(t){a=t;return u}}};function i(){return{}}function o(t,e,r){t[e]=r}function s(){return n()}function l(t,e,r){t.set(e,r)}function u(){}var c=n.prototype;u.prototype=f.prototype={constructor:u,has:c.has,add:function(t){t+="";this[e+t]=t;return this},remove:c.remove,clear:c.clear,values:c.keys,size:c.size,empty:c.empty,each:c.each};function f(t,e){var r=new u;if(t instanceof u)t.each(function(t){r.add(t)});else if(t){var n=-1,a=t.length;if(e==null)while(++n>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1)):(e=c.exec(t))?x(parseInt(e[1],16)):(e=f.exec(t))?new k(e[1],e[2],e[3],1):(e=h.exec(t))?new k(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=p.exec(t))?b(e[1],e[2],e[3],e[4]):(e=d.exec(t))?b(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=v.exec(t))?M(e[1],e[2]/100,e[3]/100,1):(e=g.exec(t))?M(e[1],e[2]/100,e[3]/100,e[4]):m.hasOwnProperty(t)?x(m[t]):t==="transparent"?new k(NaN,NaN,NaN,0):null}function x(t){return new k(t>>16&255,t>>8&255,t&255,1)}function b(t,e,r,n){if(n<=0)t=e=r=NaN;return new k(t,e,r,n)}function _(t){if(!(t instanceof n))t=y(t);if(!t)return new k;t=t.rgb();return new k(t.r,t.g,t.b,t.opacity)}function w(t,e,r,n){return arguments.length===1?_(t):new k(t,e,r,n==null?1:n)}function k(t,e,r,n){this.r=+t;this.g=+e;this.b=+r;this.opacity=+n}e(k,w,r(n,{brighter:function(t){t=t==null?i:Math.pow(i,t);return new k(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){t=t==null?a:Math.pow(a,t);return new k(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&(0<=this.g&&this.g<=255)&&(0<=this.b&&this.b<=255)&&(0<=this.opacity&&this.opacity<=1)},toString:function(){var t=this.opacity;t=isNaN(t)?1:Math.max(0,Math.min(1,t));return(t===1?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(t===1?")":", "+t+")")}}));function M(t,e,r,n){if(n<=0)t=e=r=NaN;else if(r<=0||r>=1)t=e=NaN;else if(e<=0)t=NaN;return new S(t,e,r,n)}function A(t){if(t instanceof S)return new S(t.h,t.s,t.l,t.opacity);if(!(t instanceof n))t=y(t);if(!t)return new S;if(t instanceof S)return t;t=t.rgb();var e=t.r/255,r=t.g/255,a=t.b/255,i=Math.min(e,r,a),o=Math.max(e,r,a),s=NaN,l=o-i,u=(o+i)/2;if(l){if(e===o)s=(r-a)/l+(r0&&u<1?0:s}return new S(s,l,u,t.opacity)}function T(t,e,r,n){return arguments.length===1?A(t):new S(t,e,r,n==null?1:n)}function S(t,e,r,n){this.h=+t;this.s=+e;this.l=+r;this.opacity=+n}e(S,T,r(n,{brighter:function(t){t=t==null?i:Math.pow(i,t);return new S(this.h,this.s,this.l*t,this.opacity)},darker:function(t){t=t==null?a:Math.pow(a,t);return new S(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*e,a=2*r-n;return new k(E(t>=240?t-240:t+120,a,n),E(t,a,n),E(t<120?t+240:t-120,a,n),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&(0<=this.l&&this.l<=1)&&(0<=this.opacity&&this.opacity<=1)}}));function E(t,e,r){return(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)*255}var C=Math.PI/180;var L=180/Math.PI;var I=18;var z=.95047;var P=1;var O=1.08883;var D=4/29;var R=6/29;var B=3*R*R;var F=R*R*R;function N(t){if(t instanceof V)return new V(t.l,t.a,t.b,t.opacity);if(t instanceof X){var e=t.h*C;return new V(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}if(!(t instanceof k))t=_(t);var r=G(t.r),n=G(t.g),a=G(t.b),i=U((.4124564*r+.3575761*n+.1804375*a)/z),o=U((.2126729*r+.7151522*n+.072175*a)/P),s=U((.0193339*r+.119192*n+.9503041*a)/O);return new V(116*o-16,500*(i-o),200*(o-s),t.opacity)}function j(t,e,r,n){return arguments.length===1?N(t):new V(t,e,r,n==null?1:n)}function V(t,e,r,n){this.l=+t;this.a=+e;this.b=+r;this.opacity=+n}e(V,j,r(n,{brighter:function(t){return new V(this.l+I*(t==null?1:t),this.a,this.b,this.opacity)},darker:function(t){return new V(this.l-I*(t==null?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;t=P*q(t);e=z*q(e);r=O*q(r);return new k(H(3.2404542*e-1.5371385*t-.4985314*r),H(-.969266*e+1.8760108*t+.041556*r),H(.0556434*e-.2040259*t+1.0572252*r),this.opacity)}}));function U(t){return t>F?Math.pow(t,1/3):t/B+D}function q(t){return t>R?t*t*t:B*(t-D)}function H(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function G(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function W(t){if(t instanceof X)return new X(t.h,t.c,t.l,t.opacity);if(!(t instanceof V))t=N(t);var e=Math.atan2(t.b,t.a)*L;return new X(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function Y(t,e,r,n){return arguments.length===1?W(t):new X(t,e,r,n==null?1:n)}function X(t,e,r,n){this.h=+t;this.c=+e;this.l=+r;this.opacity=+n}e(X,Y,r(n,{brighter:function(t){return new X(this.h,this.c,this.l+I*(t==null?1:t),this.opacity)},darker:function(t){return new X(this.h,this.c,this.l-I*(t==null?1:t),this.opacity)},rgb:function(){return N(this).rgb()}}));var Z=-.14861;var $=+1.78277;var J=-.29227;var K=-.90649;var Q=+1.97294;var tt=Q*K;var et=Q*$;var rt=$*J-K*Z;function nt(t){if(t instanceof it)return new it(t.h,t.s,t.l,t.opacity);if(!(t instanceof k))t=_(t);var e=t.r/255,r=t.g/255,n=t.b/255,a=(rt*n+tt*e-et*r)/(rt+tt-et),i=n-a,o=(Q*(r-a)-J*i)/K,s=Math.sqrt(o*o+i*i)/(Q*a*(1-a)),l=s?Math.atan2(o,i)*L-120:NaN;return new it(l<0?l+360:l,s,a,t.opacity)}function at(t,e,r,n){return arguments.length===1?nt(t):new it(t,e,r,n==null?1:n)}function it(t,e,r,n){this.h=+t;this.s=+e;this.l=+r;this.opacity=+n}e(it,at,r(n,{brighter:function(t){t=t==null?i:Math.pow(i,t);return new it(this.h,this.s,this.l*t,this.opacity)},darker:function(t){t=t==null?a:Math.pow(a,t);return new it(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*C,e=+this.l,r=isNaN(this.s)?0:this.s*e*(1-e),n=Math.cos(t),a=Math.sin(t);return new k(255*(e+r*(Z*n+$*a)),255*(e+r*(J*n+K*a)),255*(e+r*(Q*n)),this.opacity)}}));t.color=y;t.rgb=w;t.hsl=T;t.lab=j;t.hcl=Y;t.cubehelix=at;Object.defineProperty(t,"__esModule",{value:true})})},{}],142:[function(e,r,n){(function(e,a){typeof n==="object"&&typeof r!=="undefined"?a(n):typeof t==="function"&&t.amd?t(["exports"],a):a(e.d3=e.d3||{})})(this,function(t){"use strict";var e={value:function(){}};function r(){for(var t=0,e=arguments.length,r={},a;t=0)r=t.slice(n+1),t=t.slice(0,n);if(t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}n.prototype=r.prototype={constructor:n,on:function(t,e){var r=this._,n=a(t+"",r),s,l=-1,u=n.length;if(arguments.length<2){while(++l0)for(var r=new Array(a),n=0,a,i;nh.index){var c=p-o.x-o.vx,f=d-o.y-o.vy,m=c*c+f*f;if(mp+u||nd+u||it.r){t.r=t[e].r}}}function h(){if(!r)return;var e,a=r.length,i;n=new Array(a);for(e=0;e1?(r==null?c.remove(t):c.set(t,y(r)),e):c.get(t)},find:function(e,r,n){var a=0,i=t.length,o,s,l,u,c;if(n==null)n=Infinity;else n*=n;for(a=0;a1?(h.on(t,r),e):h.on(t)}}};var x=function(){var t,r,n,a=o(-30),i,l=1,u=Infinity,c=.81;function f(a){var i,o=t.length,s=e.quadtree(t,d,v).visitAfter(p);for(n=a,i=0;i=u)return;if(t.data!==r||t.next){if(f===0)f=s(),d+=f*f;if(h===0)h=s(),d+=h*h;if(d=1?(n=1,e-1):Math.floor(n*e),i=t[a],o=t[a+1],s=a>0?t[a-1]:2*i-o,l=a180||r<-180?r-360*Math.round(r/360):r):i(isNaN(t)?e:t)}function u(t){return(t=+t)===1?c:function(e,r){return r-e?s(e,r,t):i(isNaN(e)?r:e)}}function c(t,e){var r=e-t;return r?o(t,r):i(isNaN(t)?e:t)}var f=function t(r){var n=u(r);function a(t,r){var a=n((t=e.rgb(t)).r,(r=e.rgb(r)).r),i=n(t.g,r.g),o=n(t.b,r.b),s=c(t.opacity,r.opacity);return function(e){t.r=a(e);t.g=i(e);t.b=o(e);t.opacity=s(e);return t+""}}a.gamma=t;return a}(1);function h(t){return function(r){var n=r.length,a=new Array(n),i=new Array(n),o=new Array(n),s,l;for(s=0;sr){i=e.slice(r,i);if(s[o])s[o]+=i;else s[++o]=i}if((n=n[0])===(a=a[0])){if(s[o])s[o]+=a;else s[++o]=a}else{s[++o]=null;l.push({i:o,x:m(n,a)})}r=b.lastIndex}if(r180)e+=360;else if(e-t>180)t+=360;i.push({i:r.push(a(r)+"rotate(",null,n)-2,x:m(t,e)})}else if(e){r.push(a(r)+"rotate("+e+n)}}function s(t,e,r,i){if(t!==e){i.push({i:r.push(a(r)+"skewX(",null,n)-2,x:m(t,e)})}else if(e){r.push(a(r)+"skewX("+e+n)}}function l(t,e,r,n,i,o){if(t!==r||e!==n){var s=i.push(a(i)+"scale(",null,",",null,")");o.push({i:s-4,x:m(t,r)},{i:s-2,x:m(e,n)})}else if(r!==1||n!==1){i.push(a(i)+"scale("+r+","+n+")")}}return function(e,r){var n=[],a=[];e=t(e),r=t(r);i(e.translateX,e.translateY,r.translateX,r.translateY,n,a);o(e.rotate,r.rotate,n,a);s(e.skewX,r.skewX,n,a);l(e.scaleX,e.scaleY,r.scaleX,r.scaleY,n,a);e=r=null;return function(t){var e=-1,r=a.length,i;while(++e=(f=(s+u)/2))s=f;else u=f;if(g=r>=(h=(l+c)/2))l=h;else c=h;if(a=i,!(i=i[m=g<<1|v]))return a[m]=o,t}p=+t._x.call(null,i.data);d=+t._y.call(null,i.data);if(e===p&&r===d)return o.next=i,a?a[m]=o:t._root=o,t;do{a=a?a[m]=new Array(4):t._root=new Array(4);if(v=e>=(f=(s+u)/2))s=f;else u=f;if(g=r>=(h=(l+c)/2))l=h;else c=h}while((m=g<<1|v)===(y=(d>=h)<<1|p>=f));return a[y]=i,a[m]=o,t}function n(t){var e,n,a=t.length,i,o,s=new Array(a),l=new Array(a),u=Infinity,c=Infinity,f=-Infinity,h=-Infinity;for(n=0;nf)f=i;if(oh)h=o}if(ft||t>a||n>e||e>i){var o=a-r,s=this._root,l,u;switch(u=(e<(n+i)/2)<<1|t<(r+a)/2){case 0:{do{l=new Array(4),l[u]=s,s=l}while(o*=2,a=r+o,i=n+o,t>a||e>i);break}case 1:{do{l=new Array(4),l[u]=s,s=l}while(o*=2,r=a-o,i=n+o,r>t||e>i);break}case 2:{do{l=new Array(4),l[u]=s,s=l}while(o*=2,a=r+o,n=i-o,t>a||n>e);break}case 3:{do{l=new Array(4),l[u]=s,s=l}while(o*=2,r=a-o,n=i-o,r>t||n>e);break}}if(this._root&&this._root.length)this._root=s}else return this;this._x0=r;this._y0=n;this._x1=a;this._y1=i;return this};var i=function(){var t=[];this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)});return t};var o=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?undefined:[[this._x0,this._y0],[this._x1,this._y1]]};var s=function(t,e,r,n,a){this.node=t;this.x0=e;this.y0=r;this.x1=n;this.y1=a};var l=function(t,e,r){var n,a=this._x0,i=this._y0,o,l,u,c,f=this._x1,h=this._y1,p=[],d=this._root,v,g;if(d)p.push(new s(d,a,i,f,h));if(r==null)r=Infinity;else{a=t-r,i=e-r;f=t+r,h=e+r;r*=r}while(v=p.pop()){if(!(d=v.node)||(o=v.x0)>f||(l=v.y0)>h||(u=v.x1)=y)<<1|t>=m){v=p[p.length-1];p[p.length-1]=p[p.length-1-g];p[p.length-1-g]=v}}else{var x=t-+this._x.call(null,d.data),b=e-+this._y.call(null,d.data),_=x*x+b*b;if(_=(h=(o+l)/2))o=h;else l=h;if(v=f>=(p=(s+u)/2))s=p;else u=p;if(!(e=r,r=r[g=v<<1|d]))return this;if(!r.length)break;if(e[g+1&3]||e[g+2&3]||e[g+3&3])n=e,m=g}while(r.data!==t)if(!(a=r,r=r.next))return this;if(i=r.next)delete r.next;if(a)return i?a.next=i:delete a.next,this;if(!e)return this._root=i,this;i?e[g]=i:delete e[g];if((r=e[0]||e[1]||e[2]||e[3])&&r===(e[3]||e[2]||e[1]||e[0])&&!r.length){if(n)n[m]=r;else this._root=r}return this};function c(t){for(var e=0,r=t.length;e=0)t._call.call(null,r);t=t._next}--e}function m(){l=(s=c.now())+u;e=r=0;try{g()}finally{e=0;x();l=0}}function y(){var t=c.now(),e=t-s;if(e>a)u-=e,s=t}function x(){var t,e=i,r,n=Infinity;while(e){if(e._call){if(n>e._time)n=e._time;t=e,e=e._next}else{r=e._next,e._next=null;e=t?t._next=r:i=r}}o=t;b(n)}function b(t){if(e)return;if(r)r=clearTimeout(r);var i=t-l;if(i>24){if(te?1:t>=e?0:NaN}e.descending=function(t,e){return et?1:e>=t?0:NaN};e.min=function(t,e){var r=-1,n=t.length,a,i;if(arguments.length===1){while(++r=i){a=i;break}while(++ri)a=i}else{while(++r=i){a=i;break}while(++ri)a=i}return a};e.max=function(t,e){var r=-1,n=t.length,a,i;if(arguments.length===1){while(++r=i){a=i;break}while(++ra)a=i}else{while(++r=i){a=i;break}while(++ra)a=i}return a};e.extent=function(t,e){var r=-1,n=t.length,a,i,o;if(arguments.length===1){while(++r=i){a=o=i;break}while(++ri)a=i;if(o=i){a=o=i;break}while(++ri)a=i;if(o1)return o/(l-1)};e.deviation=function(){var t=e.variance.apply(this,arguments);return t?Math.sqrt(t):t};function g(t){return{left:function(e,r,n,a){if(arguments.length<3)n=0;if(arguments.length<4)a=e.length;while(n>>1;if(t(e[i],r)<0)n=i+1;else a=i}return n},right:function(e,r,n,a){if(arguments.length<3)n=0;if(arguments.length<4)a=e.length;while(n>>1;if(t(e[i],r)>0)a=i;else n=i+1}return n}}}var m=g(p);e.bisectLeft=m.left;e.bisect=e.bisectRight=m.right;e.bisector=function(t){return g(t.length===1?function(e,r){return p(t(e),r)}:t)};e.shuffle=function(t,e,r){if((n=arguments.length)<3){r=t.length;if(n<2)e=0}var n=r-e,a,i;while(n){i=Math.random()*n--|0;a=t[n+e],t[n+e]=t[i+e],t[i+e]=a}return t};e.permute=function(t,e){var r=e.length,n=new Array(r);while(r--)n[r]=t[e[r]];return n};e.pairs=function(t){var e=0,r=t.length-1,n,a=t[0],i=new Array(r<0?0:r);while(e=0){o=t[e];r=o.length;while(--r>=0){i[--a]=o[r]}}return i};var x=Math.abs;e.range=function(t,e,r){if(arguments.length<3){r=1;if(arguments.length<2){e=t;t=0}}if((e-t)/r===Infinity)throw new Error("infinite range");var n=[],a=b(x(r)),i=-1,o;t*=a,e*=a,r*=a;if(r<0)while((o=t+r*++i)>e)n.push(o/a);else while((o=t+r*++i)=r.length)return i?i.call(t,n):a?n.sort(a):n;var l=-1,u=n.length,c=r[s++],f,h,p,d=new w,v;while(++l=r.length)return t;var a=[],i=n[e++];t.forEach(function(t,r){a.push({key:t,values:s(r,e)})});return i?a.sort(function(t,e){return i(t.key,e.key)}):a}t.map=function(t,e){return o(e,t,0)};t.entries=function(t){return s(o(e.map,t,0),0)};t.key=function(e){r.push(e);return t};t.sortKeys=function(e){n[r.length-1]=e;return t};t.sortValues=function(e){a=e;return t};t.rollup=function(e){i=e;return t};return t};e.set=function(t){var e=new z;if(t)for(var r=0,n=t.length;r=0){n=t.slice(r+1);t=t.slice(0,r)}if(t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(arguments.length===2){if(e==null)for(t in this){if(this.hasOwnProperty(t))this[t].on(n,null)}return this}};function N(t){var e=[],r=new w;function n(){var r=e,n=-1,a=r.length,i;while(++n=0&&(r=t.slice(0,e))!=="xmlns")t=t.slice(e+1);return Q.hasOwnProperty(r)?{space:Q[r],local:t}:t}};Z.attr=function(t,r){if(arguments.length<2){if(typeof t==="string"){var n=this.node();t=e.ns.qualify(t);return t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(r in t)this.each(tt(r,t[r]));return this}return this.each(tt(t,r))};function tt(t,r){t=e.ns.qualify(t);function n(){this.removeAttribute(t)}function a(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,r)}function o(){this.setAttributeNS(t.space,t.local,r)}function s(){var e=r.apply(this,arguments);if(e==null)this.removeAttribute(t);else this.setAttribute(t,e)}function l(){var e=r.apply(this,arguments);if(e==null)this.removeAttributeNS(t.space,t.local);else this.setAttributeNS(t.space,t.local,e)}return r==null?t.local?a:n:typeof r==="function"?t.local?l:s:t.local?o:i}function et(t){return t.trim().replace(/\s+/g," ")}Z.classed=function(t,e){if(arguments.length<2){if(typeof t==="string"){var r=this.node(),n=(t=nt(t)).length,a=-1;if(e=r.classList){while(++a=0;){if(i=r[n]){if(a&&a!==i.nextSibling)a.parentNode.insertBefore(i,a);a=i}}}return this};Z.sort=function(t){t=ht.apply(this,arguments);for(var e=-1,r=this.length;++e=e)e=a+1;while(!(l=o[e])&&++e0)t=t.slice(0,o);var l=yt.get(t);if(l)t=l,s=bt;function u(){var e=this[i];if(e){this.removeEventListener(t,e,e.$);delete this[i]}}function c(){var e=s(r,a(arguments));u.call(this);this.addEventListener(t,this[i]=e,e.$=n);e._=r}function f(){var r=new RegExp("^__on([^.]+)"+e.requote(t)+"$"),n;for(var a in this){if(n=a.match(r)){var i=this[a];this.removeEventListener(n[1],i,i.$);delete this[a]}}}return o?r?c:u:r?B:f}var yt=e.map({mouseenter:"mouseover",mouseleave:"mouseout"});if(i){yt.forEach(function(t){if("on"+t in i)yt.remove(t)})}function xt(t,r){return function(n){var a=e.event;e.event=n;r[0]=this.__data__;try{t.apply(this,r)}finally{e.event=a}}}function bt(t,e){var r=xt(t,e);return function(t){var e=this,n=t.relatedTarget;if(!n||n!==e&&!(n.compareDocumentPosition(e)&8)){r.call(e,t)}}}var _t,wt=0;function kt(t){var r=".dragsuppress-"+ ++wt,n="click"+r,a=e.select(s(t)).on("touchmove"+r,j).on("dragstart"+r,j).on("selectstart"+r,j);if(_t==null){_t="onselectstart"in t?false:D(t.style,"userSelect")}if(_t){var i=o(t).style,l=i[_t];i[_t]="none"}return function(t){a.on(r,null);if(_t)i[_t]=l;if(t){var e=function(){a.on(n,null)};a.on(n,function(){j();e()},true);setTimeout(e,0)}}}e.mouse=function(t){return At(t,V())};var Mt=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;function At(t,r){if(r.changedTouches)r=r.changedTouches[0];var n=t.ownerSVGElement||t;if(n.createSVGPoint){var a=n.createSVGPoint();if(Mt<0){var i=s(t);if(i.scrollX||i.scrollY){n=e.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var o=n[0][0].getScreenCTM();Mt=!(o.f||o.e);n.remove()}}if(Mt)a.x=r.pageX,a.y=r.pageY;else a.x=r.clientX,a.y=r.clientY;a=a.matrixTransform(t.getScreenCTM().inverse());return[a.x,a.y]}var l=t.getBoundingClientRect();return[r.clientX-l.left-t.clientLeft,r.clientY-l.top-t.clientTop]}e.touch=function(t,e,r){if(arguments.length<3)r=e,e=V().changedTouches;if(e)for(var n=0,a=e.length,i;n0?1:t<0?-1:0}function Rt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function Bt(t){return t>1?0:t<-1?Ct:Math.acos(t)}function Ft(t){return t>1?zt:t<-1?-zt:Math.asin(t)}function Nt(t){return((t=Math.exp(t))-1/t)/2}function jt(t){return((t=Math.exp(t))+1/t)/2}function Vt(t){return((t=Math.exp(2*t))-1)/(t+1)}function Ut(t){return(t=Math.sin(t/2))*t}var qt=Math.SQRT2,Ht=2,Gt=4;e.interpolateZoom=function(t,e){var r=t[0],n=t[1],a=t[2],i=e[0],o=e[1],s=e[2],l=i-r,u=o-n,c=l*l+u*u,f,h;if(c0)r=r.transition().duration(u);r.call(w.event)}function E(){if(x)x.domain(y.range().map(function(e){return(e-t.x)/t.k}).map(y.invert));if(_)_.domain(b.range().map(function(e){return(e-t.y)/t.k}).map(b.invert))}function C(t){if(!c++)t({type:"zoomstart"})}function L(e){E();e({type:"zoom",scale:t.k,translate:[t.x,t.y]})}function I(t){if(!--c)t({type:"zoomend"}),n=null}function z(){var t=this,r=m.of(t,arguments),n=0,a=e.select(s(t)).on(h,l).on(p,u),i=k(e.mouse(t)),o=kt(t);Sl.call(t);C(r);function l(){n=1;T(e.mouse(t),i);L(r)}function u(){a.on(h,null).on(p,null);o(n);I(r)}}function P(){var r=this,n=m.of(r,arguments),a={},i=0,o,s=".zoom-"+e.event.changedTouches[0].identifier,l="touchmove"+s,u="touchend"+s,c=[],h=e.select(r),p=kt(r);y();C(n);h.on(f,null).on(v,y);function d(){var n=e.touches(r);o=t.k;n.forEach(function(t){if(t.identifier in a)a[t.identifier]=k(t)});return n}function y(){var n=e.event.target;e.select(n).on(l,x).on(u,b);c.push(n);var o=e.event.changedTouches;for(var s=0,f=o.length;s1){var v=h[0],m=h[1],y=v[0]-m[0],_=v[1]-m[1];i=y*y+_*_}}function x(){var t=e.touches(r),s,l,u,c;Sl.call(r);for(var f=0,h=t.length;f1?1:e;r=r<0?0:r>1?1:r;a=r<=.5?r*(1+e):r+e-r*e;n=2*r-a;function i(t){if(t>360)t-=360;else if(t<0)t+=360;if(t<60)return n+(a-n)*t/60;if(t<180)return a;if(t<240)return n+(a-n)*(240-t)/60;return n}function o(t){return Math.round(i(t)*255)}return new pe(o(t+120),o(t),o(t-120))}e.hcl=Qt;function Qt(t,r,n){return this instanceof Qt?void(this.h=+t,this.c=+r,this.l=+n):arguments.length<2?t instanceof Qt?new Qt(t.h,t.c,t.l):t instanceof re?ue(t.l,t.a,t.b):ue((t=be((t=e.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new Qt(t,r,n)}var te=Qt.prototype=new Zt;te.brighter=function(t){return new Qt(this.h,this.c,Math.min(100,this.l+ne*(arguments.length?t:1)))};te.darker=function(t){return new Qt(this.h,this.c,Math.max(0,this.l-ne*(arguments.length?t:1)))};te.rgb=function(){return ee(this.h,this.c,this.l).rgb()};function ee(t,e,r){if(isNaN(t))t=0;if(isNaN(e))e=0;return new re(r,Math.cos(t*=Pt)*e,Math.sin(t)*e)}e.lab=re;function re(t,e,r){return this instanceof re?void(this.l=+t,this.a=+e,this.b=+r):arguments.length<2?t instanceof re?new re(t.l,t.a,t.b):t instanceof Qt?ee(t.h,t.c,t.l):be((t=pe(t)).r,t.g,t.b):new re(t,e,r)}var ne=18;var ae=.95047,ie=1,oe=1.08883;var se=re.prototype=new Zt;se.brighter=function(t){return new re(Math.min(100,this.l+ne*(arguments.length?t:1)),this.a,this.b)};se.darker=function(t){return new re(Math.max(0,this.l-ne*(arguments.length?t:1)),this.a,this.b)};se.rgb=function(){return le(this.l,this.a,this.b)};function le(t,e,r){var n=(t+16)/116,a=n+e/500,i=n-r/200;a=ce(a)*ae;n=ce(n)*ie;i=ce(i)*oe;return new pe(he(3.2404542*a-1.5371385*n-.4985314*i),he(-.969266*a+1.8760108*n+.041556*i),he(.0556434*a-.2040259*n+1.0572252*i))}function ue(t,e,r){return t>0?new Qt(Math.atan2(r,e)*Ot,Math.sqrt(e*e+r*r),t):new Qt(NaN,NaN,t)}function ce(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function fe(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function he(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}e.rgb=pe;function pe(t,e,r){return this instanceof pe?void(this.r=~~t,this.g=~~e,this.b=~~r):arguments.length<2?t instanceof pe?new pe(t.r,t.g,t.b):ye(""+t,pe,Kt):new pe(t,e,r)}function de(t){return new pe(t>>16,t>>8&255,t&255)}function ve(t){return de(t)+""}var ge=pe.prototype=new Zt;ge.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,a=30;if(!e&&!r&&!n)return new pe(a,a,a);if(e&&e>4;n=n>>4|n;a=l&240;a=a>>4|a;i=l&15;i=i<<4|i}else if(t.length===7){n=(l&16711680)>>16;a=(l&65280)>>8;i=l&255}}return e(n,a,i)}function xe(t,e,r){var n=Math.min(t/=255,e/=255,r/=255),a=Math.max(t,e,r),i=a-n,o,s,l=(a+n)/2;if(i){s=l<.5?i/(a+n):i/(2-a-n);if(t==a)o=(e-r)/i+(e0&&l<1?0:o}return new $t(o,s,l)}function be(t,e,r){t=_e(t);e=_e(e);r=_e(r);var n=fe((.4124564*t+.3575761*e+.1804375*r)/ae),a=fe((.2126729*t+.7151522*e+.072175*r)/ie),i=fe((.0193339*t+.119192*e+.9503041*r)/oe);return re(116*a-16,500*(n-a),200*(a-i))}function _e(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function we(t){var e=parseFloat(t);return t.charAt(t.length-1)==="%"?Math.round(e*2.55):e}var ke=e.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});ke.forEach(function(t,e){ke.set(t,de(e))});function Me(t){return typeof t==="function"?t:function(){return t}}e.functor=Me;e.xhr=Ae(P);function Ae(t){return function(e,r,n){if(arguments.length===2&&typeof r==="function")n=r,r=null;return Te(e,r,t,n)}}function Te(t,r,n,i){var o={},s=e.dispatch("beforesend","progress","load","error"),l={},u=new XMLHttpRequest,c=null;if(this.XDomainRequest&&!("withCredentials"in u)&&/^(http(s)?:)?\/\//.test(t))u=new XDomainRequest;"onload"in u?u.onload=u.onerror=f:u.onreadystatechange=function(){u.readyState>3&&f()};function f(){var t=u.status,e;if(!t&&Ee(u)||t>=200&&t<300||t===304){try{e=n.call(o,u)}catch(t){s.error.call(o,t);return}s.load.call(o,e)}else{s.error.call(o,u)}}u.onprogress=function(t){var r=e.event;e.event=t;try{s.progress.call(o,u)}finally{e.event=r}};o.header=function(t,e){t=(t+"").toLowerCase();if(arguments.length<2)return l[t];if(e==null)delete l[t];else l[t]=e+"";return o};o.mimeType=function(t){if(!arguments.length)return r;r=t==null?null:t+"";return o};o.responseType=function(t){if(!arguments.length)return c;c=t;return o};o.response=function(t){n=t;return o};["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(a(arguments)))}});o.send=function(e,n,a){if(arguments.length===2&&typeof n==="function")a=n,n=null;u.open(e,t,true);if(r!=null&&!("accept"in l))l["accept"]=r+",*/*";if(u.setRequestHeader)for(var i in l)u.setRequestHeader(i,l[i]);if(r!=null&&u.overrideMimeType)u.overrideMimeType(r);if(c!=null)u.responseType=c;if(a!=null)o.on("error",a).on("load",function(t){a(null,t)});s.beforesend.call(o,u);u.send(n==null?null:n);return o};o.abort=function(){u.abort();return o};e.rebind(o,s,"on");return i==null?o:o.get(Se(i))}function Se(t){return t.length===1?function(e,r){t(e==null?r:null)}:t}function Ee(t){var e=t.responseType;return e&&e!=="text"?t.response:t.responseText}e.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function a(t,r,n){if(arguments.length<3)n=r,r=null;var a=Te(t,e,r==null?i:o(r),n);a.row=function(t){return arguments.length?a.response((r=t)==null?i:o(t)):r};return a}function i(t){return a.parse(t.responseText)}function o(t){return function(e){return a.parse(e.responseText,t)}}a.parse=function(t,e){var r;return a.parseRows(t,function(t,n){if(r)return r(t,n-1);var a=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");r=e?function(t,r){return e(a(t),r)}:a})};a.parseRows=function(t,e){var r={},a={},i=[],o=t.length,s=0,l=0,u,c;function f(){if(s>=o)return a;if(c)return c=false,r;var e=s;if(t.charCodeAt(e)===34){var i=e;while(i++24){if(isFinite(e)){clearTimeout(ze);ze=setTimeout(De,e)}Ie=0}else{Ie=1;Pe(De)}}e.timer.flush=function(){Re();Be()};function Re(){var t=Date.now(),e=Ce;while(e){if(t>=e.t&&e.c(t-e.t))e.c=null;e=e.n}return t}function Be(){var t,e=Ce,r=Infinity;while(e){if(e.c){if(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}}function Ve(t){var r=t.decimal,n=t.thousands,a=t.grouping,i=t.currency,o=a&&n?function(t,e){var r=t.length,i=[],o=0,s=a[0],l=0;while(r>0&&s>0){if(l+s+1>e)s=Math.max(1,e-l);i.push(t.substring(r-=s,r+s));if((l+=s+1)>e)break;s=a[o=(o+1)%a.length]}return i.reverse().join(n)}:P;return function(t){var n=Ue.exec(t),a=n[1]||" ",s=n[2]||">",l=n[3]||"-",u=n[4]||"",c=n[5],f=+n[6],h=n[7],p=n[8],d=n[9],v=1,g="",m="",y=false,x=true;if(p)p=+p.substring(1);if(c||a==="0"&&s==="="){c=a="0";s="="}switch(d){case"n":h=true;d="g";break;case"%":v=100;m="%";d="f";break;case"p":v=100;m="%";d="r";break;case"b":case"o":case"x":case"X":if(u==="#")g="0"+d.toLowerCase();case"c":x=false;case"d":y=true;p=0;break;case"s":v=-1;d="r";break}if(u==="$")g=i[0],m=i[1];if(d=="r"&&!p)d="g";if(p!=null){if(d=="g")p=Math.max(1,Math.min(21,p));else if(d=="e"||d=="f")p=Math.max(0,Math.min(20,p))}d=qe.get(d)||He;var b=c&&h;return function(t){var n=m;if(y&&t%1)return"";var i=t<0||t===0&&1/t<0?(t=-t,"-"):l==="-"?"":l;if(v<0){var u=e.formatPrefix(t,p);t=u.scale(t);n=u.symbol+m}else{t*=v}t=d(t,p);var _=t.lastIndexOf("."),w,k;if(_<0){var M=x?t.lastIndexOf("e"):-1;if(M<0)w=t,k="";else w=t.substring(0,M),k=t.substring(M)}else{w=t.substring(0,_);k=r+t.substring(_+1)}if(!c&&h)w=o(w,Infinity);var A=g.length+w.length+k.length+(b?0:i.length),T=A"?T+i+t:s==="^"?T.substring(0,A>>=1)+i+t+T.substring(A):i+(b?t:T+t))+n}}}var Ue=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;var qe=e.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,r){return(t=e.round(t,Fe(t,r))).toFixed(Math.max(0,Math.min(20,Fe(t*(1+1e-15),r))))}});function He(t){return t+""}var Ge=e.time={},We=Date;function Ye(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Ye.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(){Xe.setUTCDate.apply(this._,arguments)},setDay:function(){Xe.setUTCDay.apply(this._,arguments)},setFullYear:function(){Xe.setUTCFullYear.apply(this._,arguments)},setHours:function(){Xe.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Xe.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Xe.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Xe.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Xe.setUTCSeconds.apply(this._,arguments)},setTime:function(){Xe.setTime.apply(this._,arguments)}};var Xe=Date.prototype;function Ze(t,e,r){function n(e){var r=t(e),n=i(r,1);return e-r1){while(o=u)return-1;a=e.charCodeAt(s++);if(a===37){o=e.charAt(s++);i=w[o in Ke?e.charAt(s++):o];if(!i||(n=i(t,r,n))<0)return-1}else if(a!=r.charCodeAt(n++)){return-1}}return n}c.utc=function(t){var e=c(t);function r(t){try{We=Ye;var r=new We;r._=t;return e(r)}finally{We=Date}}r.parse=function(t){try{We=Ye;var r=e.parse(t);return r&&r._}finally{We=Date}};r.toString=e.toString;return r};c.multi=c.utc.multi=br;var h=e.map(),p=rr(o),d=nr(o),v=rr(s),g=nr(s),m=rr(l),y=nr(l),x=rr(u),b=nr(u);i.forEach(function(t,e){h.set(t.toLowerCase(),e)});var _={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return l[t.getMonth()]},c:c(r),d:function(t,e){return er(t.getDate(),e,2)},e:function(t,e){return er(t.getDate(),e,2)},H:function(t,e){return er(t.getHours(),e,2)},I:function(t,e){return er(t.getHours()%12||12,e,2)},j:function(t,e){return er(1+Ge.dayOfYear(t),e,3)},L:function(t,e){return er(t.getMilliseconds(),e,3)},m:function(t,e){return er(t.getMonth()+1,e,2)},M:function(t,e){return er(t.getMinutes(),e,2)},p:function(t){return i[+(t.getHours()>=12)]},S:function(t,e){return er(t.getSeconds(),e,2)},U:function(t,e){return er(Ge.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return er(Ge.mondayOfYear(t),e,2)},x:c(n),X:c(a),y:function(t,e){return er(t.getFullYear()%100,e,2)},Y:function(t,e){return er(t.getFullYear()%1e4,e,4)},Z:yr,"%":function(){return"%"}};var w={a:k,A:M,b:A,B:T,c:S,d:hr,e:hr,H:dr,I:dr,j:pr,L:mr,m:fr,M:vr,p:L,S:gr,U:ir,w:ar,W:or,x:E,X:C,y:lr,Y:sr,Z:ur,"%":xr};function k(t,e,r){v.lastIndex=0;var n=v.exec(e.slice(r));return n?(t.w=g.get(n[0].toLowerCase()),r+n[0].length):-1}function M(t,e,r){p.lastIndex=0;var n=p.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1}function A(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1}function T(t,e,r){m.lastIndex=0;var n=m.exec(e.slice(r));return n?(t.m=y.get(n[0].toLowerCase()),r+n[0].length):-1}function S(t,e,r){return f(t,_.c.toString(),e,r)}function E(t,e,r){return f(t,_.x.toString(),e,r)}function C(t,e,r){return f(t,_.X.toString(),e,r)}function L(t,e,r){var n=h.get(e.slice(r,r+=2).toLowerCase());return n==null?-1:(t.p=n,r)}return c}var Ke={"-":"",_:" ",0:"0"},Qe=/^\s*\d+/,tr=/^%/;function er(t,e,r){var n=t<0?"-":"",a=(n?-t:t)+"",i=a.length;return n+(i68?1900:2e3)}function fr(t,e,r){Qe.lastIndex=0;var n=Qe.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function hr(t,e,r){Qe.lastIndex=0;var n=Qe.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function pr(t,e,r){Qe.lastIndex=0;var n=Qe.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function dr(t,e,r){Qe.lastIndex=0;var n=Qe.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function vr(t,e,r){Qe.lastIndex=0;var n=Qe.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function gr(t,e,r){Qe.lastIndex=0;var n=Qe.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function mr(t,e,r){Qe.lastIndex=0;var n=Qe.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function yr(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=x(e)/60|0,a=x(e)%60;return r+er(n,"0",2)+er(a,"0",2)}function xr(t,e,r){tr.lastIndex=0;var n=tr.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function br(t){var e=t.length,r=-1;while(++r=0?1:-1,s=o*i,l=Math.cos(e),u=Math.sin(e),c=a*u,f=n*l+c*Math.cos(s),h=c*o*Math.sin(s);Ir.add(Math.atan2(h,f));r=t,n=l,a=u}zr.lineEnd=function(){i(t,e)}}function Or(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 Dr(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Rr(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 Br(t,e){t[0]+=e[0];t[1]+=e[1];t[2]+=e[2]}function Fr(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Nr(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 jr(t){return[Math.atan2(t[1],t[0]),Ft(t[2])]}function Vr(t,e){return x(t[0]-e[0])St)a=90;else if(u<-St)r=-90;f[0]=t,f[1]=n}};function p(e,i){c.push(f=[t=e,n=e]);if(ia)a=i}function d(e,o){var s=Or([e*Pt,o*Pt]);if(l){var u=Rr(l,s),c=[u[1],-u[0],0],f=Rr(c,u);Nr(f);f=jr(f);var h=e-i,d=h>0?1:-1,v=f[0]*Ot*d,g=x(h)>180;if(g^(d*ia)a=m}else if(v=(v+360)%360-180,g^(d*ia)a=o}if(g){if(e_(t,n))n=e}else{if(_(e,n)>_(t,n))t=e}}else{if(n>=t){if(en)n=e}else{if(e>i){if(_(t,e)>_(t,n))n=e}else{if(_(e,n)>_(t,n))t=e}}}}else{p(e,o)}l=s,i=e}function v(){h.point=d}function g(){f[0]=t,f[1]=n;h.point=p;l=null}function m(t,e){if(l){var r=t-i;u+=x(r)>180?r+(r>0?360:-360):r}else o=t,s=e;zr.point(t,e);d(t,e)}function y(){zr.lineStart()}function b(){m(o,s);zr.lineEnd();if(x(u)>St)t=-(n=180);f[0]=t,f[1]=n;l=null}function _(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function k(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t_(l[0],l[1]))l[1]=u[1];if(_(u[0],l[1])>_(l[0],l[1]))l[0]=u[0]}else{p.push(l=u)}}var d=-Infinity,v;for(var o=p.length-1,s=0,l=p[o],u;s<=o;l=u,++s){u=p[s];if((v=_(l[1],u[0]))>d)d=v,t=u[0],n=l[1]}}c=f=null;return t===Infinity||r===Infinity?[[NaN,NaN],[NaN,NaN]]:[[t,r],[n,a]]}}();e.geo.centroid=function(t){Ur=qr=Hr=Gr=Wr=Yr=Xr=Zr=$r=Jr=Kr=0;e.geo.stream(t,Qr);var r=$r,n=Jr,a=Kr,i=r*r+n*n+a*a;if(i=0;--s)a.point((h=f[s])[0],h[1])}else{n(p.x,p.p.x,-1,a)}p=p.p}p=p.o;f=p.z;d=!d}while(!p.v);a.lineEnd()}}function un(t){if(!(e=t.length))return;var e,r=0,n=t[0],a;while(++r0){if(!m)o.polygonStart(),m=true;o.lineStart();while(++a1&&t&2)e.push(e.pop().concat(e.shift()));d.push(e.filter(hn))}return u}}function hn(t){return t.length>1}function pn(){var t=[],e;return{lineStart:function(){t.push(e=[])},point:function(t,r){e.push([t,r])},lineEnd:B,buffer:function(){var r=t;t=[];e=null;return r},rejoin:function(){if(t.length>1)t.push(t.pop().concat(t.shift()))}}}function dn(t,e){return((t=t.x)[0]<0?t[1]-zt-St:zt-t[1])-((e=e.x)[0]<0?e[1]-zt-St:zt-e[1])}var vn=fn(sn,gn,yn,[-Ct,-Ct/2]);function gn(t){var e=NaN,r=NaN,n=NaN,a;return{lineStart:function(){t.lineStart();a=1},point:function(i,o){var s=i>0?Ct:-Ct,l=x(i-e);if(x(l-Ct)0?zt:-zt);t.point(n,r);t.lineEnd();t.lineStart();t.point(s,r);t.point(i,r);a=0}else if(n!==s&&l>=Ct){if(x(e-n)St?Math.atan((Math.sin(e)*(i=Math.cos(n))*Math.sin(r)-Math.sin(n)*(a=Math.cos(e))*Math.sin(t))/(a*i*o)):(e+n)/2}function yn(t,e,r,n){var a;if(t==null){a=r*zt;n.point(-Ct,a);n.point(0,a);n.point(Ct,a);n.point(Ct,0);n.point(Ct,-a);n.point(0,-a);n.point(-Ct,-a);n.point(-Ct,0);n.point(-Ct,a)}else if(x(t[0]-e[0])>St){var i=t[0]=0?1:-1,k=w*_,M=k>Ct,A=d*x;Ir.add(Math.atan2(A*w*Math.sin(k),v*b+A*Math.cos(k)));i+=M?_+w*Lt:_;if(M^h>=r^m>=r){var T=Rr(Or(f),Or(t));Nr(T);var S=Rr(a,T);Nr(S);var E=(M^_>=0?-1:1)*Ft(S[2]);if(n>E||n===E&&(T[0]||T[1])){o+=M^_>=0?1:-1}}if(!g++)break;h=m,d=x,v=b,f=t}}return(i<-St||i0,n=x(e)>St,a=na(t,6*Pt);return fn(i,o,a,r?[0,-t]:[-Ct,t-Ct]);function i(t,r){return Math.cos(t)*Math.cos(r)>e}function o(t){var e,a,o,u,c;return{lineStart:function(){u=o=false;c=1},point:function(f,h){var p=[f,h],d,v=i(f,h),g=r?v?0:l(f,h):v?l(f+(f<0?Ct:-Ct),h):0;if(!e&&(u=o=v))t.lineStart();if(v!==o){d=s(e,p);if(Vr(e,d)||Vr(p,d)){p[0]+=St;p[1]+=St;v=i(p[0],p[1])}}if(v!==o){c=0;if(v){t.lineStart();d=s(p,e);t.point(d[0],d[1])}else{d=s(e,p);t.point(d[0],d[1]);t.lineEnd()}e=d}else if(n&&e&&r^v){var m;if(!(g&a)&&(m=s(p,e,true))){c=0;if(r){t.lineStart();t.point(m[0][0],m[0][1]);t.point(m[1][0],m[1][1]);t.lineEnd()}else{t.point(m[1][0],m[1][1]);t.lineEnd();t.lineStart();t.point(m[0][0],m[0][1])}}}if(v&&(!e||!Vr(e,p))){t.point(p[0],p[1])}e=p,o=v,a=g},lineEnd:function(){if(o)t.lineEnd();e=null},clean:function(){return c|(u&&o)<<1}}}function s(t,r,n){var a=Or(t),i=Or(r);var o=[1,0,0],s=Rr(a,i),l=Dr(s,s),u=s[0],c=l-u*u;if(!c)return!n&&t;var f=e*l/c,h=-e*u/c,p=Rr(o,s),d=Fr(o,f),v=Fr(s,h);Br(d,v);var g=p,m=Dr(d,g),y=Dr(g,g),b=m*m-y*(Dr(d,d)-1);if(b<0)return;var _=Math.sqrt(b),w=Fr(g,(-m-_)/y);Br(w,d);w=jr(w);if(!n)return w;var k=t[0],M=r[0],A=t[1],T=r[1],S;if(M0^w[1]<(x(w[0]-k)Ct^(k<=w[0]&&w[0]<=M)){var I=Fr(g,(-m+_)/y);Br(I,d);return[w,jr(I)]}}function l(e,n){var a=r?t:Ct-t,i=0;if(e<-a)i|=1;else if(e>a)i|=2;if(n<-a)i|=4;else if(n>a)i|=8;return i}}function _n(t,e,r,n){return function(a){var i=a.a,o=a.b,s=i.x,l=i.y,u=o.x,c=o.y,f=0,h=1,p=u-s,d=c-l,v;v=t-s;if(!p&&v>0)return;v/=p;if(p<0){if(v0){if(v>h)return;if(v>f)f=v}v=r-s;if(!p&&v<0)return;v/=p;if(p<0){if(v>h)return;if(v>f)f=v}else if(p>0){if(v0)return;v/=d;if(d<0){if(v0){if(v>h)return;if(v>f)f=v}v=n-l;if(!d&&v<0)return;v/=d;if(d<0){if(v>h)return;if(v>f)f=v}else if(d>0){if(v0)a.a={x:s+f*p,y:l+f*d};if(h<1)a.b={x:s+h*p,y:l+h*d};return a}}var wn=1e9;e.geo.clipExtent=function(){var t,e,r,n,a,i,o={stream:function(t){if(a)a.valid=false;a=i(t);a.valid=true;return a},extent:function(s){if(!arguments.length)return[[t,e],[r,n]];i=kn(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]);if(a)a.valid=false,a=null;return o}};return o.extent([[0,0],[960,500]])};function kn(t,r,n,a){return function(l){var u=l,c=pn(),f=_n(t,r,n,a),h,p,d;var v={point:x,lineStart:E,lineEnd:C,polygonStart:function(){l=c;h=[];p=[];S=true},polygonEnd:function(){l=u;h=e.merge(h);var r=g([t,a]),n=S&&r,i=h.length;if(n||i){l.polygonStart();if(n){l.lineStart();m(null,null,1,l);l.lineEnd()}if(i){ln(h,o,r,m,l)}l.polygonEnd()}h=p=d=null}};function g(t){var e=0,r=p.length,n=t[1];for(var a=0;an&&Rt(l,u,t)>0)++e}else{if(u[1]<=n&&Rt(l,u,t)<0)--e}l=u}}return e!==0}function m(e,o,l,u){var c=0,f=0;if(e==null||(c=i(e,l))!==(f=i(o,l))||s(e,o)<0^l>0){do{u.point(c===0||c===3?t:n,c>1?a:r)}while((c=(c+l+4)%4)!==f)}else{u.point(o[0],o[1])}}function y(e,i){return t<=e&&e<=n&&r<=i&&i<=a}function x(t,e){if(y(t,e))l.point(t,e)}var b,_,w,k,M,A,T,S;function E(){v.point=L;if(p)p.push(d=[]);T=true;A=false;k=M=NaN}function C(){if(h){L(b,_);if(w&&A)c.rejoin();h.push(c.buffer())}v.point=x;if(A)l.lineEnd()}function L(t,e){t=Math.max(-wn,Math.min(wn,t));e=Math.max(-wn,Math.min(wn,e));var r=y(t,e);if(p)d.push([t,e]);if(T){b=t,_=e,w=r;T=false;if(r){l.lineStart();l.point(t,e)}}else{if(r&&A)l.point(t,e);else{var n={a:{x:k,y:M},b:{x:t,y:e}};if(f(n)){if(!A){l.lineStart();l.point(n.a.x,n.a.y)}l.point(n.b.x,n.b.y);if(!r)l.lineEnd();S=false}else if(r){l.lineStart();l.point(t,e);S=false}}}k=t,M=e,A=r}return v};function i(e,a){return x(e[0]-t)0?0:3:x(e[0]-n)0?2:1:x(e[1]-r)0?1:0:a>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var r=i(t,1),n=i(e,1);return r!==n?r-n:r===0?e[1]-t[1]:r===1?t[0]-e[0]:r===2?t[1]-e[1]:e[0]-t[0]}}function Mn(t){var e=0,r=Ct/3,n=Zn(t),a=n(e,r);a.parallels=function(t){if(!arguments.length)return[e/Ct*180,r/Ct*180];return n(e=t[0]*Ct/180,r=t[1]*Ct/180)};return a}function An(t,e){var r=Math.sin(t),n=(r+Math.sin(e))/2,a=1+r*(2*n-r),i=Math.sqrt(a)/n;function o(t,e){var r=Math.sqrt(a-2*n*Math.sin(e))/n;return[r*Math.sin(t*=n),i-r*Math.cos(t)]}o.invert=function(t,e){var r=i-e;return[Math.atan2(t,r)/n,Ft((a-(t*t+r*r)*n*n)/(2*n))]};return o}(e.geo.conicEqualArea=function(){return Mn(An)}).raw=An;e.geo.albers=function(){return e.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)};e.geo.albersUsa=function(){var t=e.geo.albers();var r=e.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]);var n=e.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]);var a,i={point:function(t,e){a=[t,e]}},o,s,l;function u(t){var e=t[0],r=t[1];a=null;(o(e,r),a)||(s(e,r),a)||l(e,r);return a}u.invert=function(e){var a=t.scale(),i=t.translate(),o=(e[0]-i[0])/a,s=(e[1]-i[1])/a;return(s>=.12&&s<.234&&o>=-.425&&o<-.214?r:s>=.166&&s<.234&&o>=-.214&&o<-.115?n:t).invert(e)};u.stream=function(e){var a=t.stream(e),i=r.stream(e),o=n.stream(e);return{point:function(t,e){a.point(t,e);i.point(t,e);o.point(t,e)},sphere:function(){a.sphere();i.sphere();o.sphere()},lineStart:function(){a.lineStart();i.lineStart();o.lineStart()},lineEnd:function(){a.lineEnd();i.lineEnd();o.lineEnd()},polygonStart:function(){a.polygonStart();i.polygonStart();o.polygonStart()},polygonEnd:function(){a.polygonEnd();i.polygonEnd();o.polygonEnd()}}};u.precision=function(e){if(!arguments.length)return t.precision();t.precision(e);r.precision(e);n.precision(e);return u};u.scale=function(e){if(!arguments.length)return t.scale();t.scale(e);r.scale(e*.35);n.scale(e);return u.translate(t.translate())};u.translate=function(e){if(!arguments.length)return t.translate();var a=t.scale(),c=+e[0],f=+e[1];o=t.translate(e).clipExtent([[c-.455*a,f-.238*a],[c+.455*a,f+.238*a]]).stream(i).point;s=r.translate([c-.307*a,f+.201*a]).clipExtent([[c-.425*a+St,f+.12*a+St],[c-.214*a-St,f+.234*a-St]]).stream(i).point;l=n.translate([c-.205*a,f+.212*a]).clipExtent([[c-.214*a+St,f+.166*a+St],[c-.115*a-St,f+.234*a-St]]).stream(i).point;return u};return u.scale(1070)};var Tn,Sn,En={point:B,lineStart:B,lineEnd:B,polygonStart:function(){Sn=0;En.lineStart=Cn},polygonEnd:function(){En.lineStart=En.lineEnd=En.point=B;Tn+=x(Sn/2)}};function Cn(){var t,e,r,n;En.point=function(i,o){En.point=a;t=r=i,e=n=o};function a(t,e){Sn+=n*t-r*e;r=t,n=e}En.lineEnd=function(){a(t,e)}}var Ln,In,zn,Pn;var On={point:Dn,lineStart:B,lineEnd:B,polygonStart:B,polygonEnd:B};function Dn(t,e){if(tzn)zn=t;if(ePn)Pn=e}function Rn(){var t=Bn(4.5),e=[];var r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=s},polygonEnd:function(){r.lineEnd=o;r.point=n},pointRadius:function(e){t=Bn(e);return r},result:function(){if(e.length){var t=e.join("");e=[];return t}}};function n(r,n){e.push("M",r,",",n,t)}function a(t,n){e.push("M",t,",",n);r.point=i}function i(t,r){e.push("L",t,",",r)}function o(){r.point=n}function s(){e.push("Z")}return r}function Bn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var Fn={point:Nn,lineStart:jn,lineEnd:Vn,polygonStart:function(){Fn.lineStart=Un},polygonEnd:function(){Fn.point=Nn;Fn.lineStart=jn;Fn.lineEnd=Vn}};function Nn(t,e){Hr+=t;Gr+=e;++Wr}function jn(){var t,e;Fn.point=function(n,a){Fn.point=r;Nn(t=n,e=a)};function r(r,n){var a=r-t,i=n-e,o=Math.sqrt(a*a+i*i);Yr+=o*(t+r)/2;Xr+=o*(e+n)/2;Zr+=o;Nn(t=r,e=n)}}function Vn(){Fn.point=Nn}function Un(){var t,e,r,n;Fn.point=function(i,o){Fn.point=a;Nn(t=r=i,e=n=o)};function a(t,e){var a=t-r,i=e-n,o=Math.sqrt(a*a+i*i);Yr+=o*(r+t)/2;Xr+=o*(n+e)/2;Zr+=o;o=n*t-r*e;$r+=o*(r+t);Jr+=o*(n+e);Kr+=o*3;Nn(r=t,n=e)}Fn.lineEnd=function(){a(t,e)}}function qn(t){var e=4.5;var r={point:n,lineStart:function(){r.point=a},lineEnd:o,polygonStart:function(){r.lineEnd=s},polygonEnd:function(){r.lineEnd=o;r.point=n},pointRadius:function(t){e=t;return r},result:B};function n(r,n){t.moveTo(r+e,n);t.arc(r,n,e,0,Lt)}function a(e,n){t.moveTo(e,n);r.point=i}function i(e,r){t.lineTo(e,r)}function o(){r.point=n}function s(){t.closePath()}return r}function Hn(t){var e=.5,r=Math.cos(30*Pt),n=16;function a(t){return(n?o:i)(t)}function i(e){return Yn(e,function(r,n){r=t(r,n);e.point(r[0],r[1])})}function o(e){var r,a,i,o,l,u,c,f,h,p,d,v,g;var m={point:y,lineStart:x,lineEnd:_,polygonStart:function(){e.polygonStart();m.lineStart=w},polygonEnd:function(){e.polygonEnd();m.lineStart=x}};function y(r,n){r=t(r,n);e.point(r[0],r[1])}function x(){h=NaN;m.point=b;e.lineStart()}function b(r,a){var i=Or([r,a]),o=t(r,a);s(h,p,f,d,v,g,h=o[0],p=o[1],f=r,d=i[0],v=i[1],g=i[2],n,e);e.point(h,p)}function _(){m.point=y;e.lineEnd()}function w(){x();m.point=k;m.lineEnd=M}function k(t,e){b(r=t,a=e),i=h,o=p,l=d,u=v,c=g;m.point=b}function M(){s(h,p,f,d,v,g,i,o,r,l,u,c,n,e);m.lineEnd=_;_()}return m}function s(n,a,i,o,l,u,c,f,h,p,d,v,g,m){var y=c-n,b=f-a,_=y*y+b*b;if(_>4*e&&g--){var w=o+p,k=l+d,M=u+v,A=Math.sqrt(w*w+k*k+M*M),T=Math.asin(M/=A),S=x(x(M)-1)e||x((y*I+b*z)/_-.5)>.3||o*p+l*d+u*v0&&16;return a};return a}e.geo.path=function(){var t=4.5,r,n,a,i,o;function s(r){if(r){if(typeof t==="function")i.pointRadius(+t.apply(this,arguments));if(!o||!o.valid)o=a(i);e.geo.stream(r,o)}return i.result()}s.area=function(t){Tn=0;e.geo.stream(t,a(En));return Tn};s.centroid=function(t){Hr=Gr=Wr=Yr=Xr=Zr=$r=Jr=Kr=0;e.geo.stream(t,a(Fn));return Kr?[$r/Kr,Jr/Kr]:Zr?[Yr/Zr,Xr/Zr]:Wr?[Hr/Wr,Gr/Wr]:[NaN,NaN]};s.bounds=function(t){zn=Pn=-(Ln=In=Infinity);e.geo.stream(t,a(On));return[[Ln,In],[zn,Pn]]};s.projection=function(t){if(!arguments.length)return r;a=(r=t)?t.stream||Gn(t):P;return l()};s.context=function(e){if(!arguments.length)return n;i=(n=e)==null?new Rn:new qn(e);if(typeof t!=="function")i.pointRadius(t);return l()};s.pointRadius=function(e){if(!arguments.length)return t;t=typeof e==="function"?e:(i.pointRadius(+e),+e);return s};function l(){o=null;return s}return s.projection(e.geo.albersUsa()).context(null)};function Gn(t){var e=Hn(function(e,r){return t([e*Ot,r*Ot])});return function(t){return $n(e(t))}}e.geo.transform=function(t){return{stream:function(e){var r=new Wn(e);for(var n in t)r[n]=t[n];return r}}};function Wn(t){this.stream=t}Wn.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()}};function Yn(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()}}}e.geo.projection=Xn;e.geo.projectionMutator=Zn;function Xn(t){return Zn(function(){return t})()}function Zn(t){var r,n,a,i=Hn(function(t,e){t=r(t,e);return[t[0]*o+d,v-t[1]*o]}),o=150,s=480,l=250,u=0,c=0,f=0,h=0,p=0,d,v,g=vn,m=P,y=null,x=null,b;function _(t){t=a(t[0]*Pt,t[1]*Pt);return[t[0]*o+d,v-t[1]*o]}function w(t){t=a.invert((t[0]-d)/o,(v-t[1])/o);return t&&[t[0]*Ot,t[1]*Ot]}_.stream=function(t){if(b)b.valid=false;b=$n(g(n,i(m(t))));b.valid=true;return b};_.clipAngle=function(t){if(!arguments.length)return y;g=t==null?(y=t,vn):bn((y=+t)*Pt);return M()};_.clipExtent=function(t){if(!arguments.length)return x;x=t;m=t?kn(t[0][0],t[0][1],t[1][0],t[1][1]):P;return M()};_.scale=function(t){if(!arguments.length)return o;o=+t;return k()};_.translate=function(t){if(!arguments.length)return[s,l];s=+t[0];l=+t[1];return k()};_.center=function(t){if(!arguments.length)return[u*Ot,c*Ot];u=t[0]%360*Pt;c=t[1]%360*Pt;return k()};_.rotate=function(t){if(!arguments.length)return[f*Ot,h*Ot,p*Ot];f=t[0]%360*Pt;h=t[1]%360*Pt;p=t.length>2?t[2]%360*Pt:0;return k()};e.rebind(_,i,"precision");function k(){a=on(n=Qn(f,h,p),r);var t=r(u,c);d=s-t[0]*o;v=l+t[1]*o;return M()}function M(){if(b)b.valid=false,b=null;return _}return function(){r=t.apply(this,arguments);_.invert=r.invert&&w;return k()}}function $n(t){return Yn(t,function(e,r){t.point(e*Pt,r*Pt)})}function Jn(t,e){return[t,e]}(e.geo.equirectangular=function(){return Xn(Jn)}).raw=Jn.invert=Jn;e.geo.rotation=function(t){t=Qn(t[0]%360*Pt,t[1]*Pt,t.length>2?t[2]*Pt:0);function e(e){e=t(e[0]*Pt,e[1]*Pt);return e[0]*=Ot,e[1]*=Ot,e}e.invert=function(e){e=t.invert(e[0]*Pt,e[1]*Pt);return e[0]*=Ot,e[1]*=Ot,e};return e};function Kn(t,e){return[t>Ct?t-Lt:t<-Ct?t+Lt:t,e]}Kn.invert=Jn;function Qn(t,e,r){return t?e||r?on(ea(t),ra(e,r)):ea(t):e||r?ra(e,r):Kn}function ta(t){return function(e,r){return e+=t,[e>Ct?e-Lt:e<-Ct?e+Lt:e,r]}}function ea(t){var e=ta(t);e.invert=ta(-t);return e}function ra(t,e){var r=Math.cos(t),n=Math.sin(t),a=Math.cos(e),i=Math.sin(e);function o(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*r+s*n;return[Math.atan2(l*a-c*i,s*r-u*n),Ft(c*a+l*i)]}o.invert=function(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*a-l*i;return[Math.atan2(l*a+u*i,s*r+c*n),Ft(c*r-s*n)]};return o}e.geo.circle=function(){var t=[0,0],e,r=6,n;function a(){var e=typeof t==="function"?t.apply(this,arguments):t,r=Qn(-e[0]*Pt,-e[1]*Pt,0).invert,a=[];n(null,null,1,{point:function(t,e){a.push(t=r(t,e));t[0]*=Ot,t[1]*=Ot}});return{type:"Polygon",coordinates:[a]}}a.origin=function(e){if(!arguments.length)return t;t=e;return a};a.angle=function(t){if(!arguments.length)return e;n=na((e=+t)*Pt,r*Pt);return a};a.precision=function(t){if(!arguments.length)return r;n=na(e*Pt,(r=+t)*Pt);return a};return a.angle(90)};function na(t,e){var r=Math.cos(t),n=Math.sin(t);return function(a,i,o,s){var l=o*e;if(a!=null){a=aa(r,a);i=aa(r,i);if(o>0?ai)a+=o*Lt}else{a=t+o*Lt;i=t-.5*l}for(var u,c=a;o>0?c>i:cSt}).map(p)).concat(e.range(Math.ceil(o/c)*c,i,c).filter(function(t){return x(t%h)>St}).map(d))}y.lines=function(){return b().map(function(t){return{type:"LineString",coordinates:t}})};y.outline=function(){return{type:"Polygon",coordinates:[v(a).concat(g(s).slice(1),v(n).reverse().slice(1),g(l).reverse().slice(1))]}};y.extent=function(t){if(!arguments.length)return y.minorExtent();return y.majorExtent(t).minorExtent(t)};y.majorExtent=function(t){if(!arguments.length)return[[a,l],[n,s]];a=+t[0][0],n=+t[1][0];l=+t[0][1],s=+t[1][1];if(a>n)t=a,a=n,n=t;if(l>s)t=l,l=s,s=t;return y.precision(m)};y.minorExtent=function(e){if(!arguments.length)return[[r,o],[t,i]];r=+e[0][0],t=+e[1][0];o=+e[0][1],i=+e[1][1];if(r>t)e=r,r=t,t=e;if(o>i)e=o,o=i,i=e;return y.precision(m)};y.step=function(t){if(!arguments.length)return y.minorStep();return y.majorStep(t).minorStep(t)};y.majorStep=function(t){if(!arguments.length)return[f,h];f=+t[0],h=+t[1];return y};y.minorStep=function(t){if(!arguments.length)return[u,c];u=+t[0],c=+t[1];return y};y.precision=function(e){if(!arguments.length)return m;m=+e;p=ia(o,i,90);d=oa(r,t,m);v=ia(l,s,90);g=oa(a,n,m);return y};return y.majorExtent([[-180,-90+St],[180,90-St]]).minorExtent([[-180,-80-St],[180,80+St]])};function ia(t,r,n){var a=e.range(t,r-St,n).concat(r);return function(t){return a.map(function(e){return[t,e]})}}function oa(t,r,n){var a=e.range(t,r-St,n).concat(r);return function(t){return a.map(function(e){return[e,t]})}}function sa(t){return t.source}function la(t){return t.target}e.geo.greatArc=function(){var t=sa,r,n=la,a;function i(){return{type:"LineString",coordinates:[r||t.apply(this,arguments),a||n.apply(this,arguments)]}}i.distance=function(){return e.geo.distance(r||t.apply(this,arguments),a||n.apply(this,arguments))};i.source=function(e){if(!arguments.length)return t;t=e,r=typeof e==="function"?null:e;return i};i.target=function(t){if(!arguments.length)return n;n=t,a=typeof t==="function"?null:t;return i};i.precision=function(){return arguments.length?i:0};return i};e.geo.interpolate=function(t,e){return ua(t[0]*Pt,t[1]*Pt,e[0]*Pt,e[1]*Pt)};function ua(t,e,r,n){var a=Math.cos(e),i=Math.sin(e),o=Math.cos(n),s=Math.sin(n),l=a*Math.cos(t),u=a*Math.sin(t),c=o*Math.cos(r),f=o*Math.sin(r),h=2*Math.asin(Math.sqrt(Ut(n-e)+a*o*Ut(r-t))),p=1/Math.sin(h);var d=h?function(t){var e=Math.sin(t*=h)*p,r=Math.sin(h-t)*p,n=r*l+e*c,a=r*u+e*f,o=r*i+e*s;return[Math.atan2(a,n)*Ot,Math.atan2(o,Math.sqrt(n*n+a*a))*Ot]}:function(){return[t*Ot,e*Ot]};d.distance=h;return d}e.geo.length=function(t){ca=0;e.geo.stream(t,fa);return ca};var ca;var fa={sphere:B,point:B,lineStart:ha,lineEnd:B,polygonStart:B,polygonEnd:B};function ha(){var t,e,r;fa.point=function(a,i){t=a*Pt,e=Math.sin(i*=Pt),r=Math.cos(i);fa.point=n};fa.lineEnd=function(){fa.point=fa.lineEnd=B};function n(n,a){var i=Math.sin(a*=Pt),o=Math.cos(a),s=x((n*=Pt)-t),l=Math.cos(s);ca+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=r*i-e*o*l)*s),e*i+r*o*l);t=n,e=i,r=o}}function pa(t,e){function r(e,r){var n=Math.cos(e),a=Math.cos(r),i=t(n*a);return[i*a*Math.sin(e),i*Math.sin(r)]}r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),a=e(n),i=Math.sin(a),o=Math.cos(a);return[Math.atan2(t*i,n*o),Math.asin(n&&r*i/n)]};return r}var da=pa(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(e.geo.azimuthalEqualArea=function(){return Xn(da)}).raw=da;var va=pa(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},P);(e.geo.azimuthalEquidistant=function(){return Xn(va)}).raw=va;function ga(t,e){var r=Math.cos(t),n=function(t){return Math.tan(Ct/4+t/2)},a=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(n(e)/n(t)),i=r*Math.pow(n(t),a)/a;if(!a)return xa;function o(t,e){if(i>0){if(e<-zt+St)e=-zt+St}else{if(e>zt-St)e=zt-St}var r=i/Math.pow(n(e),a);return[r*Math.sin(a*t),i-r*Math.cos(a*t)]}o.invert=function(t,e){var r=i-e,n=Dt(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(i/n,1/a))-zt]};return o}(e.geo.conicConformal=function(){return Mn(ga)}).raw=ga;function ma(t,e){var r=Math.cos(t),n=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),a=r/n+t;if(x(n)2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])};return r([0,0,90])}).raw=ka;e.geom={};function Ma(t){return t[0]}function Aa(t){return t[1]}e.geom.hull=function(t){var e=Ma,r=Aa;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n=Me(e),a=Me(r),i,o=t.length,s=[],l=[];for(i=0;i=0;--i)p.push(t[s[u[i]][2]]);for(i=+f;i1&&Rt(t[r[n-2]],t[r[n-1]],t[a])<=0)--n;r[n++]=a}return r.slice(0,n)}function Sa(t,e){return t[0]-e[0]||t[1]-e[1]}e.geom.polygon=function(t){H(t,Ea);return t};var Ea=e.geom.polygon.prototype=[];Ea.area=function(){var t=-1,e=this.length,r,n=this[e-1],a=0;while(++tSt)s=s.L;else{o=e-Ga(s,r);if(o>St){if(!s.R){n=s;break}s=s.R}else{if(i>-St){n=s.P;a=s}else if(o>-St){n=s;a=s.N}else{n=a=s}break}}}var l=ja(t);Oa.insert(n,l);if(!n&&!a)return;if(n===a){Ja(n);a=ja(n.site);Oa.insert(l,a);l.edge=a.edge=ei(n.site,l.site);$a(n);$a(a);return}if(!a){l.edge=ei(n.site,l.site);return}Ja(n);Ja(a);var u=n.site,c=u.x,f=u.y,h=t.x-c,p=t.y-f,d=a.site,v=d.x-c,g=d.y-f,m=2*(h*g-p*v),y=h*h+p*p,x=v*v+g*g,b={x:(g*y-p*x)/m+c,y:(h*x-v*y)/m+f};ni(a.edge,u,d,b);l.edge=ei(u,t,null,b);a.edge=ei(t,d,null,b);$a(n);$a(a)}function Ha(t,e){var r=t.site,n=r.x,a=r.y,i=a-e;if(!i)return n;var o=t.P;if(!o)return-Infinity;r=o.site;var s=r.x,l=r.y,u=l-e;if(!u)return s;var c=s-n,f=1/i-1/u,h=c/u;if(f)return(-h+Math.sqrt(h*h-2*f*(c*c/(-2*u)-l+u/2+a-i/2)))/f+n;return(n+s)/2}function Ga(t,e){var r=t.N;if(r)return Ha(r,e);var n=t.site;return n.y===e?n.x:Infinity}function Wa(t){this.site=t;this.edges=[]}Wa.prototype.prepare=function(){var t=this.edges,e=t.length,r;while(e--){r=t[e].edge;if(!r.b||!r.a)t.splice(e,1)}t.sort(Xa);return t.length};function Ya(t){var e=t[0][0],r=t[1][0],n=t[0][1],a=t[1][1],i,o,s,l,u=Pa,c=u.length,f,h,p,d,v,g;while(c--){f=u[c];if(!f||!f.prepare())continue;p=f.edges;d=p.length;h=0;while(hSt||x(l-o)>St){p.splice(h,0,new ai(ri(f.site,g,x(s-e)St?{x:e,y:x(i-e)St?{x:x(o-a)St?{x:r,y:x(i-r)St?{x:x(o-n)=-Et)return;var p=l*l+u*u,d=c*c+f*f,v=(f*p-u*d)/h,g=(l*d-c*p)/h,f=g+s;var m=Fa.pop()||new Za;m.arc=t;m.site=a;m.x=v+o;m.y=f+Math.sqrt(v*v+g*g);m.cy=f;t.circle=m;var y=null,x=Ba._;while(x){if(m.y=i)return;if(c>h){if(!n)n={x:d,y:o};else if(n.y>=s)return;r={x:d,y:s}}else{if(!n)n={x:d,y:s};else if(n.y1){if(c>h){if(!n)n={x:(o-m)/g,y:o};else if(n.y>=s)return;r={x:(s-m)/g,y:s}}else{if(!n)n={x:(s-m)/g,y:s};else if(n.y=i)return;r={x:i,y:g*i+m}}else{if(!n)n={x:i,y:g*i+m};else if(n.x=r&&u.x<=a&&u.y>=n&&u.y<=o?[[r,o],[a,o],[a,n],[r,n]]:[];c.point=t[s]});return e}function s(t){return t.map(function(t,e){return{x:Math.round(n(t,e)/St)*St,y:Math.round(a(t,e)/St)*St,i:e}})}o.links=function(t){return ci(s(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})};o.triangles=function(t){var e=[];ci(s(t)).cells.forEach(function(r,n){var a=r.site,i=r.edges.sort(Xa),o=-1,s=i.length,l,u,c=i[s-1].edge,f=c.l===a?c.r:c.l;while(++om)m=l.x;if(l.y>y)y=l.y;f.push(l.x);h.push(l.y)}else for(p=0;pm)m=b;if(_>y)y=_;f.push(b);h.push(_)}}var w=m-v,k=y-g;if(w>k)y=g+w;else m=v+k;function M(t,e,r,n,a,i,o,s){if(isNaN(r)||isNaN(n))return;if(t.leaf){var l=t.x,u=t.y;if(l!=null){if(x(l-r)+x(u-n)<.01){A(t,e,r,n,a,i,o,s)}else{var c=t.point;t.x=t.y=t.point=null;A(t,c,l,u,a,i,o,s);A(t,e,r,n,a,i,o,s)}}else{t.x=r,t.y=n,t.point=e}}else{A(t,e,r,n,a,i,o,s)}}function A(t,e,r,n,a,i,o,s){var l=(a+o)*.5,u=(i+s)*.5,c=r>=l,f=n>=u,h=f<<1|c;t.leaf=false;t=t.nodes[h]||(t.nodes[h]=gi());if(c)a=l;else o=l;if(f)i=u;else s=u;M(t,e,r,n,a,i,o,s)}var T=gi();T.add=function(t){M(T,t,+u(t,++p),+c(t,p),v,g,m,y)};T.visit=function(t){mi(t,T,v,g,m,y)};T.find=function(t){return yi(T,t[0],t[1],v,g,m,y)};p=-1;if(e==null){while(++pi||f>o||h=b,k=r>=_;for(var M=k<<1|w,A=M+4;Mr){i=e.slice(r,i);if(s[o])s[o]+=i;else s[++o]=i}if((n=n[0])===(a=a[0])){if(s[o])s[o]+=a;else s[++o]=a}else{s[++o]=null;l.push({i:o,x:_i(n,a)})}r=Mi.lastIndex}if(r=0&&!(a=e.interpolators[n](t,r)));return a}e.interpolators=[function(t,e){var r=typeof e;return(r==="string"?ke.has(e.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(e)?xi:wi:e instanceof Zt?xi:Array.isArray(e)?Ti:r==="object"&&isNaN(e)?bi:_i)(t,e)}];e.interpolateArray=Ti;function Ti(t,e){var r=[],n=[],a=t.length,i=e.length,o=Math.min(t.length,e.length),s;for(s=0;s=0?t.slice(0,e):t,a=e>=0?t.slice(e+1):"in";r=Ei.get(r)||Si;a=Ci.get(a)||P;return Li(a(r.apply(null,n.call(arguments,1))))};function Li(t){return function(e){return e<=0?0:e>=1?1:t(e)}}function Ii(t){return function(e){return 1-t(1-e)}}function zi(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function Pi(t){return t*t}function Oi(t){return t*t*t}function Di(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Ri(t){return function(e){return Math.pow(e,t)}}function Bi(t){return 1-Math.cos(t*zt)}function Fi(t){return Math.pow(2,10*(t-1))}function Ni(t){return 1-Math.sqrt(1-t*t)}function ji(t,e){var r;if(arguments.length<2)e=.45;if(arguments.length)r=e/Lt*Math.asin(1/t);else t=1,r=e/4;return function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*Lt/e)}}function Vi(t){if(!t)t=1.70158;return function(e){return e*e*((t+1)*e-t)}}function Ui(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}e.interpolateHcl=qi;function qi(t,r){t=e.hcl(t);r=e.hcl(r);var n=t.h,a=t.c,i=t.l,o=r.h-n,s=r.c-a,l=r.l-i;if(isNaN(s))s=0,a=isNaN(a)?r.c:a;if(isNaN(o))o=0,n=isNaN(n)?r.h:n;else if(o>180)o-=360;else if(o<-180)o+=360;return function(t){return ee(n+o*t,a+s*t,i+l*t)+""}}e.interpolateHsl=Hi;function Hi(t,r){t=e.hsl(t);r=e.hsl(r);var n=t.h,a=t.s,i=t.l,o=r.h-n,s=r.s-a,l=r.l-i;if(isNaN(s))s=0,a=isNaN(a)?r.s:a;if(isNaN(o))o=0,n=isNaN(n)?r.h:n;else if(o>180)o-=360;else if(o<-180)o+=360;return function(t){return Kt(n+o*t,a+s*t,i+l*t)+""}}e.interpolateLab=Gi;function Gi(t,r){t=e.lab(t);r=e.lab(r);var n=t.l,a=t.a,i=t.b,o=r.l-n,s=r.a-a,l=r.b-i;return function(t){return le(n+o*t,a+s*t,i+l*t)+""}}e.interpolateRound=Wi;function Wi(t,e){e-=t;return function(r){return Math.round(t+e*r)}}e.transform=function(t){var r=i.createElementNS(e.ns.prefix.svg,"g");return(e.transform=function(t){if(t!=null){r.setAttribute("transform",t);var e=r.transform.baseVal.consolidate()}return new Yi(e?e.matrix:Ji)})(t)};function Yi(t){var e=[t.a,t.b],r=[t.c,t.d],n=Zi(e),a=Xi(e,r),i=Zi($i(r,e,-a))||0;if(e[0]*r[1]180)e+=360;else if(e-t>180)t+=360;n.push({i:r.push(Ki(r)+"rotate(",null,")")-2,x:_i(t,e)})}else if(e){r.push(Ki(r)+"rotate("+e+")")}}function eo(t,e,r,n){if(t!==e){n.push({i:r.push(Ki(r)+"skewX(",null,")")-2,x:_i(t,e)})}else if(e){r.push(Ki(r)+"skewX("+e+")")}}function ro(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var a=r.push(Ki(r)+"scale(",null,",",null,")");n.push({i:a-4,x:_i(t[0],e[0])},{i:a-2,x:_i(t[1],e[1])})}else if(e[0]!==1||e[1]!==1){r.push(Ki(r)+"scale("+e+")")}}function no(t,r){var n=[],a=[];t=e.transform(t),r=e.transform(r);Qi(t.translate,r.translate,n,a);to(t.rotate,r.rotate,n,a);eo(t.skew,r.skew,n,a);ro(t.scale,r.scale,n,a);t=r=null;return function(t){var e=-1,r=a.length,i;while(++e0){o=e}else{n.c=null,n.t=NaN,n=null;r.end({type:"end",alpha:o=0})}}else if(e>0){r.start({type:"start",alpha:o=e});n=Oe(t.tick)}return t};t.start=function(){var e,r=d.length,n=v.length,i=a[0],o=a[1],s,f;for(e=0;e=0){i.push(c=u[l]);c.parent=s;c.depth=s.depth+1}if(r)s.value=0;s.children=u}else{if(r)s.value=+r.call(n,s,s.depth)||0;delete s.children}}bo(a,function(e){var n,a;if(t&&(n=e.children))n.sort(t);if(r&&(a=e.parent))a.value+=e.value});return o}n.sort=function(e){if(!arguments.length)return t;t=e;return n};n.children=function(t){if(!arguments.length)return e;e=t;return n};n.value=function(t){if(!arguments.length)return r;r=t;return n};n.revalue=function(t){if(r){xo(t,function(t){if(t.children)t.value=0});bo(t,function(t){var e;if(!t.children)t.value=+r.call(n,t,t.depth)||0;if(e=t.parent)e.value+=t.value})}return t};return n};function yo(t,r){e.rebind(t,r,"sort","children","value");t.nodes=t;t.links=Mo;return t}function xo(t,e){var r=[t];while((t=r.pop())!=null){e(t);if((a=t.children)&&(n=a.length)){var n,a;while(--n>=0)r.push(a[n])}}}function bo(t,e){var r=[t],n=[];while((t=r.pop())!=null){n.push(t);if((o=t.children)&&(i=o.length)){var a=-1,i,o;while(++aa)a=s;n.push(s)}for(o=0;on){r=e;n=a}}return r}function Oo(t){return t.reduce(Do,0)}function Do(t,e){return t+e[1]}e.layout.histogram=function(){var t=true,r=Number,n=Fo,a=Ro;function i(i,o){var s=[],l=i.map(r,this),u=n.call(this,l,o),c=a.call(this,u,l,o),f,o=-1,h=l.length,p=c.length-1,d=t?1:1/h,v;while(++o0){o=-1;while(++o=u[0]&&v<=u[1]){f=s[e.bisect(c,v,1,p)-1];f.y+=d;f.push(i[o])}}}return s}i.value=function(t){if(!arguments.length)return r;r=t;return i};i.range=function(t){if(!arguments.length)return n;n=Me(t);return i};i.bins=function(t){if(!arguments.length)return a;a=typeof t==="number"?function(e){return Bo(e,t)}:Me(t);return i};i.frequency=function(e){if(!arguments.length)return t;t=!!e;return i};return i};function Ro(t,e){return Bo(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Bo(t,e){var r=-1,n=+t[0],a=(t[1]-n)/e,i=[];while(++r<=e)i[r]=a*r+n;return i}function Fo(t){return[e.min(t),e.max(t)]}e.layout.pack=function(){var t=e.layout.hierarchy().sort(No),r=0,n=[1,1],a;function i(e,i){var o=t.call(this,e,i),s=o[0],l=n[0],u=n[1],c=a==null?Math.sqrt:typeof a==="function"?a:function(){return a};s.x=s.y=0;bo(s,function(t){t.r=+c(t.value)});bo(s,qo);if(r){var f=r*(a?1:Math.max(2*s.r/l,2*s.r/u))/2;bo(s,function(t){t.r+=f});bo(s,qo);bo(s,function(t){t.r-=f})}Wo(s,l/2,u/2,a?1:1/Math.max(2*s.r/l,2*s.r/u));return o}i.size=function(t){if(!arguments.length)return n;n=t;return i};i.radius=function(t){if(!arguments.length)return a;a=t==null||typeof t==="function"?t:+t;return i};i.padding=function(t){if(!arguments.length)return r;r=+t;return i};return yo(i,t)};function No(t,e){return t.value-e.value}function jo(t,e){var r=t._pack_next;t._pack_next=e;e._pack_prev=t;e._pack_next=r;r._pack_prev=e}function Vo(t,e){t._pack_next=e;e._pack_prev=t}function Uo(t,e){var r=e.x-t.x,n=e.y-t.y,a=t.r+e.r;return.999*a*a>r*r+n*n}function qo(t){if(!(e=t.children)||!(h=e.length))return;var e,r=Infinity,n=-Infinity,a=Infinity,i=-Infinity,o,s,l,u,c,f,h;function p(t){r=Math.min(t.x-t.r,r);n=Math.max(t.x+t.r,n);a=Math.min(t.y-t.r,a);i=Math.max(t.y+t.r,i)}e.forEach(Ho);o=e[0];o.x=-o.r;o.y=0;p(o);if(h>1){s=e[1];s.x=s.r;s.y=0;p(s);if(h>2){l=e[2];Yo(o,s,l);p(l);jo(o,l);o._pack_prev=l;jo(l,s);s=o._pack_next;for(u=3;ud.x)d=t;if(t.depth>v.depth)v=t});var g=r(p,d)/2-p.x,m=n[0]/(d.x+r(d,p)/2+g),y=n[1]/(v.depth||1);xo(f,function(t){t.x=(t.x+g)*m;t.y=t.depth*y})}return u}function o(t){var e={A:null,children:[t]},r=[e],n;while((n=r.pop())!=null){for(var a=n.children,i,o=0,s=a.length;o0){Jo(Qo(o,t,n),t,h);l+=h;u+=h}c+=o.m;l+=a.m;f+=s.m;u+=i.m}if(o&&!$o(i)){i.t=o;i.m+=c-u}if(a&&!Zo(s)){s.t=a;s.m+=l-f;n=t}}return n}function c(t){t.x*=n[0];t.y=t.depth*n[1]}i.separation=function(t){if(!arguments.length)return r;r=t;return i};i.size=function(t){if(!arguments.length)return a?null:n;a=(n=t)==null?c:null;return i};i.nodeSize=function(t){if(!arguments.length)return a?n:null;a=(n=t)==null?null:c;return i};return yo(i,t)};function Xo(t,e){return t.parent==e.parent?1:2}function Zo(t){var e=t.children;return e.length?e[0]:t.t}function $o(t){var e=t.children,r;return(r=e.length)?e[r-1]:t.t}function Jo(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 Ko(t){var e=0,r=0,n=t.children,a=n.length,i;while(--a>=0){i=n[a];i.z+=e;i.m+=e;e+=i.s+(r+=i.c)}}function Qo(t,e,r){return t.a.parent===e.parent?t.a:r}e.layout.cluster=function(){var t=e.layout.hierarchy().sort(null).value(null),r=Xo,n=[1,1],a=false;function i(e,i){var o=t.call(this,e,i),s=o[0],l,u=0;bo(s,function(t){var e=t.children;if(e&&e.length){t.x=es(e);t.y=ts(e)}else{t.x=l?u+=r(t,l):0;t.y=0;l=t}});var c=rs(s),f=ns(s),h=c.x-r(c,f)/2,p=f.x+r(f,c)/2;bo(s,a?function(t){t.x=(t.x-s.x)*n[0];t.y=(s.y-t.y)*n[1]}:function(t){t.x=(t.x-h)/(p-h)*n[0];t.y=(1-(s.y?t.y/s.y:1))*n[1]});return o}i.separation=function(t){if(!arguments.length)return r;r=t;return i};i.size=function(t){if(!arguments.length)return a?null:n;a=(n=t)==null;return i};i.nodeSize=function(t){if(!arguments.length)return a?n:null;a=(n=t)!=null;return i};return yo(i,t)};function ts(t){return 1+e.max(t,function(t){return t.y})}function es(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}function rs(t){var e=t.children;return e&&e.length?rs(e[0]):t}function ns(t){var e=t.children,r;return e&&(r=e.length)?ns(e[r-1]):t}e.layout.treemap=function(){var t=e.layout.hierarchy(),r=Math.round,n=[1,1],a=null,i=as,o=false,s,l="squarify",u=.5*(1+Math.sqrt(5));function c(t,e){var r=-1,n=t.length,a,i;while(++r0){n.push(o=a[v-1]);n.area+=o.area;if(l!=="squarify"||(u=p(n,h))<=s){a.pop();s=u}else{n.area-=n.pop().area;d(n,h,r,false);h=Math.min(r.dx,r.dy);n.length=n.area=0;s=Infinity}}if(n.length){d(n,h,r,true);n.length=n.area=0}e.forEach(f)}}function h(t){var e=t.children;if(e&&e.length){var r=i(t),n=e.slice(),a,o=[];c(n,r.dx*r.dy/t.value);o.area=0;while(a=n.pop()){o.push(a);o.area+=a.area;if(a.z!=null){d(o,a.z?r.dx:r.dy,r,!n.length);o.length=o.area=0}}e.forEach(h)}}function p(t,e){var r=t.area,n,a=0,i=Infinity,o=-1,s=t.length;while(++oa)a=n}r*=r;e*=e;return r?Math.max(e*a*u/r,r/(e*i*u)):Infinity}function d(t,e,n,a){var i=-1,o=t.length,s=n.x,l=n.y,u=e?r(t.area/e):0,c;if(e==n.dx){if(a||u>n.dy)u=n.dy;while(++in.dx)u=n.dx;while(++i1);return t+e*r*Math.sqrt(-2*Math.log(a)/a)}},logNormal:function(){var t=e.random.normal.apply(e,arguments);return function(){return Math.exp(t())}},bates:function(t){var r=e.random.irwinHall(t);return function(){return r()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;r2?hs:ls,l=n?io:ao;a=o(t,e,l,r);i=o(e,t,l,Ai);return s}function s(t){return a(t)}s.invert=function(t){return i(t)};s.domain=function(e){if(!arguments.length)return t;t=e.map(Number);return o()};s.range=function(t){if(!arguments.length)return e;e=t;return o()};s.rangeRound=function(t){return s.range(t).interpolate(Wi)};s.clamp=function(t){if(!arguments.length)return n;n=t;return o()};s.interpolate=function(t){if(!arguments.length)return r;r=t;return o()};s.ticks=function(e){return ms(t,e)};s.tickFormat=function(e,r){return ys(t,e,r)};s.nice=function(e){vs(t,e);return o()};s.copy=function(){return ps(t,e,r,n)};return o()}function ds(t,r){return e.rebind(t,r,"range","rangeRound","interpolate","clamp")}function vs(t,e){us(t,cs(gs(t,e)[2]));us(t,cs(gs(t,e)[2]));return t}function gs(t,e){if(e==null)e=10;var r=os(t),n=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),i=e/n*a;if(i<=.15)a*=10;else if(i<=.35)a*=5;else if(i<=.75)a*=2;r[0]=Math.ceil(r[0]/a)*a;r[1]=Math.floor(r[1]/a)*a+a*.5;r[2]=a;return r}function ms(t,r){return e.range.apply(e,gs(t,r))}function ys(t,r,n){var a=gs(t,r);if(n){var i=Ue.exec(n);i.shift();if(i[8]==="s"){var o=e.formatPrefix(Math.max(x(a[0]),x(a[1])));if(!i[7])i[7]="."+bs(o.scale(a[2]));i[8]="f";n=e.format(i.join(""));return function(t){return n(o.scale(t))+o.symbol}}if(!i[7])i[7]="."+_s(i[8],a);n=i.join("")}else{n=",."+bs(a[2])+"f"}return e.format(n)}var xs={s:1,g:1,p:1,r:1,e:1};function bs(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function _s(t,e){var r=bs(e[2]);return t in xs?Math.abs(r-bs(Math.max(x(e[0]),x(e[1]))))+ +(t!=="e"):r-(t==="%")*2}e.scale.log=function(){return ws(e.scale.linear().domain([0,1]),10,true,[1,10])};function ws(t,r,n,a){function i(t){return(n?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(r)}function o(t){return n?Math.pow(r,t):-Math.pow(r,-t)}function s(e){return t(i(e))}s.invert=function(e){return o(t.invert(e))};s.domain=function(e){if(!arguments.length)return a;n=e[0]>=0;t.domain((a=e.map(Number)).map(i));return s};s.base=function(e){if(!arguments.length)return r;r=+e;t.domain(a.map(i));return s};s.nice=function(){var e=us(a.map(i),n?Math:Ms);t.domain(e);a=e.map(o);return s};s.ticks=function(){var t=os(a),e=[],s=t[0],l=t[1],u=Math.floor(i(s)),c=Math.ceil(i(l)),f=r%1?2:r;if(isFinite(c-u)){if(n){for(;u0;h--)e.push(o(u)*h)}for(u=0;e[u]l;c--){}e=e.slice(u,c)}return e};s.tickFormat=function(t,n){if(!arguments.length)return ks;if(arguments.length<2)n=ks;else if(typeof n!=="function")n=e.format(n);var a=Math.max(1,r*t/s.ticks().length);return function(t){var e=t/o(Math.round(i(t)));if(e*r0?n[e-1]:t[0],ef?0:1;if(u=It)return l(u,p)+(s?l(s,1-p):"")+"Z";var d,v,g,m,y=0,x=0,b,_,w,k,M,A,T,S,E=[];if(m=(+o.apply(this,arguments)||0)/2){g=n===Bs?Math.sqrt(s*s+u*u):+n.apply(this,arguments);if(!p)x*=-1;if(u)x=Ft(g/u*Math.sin(m));if(s)y=Ft(g/s*Math.sin(m))}if(u){b=u*Math.cos(c+x);_=u*Math.sin(c+x);w=u*Math.cos(f-x);k=u*Math.sin(f-x);var C=Math.abs(f-c-2*x)<=Ct?0:1;if(x&&qs(b,_,w,k)===p^C){var L=(c+f)/2;b=u*Math.cos(L);_=u*Math.sin(L);w=k=null}}else{b=_=0}if(s){M=s*Math.cos(f-y);A=s*Math.sin(f-y);T=s*Math.cos(c+y);S=s*Math.sin(c+y);var I=Math.abs(c-f+2*y)<=Ct?0:1;if(y&&qs(M,A,T,S)===1-p^I){var z=(c+f)/2;M=s*Math.cos(z);A=s*Math.sin(z);T=S=null}}else{M=A=0}if(h>St&&(d=Math.min(Math.abs(u-s)/2,+r.apply(this,arguments)))>.001){v=s0?0:1}function Hs(t,e,r,n,a){var i=t[0]-e[0],o=t[1]-e[1],s=(a?n:-n)/Math.sqrt(i*i+o*o),l=s*o,u=-s*i,c=t[0]+l,f=t[1]+u,h=e[0]+l,p=e[1]+u,d=(c+h)/2,v=(f+p)/2,g=h-c,m=p-f,y=g*g+m*m,x=r-n,b=c*p-h*f,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-g*_)/y,k=(-b*g-m*_)/y,M=(b*m+g*_)/y,A=(-b*g+m*_)/y,T=w-d,S=k-v,E=M-d,C=A-v;if(T*T+S*S>E*E+C*C)w=M,k=A;return[[w-l,k-u],[w*r/x,k*r/x]]}function Gs(t){var e=Ma,r=Aa,n=sn,a=Ys,i=a.key,o=.7;function s(i){var s=[],l=[],u=-1,c=i.length,f,h=Me(e),p=Me(r);function d(){s.push("M",a(t(l),o))}while(++u1?t.join("L"):t+"Z"}function Xs(t){return t.join("L")+"Z"}function Zs(t){var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];while(++e1)a.push("H",n[0]);return a.join("")}function $s(t){var e=0,r=t.length,n=t[0],a=[n[0],",",n[1]];while(++e1){s=e[1];i=t[l];l++;n+="C"+(a[0]+o[0])+","+(a[1]+o[1])+","+(i[0]-s[0])+","+(i[1]-s[1])+","+i[0]+","+i[1];for(var u=2;u9){i=r*3/Math.sqrt(i);o[s]=i*n;o[s+1]=i*a}}}s=-1;while(++s<=l){i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s]));e.push([i||0,o[s]*i||0])}return e}function vl(t){return t.length<3?Ys(t):t[0]+el(t,dl(t))}e.svg.line.radial=function(){var t=Gs(gl);t.radius=t.x,delete t.x;t.angle=t.y,delete t.y;return t};function gl(t){var e,r=-1,n=t.length,a,i;while(++rCt)+",1 "+e}function u(t,e,r,n){return"Q 0,0 "+n}i.radius=function(t){if(!arguments.length)return r;r=Me(t);return i};i.source=function(e){if(!arguments.length)return t;t=Me(e);return i};i.target=function(t){if(!arguments.length)return e;e=Me(t);return i};i.startAngle=function(t){if(!arguments.length)return n;n=Me(t);return i};i.endAngle=function(t){if(!arguments.length)return a;a=Me(t);return i};return i};function yl(t){return t.radius}e.svg.diagonal=function(){var t=sa,e=la,r=xl;function n(n,a){var i=t.call(this,n,a),o=e.call(this,n,a),s=(i.y+o.y)/2,l=[i,{x:i.x,y:s},{x:o.x,y:s},o];l=l.map(r);return"M"+l[0]+"C"+l[1]+" "+l[2]+" "+l[3]}n.source=function(e){if(!arguments.length)return t;t=Me(e);return n};n.target=function(t){if(!arguments.length)return e;e=Me(t);return n};n.projection=function(t){if(!arguments.length)return r;r=t;return n};return n};function xl(t){return[t.x,t.y]}e.svg.diagonal.radial=function(){var t=e.svg.diagonal(),r=xl,n=t.projection;t.projection=function(t){return arguments.length?n(bl(r=t)):r};return t};function bl(t){return function(){var e=t.apply(this,arguments),r=e[0],n=e[1]-zt;return[r*Math.cos(n),r*Math.sin(n)]}}e.svg.symbol=function(){var t=wl,e=_l;function r(r,n){return(Ml.get(t.call(this,r,n))||kl)(e.call(this,r,n))}r.type=function(e){if(!arguments.length)return t;t=Me(e);return r};r.size=function(t){if(!arguments.length)return e;e=Me(t);return r};return r};function _l(){return 64}function wl(){return"circle"}function kl(t){var e=Math.sqrt(t/Ct);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}var Ml=e.map({circle:kl,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*Tl)),r=e*Tl;return"M0,"+-e+"L"+r+",0"+" 0,"+e+" "+-r+",0"+"Z"},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/Al),r=e*Al/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/Al),r=e*Al/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});e.svg.symbolTypes=Ml.keys();var Al=Math.sqrt(3),Tl=Math.tan(30*Pt);Z.transition=function(t){var e=zl||++Il,r=Rl(t),n=[],a,i,o=Pl||{time:Date.now(),ease:Di,delay:0,duration:250};for(var s=-1,l=this.length;++s0){f[--h].call(t,l)}if(s>=1){o.event&&o.event.end.call(t,t.__data__,e);if(--i.count)delete i[n];else delete t[r];return 1}}if(!o){s=a.time;l=Oe(h,0,s);o=i[n]={tween:new w,time:s,timer:l,delay:a.delay,duration:a.duration,ease:a.ease,index:e};a=null;++i.count}}e.svg.axis=function(){var t=e.scale.linear(),r=Fl,n=6,i=6,o=3,s=[10],l=null,u;function c(a){a.each(function(){var a=e.select(this);var c=this.__chart__||t,f=this.__chart__=t.copy();var h=l==null?f.ticks?f.ticks.apply(f,s):f.domain():l,p=u==null?f.tickFormat?f.tickFormat.apply(f,s):P:u,d=a.selectAll(".tick").data(h,f),v=d.enter().insert("g",".domain").attr("class","tick").style("opacity",St),g=e.transition(d.exit()).style("opacity",St).remove(),m=e.transition(d.order()).style("opacity",1),y=Math.max(n,0)+o,x;var b=ss(f),_=a.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),e.transition(_));v.append("line");v.append("text");var k=v.select("line"),M=m.select("line"),A=d.select("text").text(p),T=v.select("text"),S=m.select("text"),E=r==="top"||r==="left"?-1:1,C,L,I,z;if(r==="bottom"||r==="top"){x=jl,C="x",I="y",L="x2",z="y2";A.attr("dy",E<0?"0em":".71em").style("text-anchor","middle");w.attr("d","M"+b[0]+","+E*i+"V0H"+b[1]+"V"+E*i)}else{x=Vl,C="y",I="x",L="y2",z="x2";A.attr("dy",".32em").style("text-anchor",E<0?"end":"start");w.attr("d","M"+E*i+","+b[0]+"H0V"+b[1]+"H"+E*i)}k.attr(z,E*n);T.attr(I,E*y);M.attr(L,0).attr(z,E*n);S.attr(C,0).attr(I,E*y);if(f.rangeBand){var O=f,D=O.rangeBand()/2;c=f=function(t){return O(t)+D}}else if(c.rangeBand){c=f}else{g.call(x,f,c)}v.call(x,c,f);m.call(x,f,f)})}c.scale=function(e){if(!arguments.length)return t;t=e;return c};c.orient=function(t){if(!arguments.length)return r;r=t in Nl?t+"":Fl;return c};c.ticks=function(){if(!arguments.length)return s;s=a(arguments);return c};c.tickValues=function(t){if(!arguments.length)return l;l=t;return c};c.tickFormat=function(t){if(!arguments.length)return u;u=t;return c};c.tickSize=function(t){var e=arguments.length;if(!e)return n;n=+t;i=+arguments[e-1];return c};c.innerTickSize=function(t){if(!arguments.length)return n;n=+t;return c};c.outerTickSize=function(t){if(!arguments.length)return i;i=+t;return c};c.tickPadding=function(t){if(!arguments.length)return o;o=+t;return c};c.tickSubdivide=function(){return arguments.length&&c};return c};var Fl="bottom",Nl={top:1,right:1,bottom:1,left:1};function jl(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function Vl(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}e.svg.brush=function(){var t=U(h,"brushstart","brush","brushend"),r=null,n=null,a=[0,0],i=[0,0],o,l,u=true,c=true,f=ql[0];function h(t){t.each(function(){var t=e.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",g).on("touchstart.brush",g);var a=t.selectAll(".background").data([0]);a.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair");t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var i=t.selectAll(".resize").data(f,P);i.exit().remove();i.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Ul[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");i.style("display",h.empty()?"none":null);var o=e.transition(t),s=e.transition(a),l;if(r){l=ss(r);s.attr("x",l[0]).attr("width",l[1]-l[0]);d(o)}if(n){l=ss(n);s.attr("y",l[0]).attr("height",l[1]-l[0]);v(o)}p(o)})}h.event=function(r){r.each(function(){var r=t.of(this,arguments),n={x:a,y:i,i:o,j:l},s=this.__chart__||n;this.__chart__=n;if(zl){e.select(this).transition().each("start.brush",function(){o=s.i;l=s.j;a=s.x;i=s.y;r({type:"brushstart"})}).tween("brush:brush",function(){var t=Ti(a,n.x),e=Ti(i,n.y);o=l=null;return function(o){a=n.x=t(o);i=n.y=e(o);r({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=n.i;l=n.j;r({type:"brush",mode:"resize"});r({type:"brushend"})})}else{r({type:"brushstart"});r({type:"brush",mode:"resize"});r({type:"brushend"})}})};function p(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+a[+/e$/.test(t)]+","+i[+/^s/.test(t)]+")"})}function d(t){t.select(".extent").attr("x",a[0]);t.selectAll(".extent,.n>rect,.s>rect").attr("width",a[1]-a[0])}function v(t){t.select(".extent").attr("y",i[0]);t.selectAll(".extent,.e>rect,.w>rect").attr("height",i[1]-i[0])}function g(){var f=this,g=e.select(e.event.target),m=t.of(f,arguments),y=e.select(f),x=g.datum(),b=!/^(n|s)$/.test(x)&&r,_=!/^(e|w)$/.test(x)&&n,w=g.classed("extent"),k=kt(f),M,A=e.mouse(f),T;var S=e.select(s(f)).on("keydown.brush",L).on("keyup.brush",I);if(e.event.changedTouches){S.on("touchmove.brush",z).on("touchend.brush",O)}else{S.on("mousemove.brush",z).on("mouseup.brush",O)}y.interrupt().selectAll("*").interrupt();if(w){A[0]=a[0]-A[0];A[1]=i[0]-A[1]}else if(x){var E=+/w$/.test(x),C=+/^n/.test(x);T=[a[1-E]-A[0],i[1-C]-A[1]];A[0]=a[E];A[1]=i[C]}else if(e.event.altKey)M=A.slice();y.style("pointer-events","none").selectAll(".resize").style("display",null);e.select("body").style("cursor",g.style("cursor"));m({type:"brushstart"});z();function L(){if(e.event.keyCode==32){if(!w){M=null;A[0]-=a[1];A[1]-=i[1];w=2}j()}}function I(){if(e.event.keyCode==32&&w==2){A[0]+=a[1];A[1]+=i[1];w=0;j()}}function z(){var t=e.mouse(f),o=false;if(T){t[0]+=T[0];t[1]+=T[1]}if(!w){if(e.event.altKey){if(!M)M=[(a[0]+a[1])/2,(i[0]+i[1])/2];A[0]=a[+(t[0]1?{floor:function(e){while(s(e=t.floor(e)))e=Zl(e-1);return e},ceil:function(e){while(s(e=t.ceil(e)))e=Zl(+e+1);return e}}:t))};a.ticks=function(t,e){var r=os(a.domain()),n=t==null?i(r,10):typeof t==="number"?i(r,t):!t.range&&[{range:t},e];if(n)t=n[0],e=n[1];return t.range(r[0],Zl(+r[1]+1),e<1?1:e)};a.tickFormat=function(){return n};a.copy=function(){return Xl(t.copy(),r,n)};return ds(a,t)}function Zl(t){return new Date(t)}var $l=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6];var Jl=[[Ge.second,1],[Ge.second,5],[Ge.second,15],[Ge.second,30],[Ge.minute,1],[Ge.minute,5],[Ge.minute,15],[Ge.minute,30],[Ge.hour,1],[Ge.hour,3],[Ge.hour,6],[Ge.hour,12],[Ge.day,1],[Ge.day,2],[Ge.week,1],[Ge.month,1],[Ge.month,3],[Ge.year,1]];var Kl=Hl.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()&&t.getDate()!=1}],["%b %d",function(t){return t.getDate()!=1}],["%B",function(t){return t.getMonth()}],["%Y",sn]]);var Ql={range:function(t,r,n){return e.range(Math.ceil(t/n)*n,+r,n).map(Zl)},floor:P,ceil:P};Jl.year=Ge.year;Ge.scale=function(){return Xl(e.scale.linear(),Jl,Kl)};var tu=Jl.map(function(t){return[t[0].utc,t[1]]});var eu=Gl.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()&&t.getUTCDate()!=1}],["%b %d",function(t){return t.getUTCDate()!=1}],["%B",function(t){return t.getUTCMonth()}],["%Y",sn]]);tu.year=Ge.year.utc;Ge.scale.utc=function(){return Xl(e.scale.linear(),tu,eu)};e.text=Ae(function(t){return t.responseText});e.json=function(t,e){return Te(t,"application/json",ru,e)};function ru(t){return JSON.parse(t.responseText)}e.html=function(t,e){return Te(t,"text/html",nu,e)};function nu(t){var e=i.createRange();e.selectNode(i.body);return e.createContextualFragment(t.responseText)}e.xml=Ae(function(t){return t.responseXML});if(typeof t==="function"&&t.amd)this.d3=e,t(e);else if(typeof r==="object"&&r.exports)r.exports=e;else this.d3=e}()},{}],148:[function(t,e,r){e.exports=function(){for(var t=0;t=2){return false}}t[r]=n}return true})}else{w=w.filter(function(t){for(var e=0;e<=l;++e){var r=y[t[e]];if(r<0){return false}t[e]=r}return true})}if(l&1){for(var f=0;fo*l){var p=(h-f)/o;r[c]=p*1e3}}return r}function s(t){var e=[];for(var r=t[0];r<=t[1];r++){var n=String.fromCharCode(r);for(var a=t[0];a>>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);var n=e.exports.hi(t);var a=n&(1<<20)-1;if(n&2146435072){a+=1<<20}return[r,a]};e.exports.denormalized=function(t){var r=e.exports.hi(t);return!(r&2146435072)}}).call(this,t("buffer").Buffer)},{buffer:92}],152:[function(t,e,r){var n=t("abs-svg-path");var a=t("normalize-svg-path");var i={M:"moveTo",C:"bezierCurveTo"};e.exports=function(t,e){t.beginPath();a(n(e)).forEach(function(e){var r=e[0];var n=e.slice(1);t[i[r]].apply(t,n)});t.closePath()}},{"abs-svg-path":51,"normalize-svg-path":419}],153:[function(t,e,r){e.exports=function(t){switch(t){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},{}],154:[function(t,e,r){"use strict";function n(t,e,r){var a=t[r]|0;if(a<=0){return[]}var i=new Array(a),o;if(r===t.length-1){for(o=0;o0){return a(t|0,e)}break;case"object":if(typeof t.length==="number"){return n(t,e,0)}break}return[]}e.exports=i},{}],155:[function(t,e,r){"use strict";e.exports=n;e.exports.default=n;function n(t,e,r){r=r||2;var n=e&&e.length,i=n?e[0]*r:t.length,s=a(t,0,i,r,true),l=[];if(!s)return l;var u,c,h,p,d,v,g;if(n)s=f(t,e,s,r);if(t.length>80*r){u=h=t[0];c=p=t[1];for(var m=r;mh)h=d;if(v>p)p=v}g=Math.max(h-u,p-c);g=g!==0?1/g:0}o(s,l,r,u,c,g);return l}function a(t,e,r,n,a){var i,o;if(a===I(t,e,r,n)>0){for(i=e;i=e;i-=n)o=E(i,t[i],t[i+1],o)}if(o&&w(o,o.next)){C(o);o=o.next}return o}function i(t,e){if(!t)return t;if(!e)e=t;var r=t,n;do{n=false;if(!r.steiner&&(w(r,r.next)||_(r.prev,r,r.next)===0)){C(r);r=e=r.prev;if(r===r.next)break;n=true}else{r=r.next}}while(n||r!==e);return e}function o(t,e,r,n,a,f,h){if(!t)return;if(!h&&f)v(t,n,a,f);var p=t,d,g;while(t.prev!==t.next){d=t.prev;g=t.next;if(f?l(t,n,a,f):s(t)){e.push(d.i/r);e.push(t.i/r);e.push(g.i/r);C(t);t=g.next;p=g.next;continue}t=g;if(t===p){if(!h){o(i(t),e,r,n,a,f,1)}else if(h===1){t=u(t,e,r);o(t,e,r,n,a,f,2)}else if(h===2){c(t,e,r,n,a,f)}break}}}function s(t){var e=t.prev,r=t,n=t.next;if(_(e,r,n)>=0)return false;var a=t.next.next;while(a!==t.prev){if(x(e.x,e.y,r.x,r.y,n.x,n.y,a.x,a.y)&&_(a.prev,a,a.next)>=0)return false;a=a.next}return true}function l(t,e,r,n){var a=t.prev,i=t,o=t.next;if(_(a,i,o)>=0)return false;var s=a.xi.x?a.x>o.x?a.x:o.x:i.x>o.x?i.x:o.x,c=a.y>i.y?a.y>o.y?a.y:o.y:i.y>o.y?i.y:o.y;var f=m(s,l,e,r,n),h=m(u,c,e,r,n);var p=t.prevZ,d=t.nextZ;while(p&&p.z>=f&&d&&d.z<=h){if(p!==t.prev&&p!==t.next&&x(a.x,a.y,i.x,i.y,o.x,o.y,p.x,p.y)&&_(p.prev,p,p.next)>=0)return false;p=p.prevZ;if(d!==t.prev&&d!==t.next&&x(a.x,a.y,i.x,i.y,o.x,o.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return false;d=d.nextZ}while(p&&p.z>=f){if(p!==t.prev&&p!==t.next&&x(a.x,a.y,i.x,i.y,o.x,o.y,p.x,p.y)&&_(p.prev,p,p.next)>=0)return false;p=p.prevZ}while(d&&d.z<=h){if(d!==t.prev&&d!==t.next&&x(a.x,a.y,i.x,i.y,o.x,o.y,d.x,d.y)&&_(d.prev,d,d.next)>=0)return false;d=d.nextZ}return true}function u(t,e,r){var n=t;do{var a=n.prev,i=n.next.next;if(!w(a,i)&&k(a,n,n.next,i)&&A(a,i)&&A(i,a)){e.push(a.i/r);e.push(n.i/r);e.push(i.i/r);C(n);C(n.next);n=t=i}n=n.next}while(n!==t);return n}function c(t,e,r,n,a,s){var l=t;do{var u=l.next.next;while(u!==l.prev){if(l.i!==u.i&&b(l,u)){var c=S(l,u);l=i(l,l.next);c=i(c,c.next);o(l,e,r,n,a,s);o(c,e,r,n,a,s);return}u=u.next}l=l.next}while(l!==t)}function f(t,e,r,n){var o=[],s,l,u,c,f;for(s=0,l=e.length;s=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>i){i=s;if(s===n){if(a===r.y)return r;if(a===r.next.y)return r.next}o=r.x=r.x&&r.x>=u&&n!==r.x&&x(ao.x)&&A(r,t)){o=r;f=h}}r=r.next}return o}function v(t,e,r,n){var a=t;do{if(a.z===null)a.z=m(a.x,a.y,e,r,n);a.prevZ=a.prev;a.nextZ=a.next;a=a.next}while(a!==t);a.prevZ.nextZ=null;a.prevZ=null;g(a)}function g(t){var e,r,n,a,i,o,s,l,u=1;do{r=t;t=null;i=null;o=0;while(r){o++;n=r;s=0;for(e=0;e0||l>0&&n){if(s!==0&&(l===0||!n||r.z<=n.z)){a=r;r=r.nextZ;s--}else{a=n;n=n.nextZ;l--}if(i)i.nextZ=a;else t=a;a.prevZ=i;i=a}r=n}i.nextZ=null;u*=2}while(o>1);return t}function m(t,e,r,n,a){t=32767*(t-r)*a;e=32767*(e-n)*a;t=(t|t<<8)&16711935;t=(t|t<<4)&252645135;t=(t|t<<2)&858993459;t=(t|t<<1)&1431655765;e=(e|e<<8)&16711935;e=(e|e<<4)&252645135;e=(e|e<<2)&858993459;e=(e|e<<1)&1431655765;return t|e<<1}function y(t){var e=t,r=t;do{if(e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(i-s)-(a-o)*(n-s)>=0}function b(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!M(t,e)&&A(t,e)&&A(e,t)&&T(t,e)}function _(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function w(t,e){return t.x===e.x&&t.y===e.y}function k(t,e,r,n){if(w(t,e)&&w(r,n)||w(t,n)&&w(r,e))return true;return _(t,e,r)>0!==_(t,e,n)>0&&_(r,n,t)>0!==_(r,n,e)>0}function M(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&k(r,r.next,t,e))return true;r=r.next}while(r!==t);return false}function A(t,e){return _(t.prev,t,t.next)<0?_(t,e,t.next)>=0&&_(t,t.prev,e)>=0:_(t,e,t.prev)<0||_(t,t.next,e)<0}function T(t,e){var r=t,n=false,a=(t.x+e.x)/2,i=(t.y+e.y)/2;do{if(r.y>i!==r.next.y>i&&r.next.y!==r.y&&a<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x)n=!n;r=r.next}while(r!==t);return n}function S(t,e){var r=new L(t.i,t.x,t.y),n=new L(e.i,e.x,e.y),a=t.next,i=e.prev;t.next=e;e.prev=t;r.next=a;a.prev=r;n.next=r;r.prev=n;i.next=n;n.prev=i;return n}function E(t,e,r,n){var a=new L(t,e,r);if(!n){a.prev=a;a.next=a}else{a.next=n.next;a.prev=n;n.next.prev=a;n.next=a}return a}function C(t){t.next.prev=t.prev;t.prev.next=t.next;if(t.prevZ)t.prevZ.nextZ=t.nextZ;if(t.nextZ)t.nextZ.prevZ=t.prevZ}function L(t,e,r){this.i=t;this.x=e;this.y=r;this.prev=null;this.next=null;this.z=null;this.prevZ=null;this.nextZ=null;this.steiner=false}n.deviation=function(t,e,r,n){var a=e&&e.length;var i=a?e[0]*r:t.length;var o=Math.abs(I(t,0,i,r));if(a){for(var s=0,l=e.length;s0){n+=t[a-1].length;r.holes.push(n)}}return r}},{}],156:[function(t,e,r){"use strict";e.exports=a;var n=t("uniq");function a(t,e){var r=t.length;if(typeof e!=="number"){e=0;for(var a=0;a=55296&&b<=56319)M+=t[++g]}M=e?h.call(e,r,M,m):M;if(v){p.value=M;d(y,m,p)}else{y[m]=M}++m}x=m}}if(x===undefined){x=o(t.length);if(v)y=new v(x);for(g=0;g0?1:-1}},{}],167:[function(t,e,r){"use strict";var n=t("../math/sign"),a=Math.abs,i=Math.floor;e.exports=function(t){if(isNaN(t))return 0;t=Number(t);if(t===0||!isFinite(t))return t;return n(t)*i(a(t))}},{"../math/sign":164}],168:[function(t,e,r){"use strict";var n=t("./to-integer"),a=Math.max;e.exports=function(t){return a(0,n(t))}},{"./to-integer":167}],169:[function(t,e,r){"use strict";var n=t("./valid-callable"),a=t("./valid-value"),i=Function.prototype.bind,o=Function.prototype.call,s=Object.keys,l=Object.prototype.propertyIsEnumerable;e.exports=function(t,e){return function(r,u){var c,f=arguments[2],h=arguments[3];r=Object(a(r));n(u);c=s(r);if(h){c.sort(typeof h==="function"?i.call(h,r):undefined)}if(typeof t!=="function")t=c[t];return o.call(t,c,function(t,n){if(!l.call(r,t))return e;return o.call(u,f,r[t],t,r,n)})}}},{"./valid-callable":187,"./valid-value":189}],170:[function(t,e,r){"use strict";e.exports=t("./is-implemented")()?Object.assign:t("./shim")},{"./is-implemented":171,"./shim":172}],171:[function(t,e,r){"use strict";e.exports=function(){var t=Object.assign,e;if(typeof t!=="function")return false;e={foo:"raz"};t(e,{bar:"dwa"},{trzy:"trzy"});return e.foo+e.bar+e.trzy==="razdwatrzy"}},{}],172:[function(t,e,r){"use strict";var n=t("../keys"),a=t("../valid-value"),i=Math.max;e.exports=function(t,e){var r,o,s=i(arguments.length,2),l;t=Object(a(t));l=function(n){try{t[n]=e[n]}catch(t){if(!r)r=t}};for(o=1;o-1}},{}],193:[function(t,e,r){"use strict";var n=Object.prototype.toString,a=n.call("");e.exports=function(t){return typeof t==="string"||t&&typeof t==="object"&&(t instanceof String||n.call(t)===a)||false}},{}],194:[function(t,e,r){"use strict";var n=Object.create(null),a=Math.random;e.exports=function(){var t;do{t=a().toString(36).slice(2)}while(n[t]);return t}},{}],195:[function(t,e,r){"use strict";var n=t("es5-ext/object/set-prototype-of"),a=t("es5-ext/string/#/contains"),i=t("d"),o=t("es6-symbol"),s=t("./");var l=Object.defineProperty,u;u=e.exports=function(t,e){if(!(this instanceof u))throw new TypeError("Constructor requires 'new'");s.call(this,t);if(!e)e="value";else if(a.call(e,"key+value"))e="key+value";else if(a.call(e,"key"))e="key";else e="value";l(this,"__kind__",i("",e))};if(n)n(u,s);delete u.prototype.constructor;u.prototype=Object.create(s.prototype,{_resolve:i(function(t){if(this.__kind__==="value")return this.__list__[t];if(this.__kind__==="key+value")return[t,this.__list__[t]];return t})});l(u.prototype,o.toStringTag,i("c","Array Iterator"))},{"./":198,d:138,"es5-ext/object/set-prototype-of":184,"es5-ext/string/#/contains":190,"es6-symbol":203}],196:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/object/valid-callable"),i=t("es5-ext/string/is-string"),o=t("./get");var s=Array.isArray,l=Function.prototype.call,u=Array.prototype.some;e.exports=function(t,e){var r,c=arguments[2],f,h,p,d,v,g,m;if(s(t)||n(t))r="array";else if(i(t))r="string";else t=o(t);a(e);h=function(){p=true};if(r==="array"){u.call(t,function(t){l.call(e,c,t,h);return p});return}if(r==="string"){v=t.length;for(d=0;d=55296&&m<=56319)g+=t[++d]}l.call(e,c,g,h);if(p)break}return}f=t.next();while(!f.done){l.call(e,c,f.value,h);if(p)return;f=t.next()}}},{"./get":197,"es5-ext/function/is-arguments":161,"es5-ext/object/valid-callable":187,"es5-ext/string/is-string":193}],197:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/string/is-string"),i=t("./array"),o=t("./string"),s=t("./valid-iterable"),l=t("es6-symbol").iterator;e.exports=function(t){if(typeof s(t)[l]==="function")return t[l]();if(n(t))return new i(t);if(a(t))return new o(t);return new i(t)}},{"./array":195,"./string":200,"./valid-iterable":201,"es5-ext/function/is-arguments":161,"es5-ext/string/is-string":193,"es6-symbol":203}],198:[function(t,e,r){"use strict";var n=t("es5-ext/array/#/clear"),a=t("es5-ext/object/assign"),i=t("es5-ext/object/valid-callable"),o=t("es5-ext/object/valid-value"),s=t("d"),l=t("d/auto-bind"),u=t("es6-symbol");var c=Object.defineProperty,f=Object.defineProperties,h;e.exports=h=function(t,e){if(!(this instanceof h))throw new TypeError("Constructor requires 'new'");f(this,{__list__:s("w",o(t)),__context__:s("w",e),__nextIndex__:s("w",0)});if(!e)return;i(e.on);e.on("_add",this._onAdd);e.on("_delete",this._onDelete);e.on("_clear",this._onClear)};delete h.prototype.constructor;f(h.prototype,a({_next:s(function(){var t;if(!this.__list__)return undefined;if(this.__redo__){t=this.__redo__.shift();if(t!==undefined)return t}if(this.__nextIndex__=this.__nextIndex__)return;++this.__nextIndex__;if(!this.__redo__){c(this,"__redo__",s("c",[t]));return}this.__redo__.forEach(function(e,r){if(e>=t)this.__redo__[r]=++e},this);this.__redo__.push(t)}),_onDelete:s(function(t){var e;if(t>=this.__nextIndex__)return;--this.__nextIndex__;if(!this.__redo__)return;e=this.__redo__.indexOf(t);if(e!==-1)this.__redo__.splice(e,1);this.__redo__.forEach(function(e,r){if(e>t)this.__redo__[r]=--e},this)}),_onClear:s(function(){if(this.__redo__)n.call(this.__redo__);this.__nextIndex__=0})})));c(h.prototype,u.iterator,s(function(){return this}))},{d:138,"d/auto-bind":137,"es5-ext/array/#/clear":157,"es5-ext/object/assign":170,"es5-ext/object/valid-callable":187,"es5-ext/object/valid-value":189,"es6-symbol":203}],199:[function(t,e,r){"use strict";var n=t("es5-ext/function/is-arguments"),a=t("es5-ext/object/is-value"),i=t("es5-ext/string/is-string");var o=t("es6-symbol").iterator,s=Array.isArray;e.exports=function(t){if(!a(t))return false;if(s(t))return true;if(i(t))return true;if(n(t))return true;return typeof t[o]==="function"}},{"es5-ext/function/is-arguments":161,"es5-ext/object/is-value":178,"es5-ext/string/is-string":193,"es6-symbol":203}],200:[function(t,e,r){"use strict";var n=t("es5-ext/object/set-prototype-of"),a=t("d"),i=t("es6-symbol"),o=t("./");var s=Object.defineProperty,l;l=e.exports=function(t){if(!(this instanceof l))throw new TypeError("Constructor requires 'new'");t=String(t);o.call(this,t);s(this,"__length__",a("",t.length))};if(n)n(l,o);delete l.prototype.constructor;l.prototype=Object.create(o.prototype,{_next:a(function(){if(!this.__list__)return undefined;if(this.__nextIndex__=55296&&r<=56319)return e+this.__list__[this.__nextIndex__++];return e})});s(l.prototype,i.toStringTag,a("c","String Iterator"))},{"./":198,d:138,"es5-ext/object/set-prototype-of":184,"es6-symbol":203}],201:[function(t,e,r){"use strict";var n=t("./is-iterable");e.exports=function(t){if(!n(t))throw new TypeError(t+" is not iterable");return t}},{"./is-iterable":199}],202:[function(e,r,n){(function(a,i){(function(e,a){typeof n==="object"&&typeof r!=="undefined"?r.exports=a():typeof t==="function"&&t.amd?t(a):e.ES6Promise=a()})(this,function(){"use strict";function t(t){return typeof t==="function"||typeof t==="object"&&t!==null}function r(t){return typeof t==="function"}var n=undefined;if(!Array.isArray){n=function(t){return Object.prototype.toString.call(t)==="[object Array]"}}else{n=Array.isArray}var o=n;var s=0;var l=undefined;var u=undefined;var c=function t(e,r){k[s]=e;k[s+1]=r;s+=2;if(s===2){if(u){u(M)}else{T()}}};function f(t){u=t}function h(t){c=t}var p=typeof window!=="undefined"?window:undefined;var d=p||{};var v=d.MutationObserver||d.WebKitMutationObserver;var g=typeof self==="undefined"&&typeof a!=="undefined"&&{}.toString.call(a)==="[object process]";var m=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function y(){return function(){return a.nextTick(M)}}function x(){return function(){l(M)}}function b(){var t=0;var e=new v(M);var r=document.createTextNode("");e.observe(r,{characterData:true});return function(){r.data=t=++t%2}}function _(){var t=new MessageChannel;t.port1.onmessage=M;return function(){return t.port2.postMessage(0)}}function w(){var t=setTimeout;return function(){return t(M,1)}}var k=new Array(1e3);function M(){for(var t=0;t0&&this._events[t].length>r){this._events[t].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[t].length);if(typeof console.trace==="function"){console.trace()}}}return this};n.prototype.on=n.prototype.addListener;n.prototype.once=function(t,e){if(!a(e))throw TypeError("listener must be a function");var r=false;function n(){this.removeListener(t,n);if(!r){r=true;e.apply(this,arguments)}}n.listener=e;this.on(t,n);return this};n.prototype.removeListener=function(t,e){var r,n,i,s;if(!a(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;r=this._events[t];i=r.length;n=-1;if(r===e||a(r.listener)&&r.listener===e){delete this._events[t];if(this._events.removeListener)this.emit("removeListener",t,e)}else if(o(r)){for(s=i;s-- >0;){if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}}if(n<0)return this;if(r.length===1){r.length=0;delete this._events[t]}else{r.splice(n,1)}if(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){if(arguments.length===0)this._events={};else if(this._events[t])delete this._events[t];return this}if(arguments.length===0){for(e in this._events){if(e==="removeListener")continue;this.removeAllListeners(e)}this.removeAllListeners("removeListener");this._events={};return this}r=this._events[t];if(a(r)){this.removeListener(t,r)}else if(r){while(r.length)this.removeListener(t,r[r.length-1])}delete this._events[t];return this};n.prototype.listeners=function(t){var e;if(!this._events||!this._events[t])e=[];else if(a(this._events[t]))e=[this._events[t]];else e=this._events[t].slice();return e};n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(a(e))return 1;else if(e)return e.length}return 0};n.listenerCount=function(t,e){return t.listenerCount(e)};function a(t){return typeof t==="function"}function i(t){return typeof t==="number"}function o(t){return typeof t==="object"&&t!==null}function s(t){return t===void 0}},{}],213:[function(t,e,r){"use strict";e.exports=n;function n(t,e,r){var n=e||0;var a=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]],[a*t[12]-t[8],a*t[13]-t[9],a*t[14]-t[10],a*t[15]-t[11]]]}},{}],214:[function(t,e,r){"use strict";function n(t){var e=t.length,r;for(var n=0;n13)&&r!==32&&r!==133&&r!==160&&r!==5760&&r!==6158&&(r<8192||r>8205)&&r!==8232&&r!==8233&&r!==8239&&r!==8287&&r!==8288&&r!==12288&&r!==65279){return false}}return true}e.exports=function(t){var e=typeof t;if(e==="string"){var r=t;t=+t;if(t===0&&n(r))return false}else if(e!=="number")return false;return t-t<1}},{}],215:[function(t,e,r){"use strict";e.exports=u;var n=t("cubic-hermite");var a=t("binary-search-bounds");function i(t,e,r){return Math.min(e,Math.max(t,r))}function o(t,e,r){this.dimension=t.length;this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1){var h=l.length-1;var d=t-e[r-1];for(var p=0;p=r-1){var c=s.length-1;var f=t-e[r-1];for(var h=0;h=0;--r){if(t[--e]){return false}}return true};s.jump=function(t){var e=this.lastT();var r=this.dimension;if(t0;--f){n.push(i(l[f-1],u[f-1],arguments[f]));a.push(0)}};s.push=function(t){var e=this.lastT();var r=this.dimension;if(t1e-6?1/s:0;this._time.push(t);for(var h=r;h>0;--h){var p=i(u[h-1],c[h-1],arguments[h]);n.push(p);a.push((p-n[o++])*f)}};s.set=function(t){var e=this.dimension;if(t0;--l){r.push(i(o[l-1],s[l-1],arguments[l]));n.push(0)}};s.move=function(t){var e=this.lastT();var r=this.dimension;if(t<=e||arguments.length!==r+1){return}var n=this._state;var a=this._velocity;var o=n.length-this.dimension;var s=this.bounds;var l=s[0];var u=s[1];var c=t-e;var f=c>1e-6?1/c:0;this._time.push(t);for(var h=r;h>0;--h){var p=arguments[h];n.push(i(l[h-1],u[h-1],n[o++]+p));a.push(p*f)}};s.idle=function(t){var e=this.lastT();if(t=0;--f){n.push(i(l[f],u[f],n[o]+c*a[o]));a.push(0);o+=1}};function l(t){var e=new Array(t);for(var r=0;re[0]-o[0]/2)h=o[0]/2,p+=o[1]}return r}},{"css-font/stringify":129}],218:[function(t,e,r){"use strict";e.exports=n;n.canvas=document.createElement("canvas");n.cache={};function n(t,e){if(!e)e={};if(typeof t==="string"||Array.isArray(t)){e.family=t}var r=Array.isArray(e.family)?e.family.join(", "):e.family;if(!r)throw Error("`family` must be defined");var s=e.size||e.fontSize||e.em||48;var l=e.weight||e.fontWeight||"";var u=e.style||e.fontStyle||"";var t=[u,l,s].join(" ")+"px "+r;var c=e.origin||"top";if(n.cache[r]){if(s<=n.cache[r].em){return a(n.cache[r],c)}}var f=e.canvas||n.canvas;var h=f.getContext("2d");var p={upper:e.upper!==undefined?e.upper:"H",lower:e.lower!==undefined?e.lower:"x",descent:e.descent!==undefined?e.descent:"p",ascent:e.ascent!==undefined?e.ascent:"h",tittle:e.tittle!==undefined?e.tittle:"i",overshoot:e.overshoot!==undefined?e.overshoot:"O"};var d=Math.ceil(s*1.5);f.height=d;f.width=d*.5;h.font=t;var v="H";var g={top:0};h.clearRect(0,0,d,d);h.textBaseline="top";h.fillStyle="black";h.fillText(v,0,0);var m=i(h.getImageData(0,0,d,d));h.clearRect(0,0,d,d);h.textBaseline="bottom";h.fillText(v,0,d);var y=i(h.getImageData(0,0,d,d));g.lineHeight=g.bottom=d-y+m;h.clearRect(0,0,d,d);h.textBaseline="alphabetic";h.fillText(v,0,d);var x=i(h.getImageData(0,0,d,d));var b=d-x-1+m;g.baseline=g.alphabetic=b;h.clearRect(0,0,d,d);h.textBaseline="middle";h.fillText(v,0,d*.5);var _=i(h.getImageData(0,0,d,d));g.median=g.middle=d-_-1+m-d*.5;h.clearRect(0,0,d,d);h.textBaseline="hanging";h.fillText(v,0,d*.5);var w=i(h.getImageData(0,0,d,d));g.hanging=d-w-1+m-d*.5;h.clearRect(0,0,d,d);h.textBaseline="ideographic";h.fillText(v,0,d);var k=i(h.getImageData(0,0,d,d));g.ideographic=d-k-1+m;if(p.upper){h.clearRect(0,0,d,d);h.textBaseline="top";h.fillText(p.upper,0,0);g.upper=i(h.getImageData(0,0,d,d));g.capHeight=g.baseline-g.upper}if(p.lower){h.clearRect(0,0,d,d);h.textBaseline="top";h.fillText(p.lower,0,0);g.lower=i(h.getImageData(0,0,d,d));g.xHeight=g.baseline-g.lower}if(p.tittle){h.clearRect(0,0,d,d);h.textBaseline="top";h.fillText(p.tittle,0,0);g.tittle=i(h.getImageData(0,0,d,d))}if(p.ascent){h.clearRect(0,0,d,d);h.textBaseline="top";h.fillText(p.ascent,0,0);g.ascent=i(h.getImageData(0,0,d,d))}if(p.descent){h.clearRect(0,0,d,d);h.textBaseline="top";h.fillText(p.descent,0,0);g.descent=o(h.getImageData(0,0,d,d))}if(p.overshoot){h.clearRect(0,0,d,d);h.textBaseline="top";h.fillText(p.overshoot,0,0);var M=o(h.getImageData(0,0,d,d));g.overshoot=M-b}for(var A in g){g[A]/=s}g.em=s;n.cache[r]=g;return a(g,c)}function a(t,e){var r={};if(typeof e==="string")e=t[e];for(var n in t){if(n==="em")continue;r[n]=t[n]-e}return r}function i(t){var e=t.height;var r=t.data;for(var n=3;n0;n-=4){if(r[n]!==0){return Math.floor((n-3)*.25/e)}}}},{}],219:[function(t,e,r){"use strict";e.exports=x;var n=0;var a=1;function i(t,e,r,n,a,i){this._color=t;this.key=e;this.value=r;this.left=n;this.right=a;this._count=i}function o(t){return new i(t._color,t.key,t.value,t.left,t.right,t._count)}function s(t,e){return new i(t,e.key,e.value,e.left,e.right,e._count)}function l(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function u(t,e){this._compare=t;this.root=e}var c=u.prototype;Object.defineProperty(c,"keys",{get:function(){var t=[];this.forEach(function(e,r){t.push(e)});return t}});Object.defineProperty(c,"values",{get:function(){var t=[];this.forEach(function(e,r){t.push(r)});return t}});Object.defineProperty(c,"length",{get:function(){if(this.root){return this.root._count}return 0}});c.insert=function(t,e){var r=this._compare;var o=this.root;var c=[];var f=[];while(o){var h=r(t,o.key);c.push(o);f.push(h);if(h<=0){o=o.left}else{o=o.right}}c.push(new i(n,t,e,null,null,1));for(var p=c.length-2;p>=0;--p){var o=c[p];if(f[p]<=0){c[p]=new i(o._color,o.key,o.value,c[p+1],o.right,o._count+1)}else{c[p]=new i(o._color,o.key,o.value,o.left,c[p+1],o._count+1)}}for(var p=c.length-1;p>1;--p){var d=c[p-1];var o=c[p];if(d._color===a||o._color===a){break}var v=c[p-2];if(v.left===d){if(d.left===o){var g=v.right;if(g&&g._color===n){d._color=a;v.right=s(a,g);v._color=n;p-=1}else{v._color=n;v.left=d.right;d._color=a;d.right=v;c[p-2]=d;c[p-1]=o;l(v);l(d);if(p>=3){var m=c[p-3];if(m.left===v){m.left=d}else{m.right=d}}break}}else{var g=v.right;if(g&&g._color===n){d._color=a;v.right=s(a,g);v._color=n;p-=1}else{d.right=o.left;v._color=n;v.left=o.right;o._color=a;o.left=d;o.right=v;c[p-2]=o;c[p-1]=d;l(v);l(d);l(o);if(p>=3){var m=c[p-3];if(m.left===v){m.left=o}else{m.right=o}}break}}}else{if(d.right===o){var g=v.left;if(g&&g._color===n){d._color=a;v.left=s(a,g);v._color=n;p-=1}else{v._color=n;v.right=d.left;d._color=a;d.left=v;c[p-2]=d;c[p-1]=o;l(v);l(d);if(p>=3){var m=c[p-3];if(m.right===v){m.right=d}else{m.left=d}}break}}else{var g=v.left;if(g&&g._color===n){d._color=a;v.left=s(a,g);v._color=n;p-=1}else{d.left=o.right;v._color=n;v.right=o.left;o._color=a;o.right=d;o.left=v;c[p-2]=o;c[p-1]=d;l(v);l(d);l(o);if(p>=3){var m=c[p-3];if(m.right===v){m.right=o}else{m.left=o}}break}}}}c[0]._color=a;return new u(r,c[0])};function f(t,e){if(e.left){var r=f(t,e.left);if(r){return r}}var r=t(e.key,e.value);if(r){return r}if(e.right){return f(t,e.right)}}function h(t,e,r,n){var a=e(t,n.key);if(a<=0){if(n.left){var i=h(t,e,r,n.left);if(i){return i}}var i=r(n.key,n.value);if(i){return i}}if(n.right){return h(t,e,r,n.right)}}function p(t,e,r,n,a){var i=r(t,a.key);var o=r(e,a.key);var s;if(i<=0){if(a.left){s=p(t,e,r,n,a.left);if(s){return s}}if(o>0){s=n(a.key,a.value);if(s){return s}}}if(o>0&&a.right){return p(t,e,r,n,a.right)}}c.forEach=function t(e,r,n){if(!this.root){return}switch(arguments.length){case 1:return f(e,this.root);break;case 2:return h(r,this._compare,e,this.root);break;case 3:if(this._compare(r,n)>=0){return}return p(r,n,this._compare,e,this.root);break}};Object.defineProperty(c,"begin",{get:function(){var t=[];var e=this.root;while(e){t.push(e);e=e.left}return new d(this,t)}});Object.defineProperty(c,"end",{get:function(){var t=[];var e=this.root;while(e){t.push(e);e=e.right}return new d(this,t)}});c.at=function(t){if(t<0){return new d(this,[])}var e=this.root;var r=[];while(true){r.push(e);if(e.left){if(t=e.right._count){break}e=e.right}else{break}}return new d(this,[])};c.ge=function(t){var e=this._compare;var r=this.root;var n=[];var a=0;while(r){var i=e(t,r.key);n.push(r);if(i<=0){a=n.length}if(i<=0){r=r.left}else{r=r.right}}n.length=a;return new d(this,n)};c.gt=function(t){var e=this._compare;var r=this.root;var n=[];var a=0;while(r){var i=e(t,r.key);n.push(r);if(i<0){a=n.length}if(i<0){r=r.left}else{r=r.right}}n.length=a;return new d(this,n)};c.lt=function(t){var e=this._compare;var r=this.root;var n=[];var a=0;while(r){var i=e(t,r.key);n.push(r);if(i>0){a=n.length}if(i<=0){r=r.left}else{r=r.right}}n.length=a;return new d(this,n)};c.le=function(t){var e=this._compare;var r=this.root;var n=[];var a=0;while(r){var i=e(t,r.key);n.push(r);if(i>=0){a=n.length}if(i<0){r=r.left}else{r=r.right}}n.length=a;return new d(this,n)};c.find=function(t){var e=this._compare;var r=this.root;var n=[];while(r){var a=e(t,r.key);n.push(r);if(a===0){return new d(this,n)}if(a<=0){r=r.left}else{r=r.right}}return new d(this,[])};c.remove=function(t){var e=this.find(t);if(e){return e.remove()}return this};c.get=function(t){var e=this._compare;var r=this.root;while(r){var n=e(t,r.key);if(n===0){return r.value}if(n<=0){r=r.left}else{r=r.right}}return};function d(t,e){this.tree=t;this._stack=e}var v=d.prototype;Object.defineProperty(v,"valid",{get:function(){return this._stack.length>0}});Object.defineProperty(v,"node",{get:function(){if(this._stack.length>0){return this._stack[this._stack.length-1]}return null},enumerable:true});v.clone=function(){return new d(this.tree,this._stack.slice())};function g(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 m(t){var e,r,i,u;for(var c=t.length-1;c>=0;--c){e=t[c];if(c===0){e._color=a;return}r=t[c-1];if(r.left===e){i=r.right;if(i.right&&i.right._color===n){i=r.right=o(i);u=i.right=o(i.right);r.right=i.left;i.left=r;i.right=u;i._color=r._color;e._color=a;r._color=a;u._color=a;l(r);l(i);if(c>1){var f=t[c-2];if(f.left===r){f.left=i}else{f.right=i}}t[c-1]=i;return}else if(i.left&&i.left._color===n){i=r.right=o(i);u=i.left=o(i.left);r.right=u.left;i.left=u.right;u.left=r;u.right=i;u._color=r._color;r._color=a;i._color=a;e._color=a;l(r);l(i);l(u);if(c>1){var f=t[c-2];if(f.left===r){f.left=u}else{f.right=u}}t[c-1]=u;return}if(i._color===a){if(r._color===n){r._color=a;r.right=s(n,i);return}else{r.right=s(n,i);continue}}else{i=o(i);r.right=i.left;i.left=r;i._color=r._color;r._color=n;l(r);l(i);if(c>1){var f=t[c-2];if(f.left===r){f.left=i}else{f.right=i}}t[c-1]=i;t[c]=r;if(c+11){var f=t[c-2];if(f.right===r){f.right=i}else{f.left=i}}t[c-1]=i;return}else if(i.right&&i.right._color===n){i=r.left=o(i);u=i.right=o(i.right);r.left=u.right;i.right=u.left;u.right=r;u.left=i;u._color=r._color;r._color=a;i._color=a;e._color=a;l(r);l(i);l(u);if(c>1){var f=t[c-2];if(f.right===r){f.right=u}else{f.left=u}}t[c-1]=u;return}if(i._color===a){if(r._color===n){r._color=a;r.left=s(n,i);return}else{r.left=s(n,i);continue}}else{i=o(i);r.left=i.right;i.right=r;i._color=r._color;r._color=n;l(r);l(i);if(c>1){var f=t[c-2];if(f.right===r){f.right=i}else{f.left=i}}t[c-1]=i;t[c]=r;if(c+1=0;--o){var r=t[o];if(r.left===t[o+1]){e[o]=new i(r._color,r.key,r.value,e[o+1],r.right,r._count)}else{e[o]=new i(r._color,r.key,r.value,r.left,e[o+1],r._count)}}r=e[e.length-1];if(r.left&&r.right){var s=e.length;r=r.left;while(r.right){e.push(r);r=r.right}var l=e[s-1];e.push(new i(r._color,l.key,l.value,r.left,r.right,r._count));e[s-1].key=r.key;e[s-1].value=r.value;for(var o=e.length-2;o>=s;--o){r=e[o];e[o]=new i(r._color,r.key,r.value,r.left,e[o+1],r._count)}e[s-1].left=e[s]}r=e[e.length-1];if(r._color===n){var c=e[e.length-2];if(c.left===r){c.left=null}else if(c.right===r){c.right=null}e.pop();for(var o=0;o0){return this._stack[this._stack.length-1].key}return},enumerable:true});Object.defineProperty(v,"value",{get:function(){if(this._stack.length>0){return this._stack[this._stack.length-1].value}return},enumerable:true});Object.defineProperty(v,"index",{get:function(){var t=0;var e=this._stack;if(e.length===0){var r=this.tree.root;if(r){return r._count}return 0}else if(e[e.length-1].left){t=e[e.length-1].left._count}for(var n=e.length-2;n>=0;--n){if(e[n+1]===e[n].right){++t;if(e[n].left){t+=e[n].left._count}}}return t},enumerable:true});v.next=function(){var t=this._stack;if(t.length===0){return}var e=t[t.length-1];if(e.right){e=e.right;while(e){t.push(e);e=e.left}}else{t.pop();while(t.length>0&&t[t.length-1].right===e){e=t[t.length-1];t.pop()}}};Object.defineProperty(v,"hasNext",{get:function(){var t=this._stack;if(t.length===0){return false}if(t[t.length-1].right){return true}for(var e=t.length-1;e>0;--e){if(t[e-1].left===t[e]){return true}}return false}});v.update=function(t){var e=this._stack;if(e.length===0){throw new Error("Can't update empty node!")}var r=new Array(e.length);var n=e[e.length-1];r[r.length-1]=new i(n._color,n.key,t,n.left,n.right,n._count);for(var a=e.length-2;a>=0;--a){n=e[a];if(n.left===e[a+1]){r[a]=new i(n._color,n.key,n.value,r[a+1],n.right,n._count)}else{r[a]=new i(n._color,n.key,n.value,n.left,r[a+1],n._count)}}return new u(this.tree._compare,r[0])};v.prev=function(){var t=this._stack;if(t.length===0){return}var e=t[t.length-1];if(e.left){e=e.left;while(e){t.push(e);e=e.right}}else{t.pop();while(t.length>0&&t[t.length-1].left===e){e=t[t.length-1];t.pop()}}};Object.defineProperty(v,"hasPrev",{get:function(){var t=this._stack;if(t.length===0){return false}if(t[t.length-1].left){return true}for(var e=t.length-1;e>0;--e){if(t[e-1].right===t[e]){return true}}return false}});function y(t,e){if(te){return 1}return 0}function x(t){return new u(t||y,null)}},{}],220:[function(t,e,r){var n=7;var a=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7];var i=607/128;var o=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function s(t){if(t<0)return Number("0/0");var e=o[0];for(var r=o.length-1;r>0;--r)e+=o[r]/(t+r);var n=t+i+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}e.exports=function t(e){if(e<.5){return Math.PI/(Math.sin(Math.PI*e)*t(1-e))}else if(e>100)return Math.exp(s(e));else{e-=1;var r=a[0];for(var i=1;i0){p[c]=-1;d[c]=0}else{p[c]=0;d[c]=+1}}}var v=[0,0,0];var g={model:l,view:l,projection:l};f.isOpaque=function(){return true};f.isTransparent=function(){return false};f.drawTransparent=function(t){};var m=[0,0,0];var y=[0,0,0];var x=[0,0,0];f.draw=function(t){t=t||g;var e=this.gl;var r=t.model||l;var n=t.view||l;var a=t.projection||l;var i=this.bounds;var s=o(r,n,a,i);var c=s.cubeEdges;var f=s.axis;var h=n[12];var b=n[13];var _=n[14];var w=n[15];var k=this.pixelRatio*(a[3]*h+a[7]*b+a[11]*_+a[15]*w)/e.drawingBufferHeight;for(var M=0;M<3;++M){this.lastCubeProps.cubeEdges[M]=c[M];this.lastCubeProps.axis[M]=f[M]}var A=p;for(var M=0;M<3;++M){d(p[M],M,this.bounds,c,f)}var e=this.gl;var T=v;for(var M=0;M<3;++M){if(this.backgroundEnable[M]){T[M]=f[M]}else{T[M]=0}}this._background.draw(r,n,a,i,T,this.backgroundColor);this._lines.bind(r,n,a,this);for(var M=0;M<3;++M){var S=[0,0,0];if(f[M]>0){S[M]=i[1][M]}else{S[M]=i[0][M]}for(var E=0;E<2;++E){var C=(M+1+E)%3;var L=(M+1+(E^1))%3;if(this.gridEnable[C]){this._lines.drawGrid(C,L,this.bounds,S,this.gridColor[C],this.gridWidth[C]*this.pixelRatio)}}for(var E=0;E<2;++E){var C=(M+1+E)%3;var L=(M+1+(E^1))%3;if(this.zeroEnable[L]){if(i[0][L]<=0&&i[1][L]>=0){this._lines.drawZero(C,L,this.bounds,S,this.zeroLineColor[L],this.zeroLineWidth[L]*this.pixelRatio)}}}}for(var M=0;M<3;++M){if(this.lineEnable[M]){this._lines.drawAxisLine(M,this.bounds,A[M].primalOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio)}if(this.lineMirror[M]){this._lines.drawAxisLine(M,this.bounds,A[M].mirrorOffset,this.lineColor[M],this.lineWidth[M]*this.pixelRatio)}var I=u(m,A[M].primalMinor);var z=u(y,A[M].mirrorMinor);var P=this.lineTickLength;var O=0;for(var E=0;E<3;++E){var D=k/r[5*E];I[E]*=P[E]*D;z[E]*=P[E]*D}if(this.lineTickEnable[M]){this._lines.drawAxisTicks(M,A[M].primalOffset,I,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio)}if(this.lineTickMirror[M]){this._lines.drawAxisTicks(M,A[M].mirrorOffset,z,this.lineTickColor[M],this.lineTickWidth[M]*this.pixelRatio)}}this._lines.unbind();this._text.bind(r,n,a,this.pixelRatio);for(var M=0;M<3;++M){var R=A[M].primalMinor;var B=u(x,A[M].primalOffset);for(var E=0;E<3;++E){if(this.lineTickEnable[M]){B[E]+=k*R[E]*Math.max(this.lineTickLength[E],0)/r[5*E]}}if(this.tickEnable[M]){for(var E=0;E<3;++E){B[E]+=k*R[E]*this.tickPad[E]/r[5*E]}this._text.drawTicks(M,this.tickSize[M],this.tickAngle[M],B,this.tickColor[M])}if(this.labelEnable[M]){for(var E=0;E<3;++E){B[E]+=k*R[E]*this.labelPad[E]/r[5*E]}B[M]+=.5*(i[0][M]+i[1][M]);this._text.drawLabel(M,this.labelSize[M],this.labelAngle[M],B,this.labelColor[M])}}this._text.unbind()};f.dispose=function(){this._text.dispose();this._lines.dispose();this._background.dispose();this._lines=null;this._text=null;this._background=null;this.gl=null};function b(t,e){var r=new c(t);r.update(e);return r}},{"./lib/background.js":223,"./lib/cube.js":224,"./lib/lines.js":225,"./lib/text.js":227,"./lib/ticks.js":228}],223:[function(t,e,r){"use strict";e.exports=l;var n=t("gl-buffer");var a=t("gl-vao");var i=t("./shaders").bg;function o(t,e,r,n){this.gl=t;this.buffer=e;this.vao=r;this.shader=n}var s=o.prototype;s.draw=function(t,e,r,n,a,i){var o=false;for(var s=0;s<3;++s){o=o||a[s]}if(!o){return}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:a,colors:i};this.vao.bind();this.vao.draw(this.gl.TRIANGLES,36);this.vao.unbind();l.disable(l.POLYGON_OFFSET_FILL)};s.dispose=function(){this.vao.dispose();this.buffer.dispose();this.shader.dispose()};function l(t){var e=[];var r=[];var s=0;for(var l=0;l<3;++l){var u=(l+1)%3;var c=(l+2)%3;var f=[0,0,0];var h=[0,0,0];for(var p=-1;p<=1;p+=2){r.push(s,s+2,s+1,s+1,s+2,s+3);f[l]=p;h[l]=p;for(var d=-1;d<=1;d+=2){f[u]=d;for(var v=-1;v<=1;v+=2){f[c]=v;e.push(f[0],f[1],f[2],h[0],h[1],h[2]);s+=1}}var g=u;u=c;c=g}}var m=n(t,new Float32Array(e));var y=n(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER);var x=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);var b=i(t);b.attributes.position.location=0;b.attributes.normal.location=1;return new o(t,m,x,b)}},{"./shaders":226,"gl-buffer":230,"gl-vao":308}],224:[function(t,e,r){"use strict";e.exports=b;var n=t("bit-twiddle");var a=t("gl-mat4/multiply");var i=t("gl-mat4/invert");var o=t("split-polygon");var s=t("robust-orientation");var l=new Array(16);var u=new Array(16);var c=new Array(8);var f=new Array(8);var h=new Array(3);var p=[0,0,0];(function(){for(var t=0;t<8;++t){c[t]=[1,1,1,1];f[t]=[1,1,1]}})();function d(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var a=0;a<3;++a){t[n]+=e[a]*r[4*a+n]}}}var v=[[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]];function g(t){for(var e=0;eS){_|=1<S){_|=1<f[u][1]){D=u}}var R=-1;for(var u=0;u<3;++u){var B=D^1<f[F][0]){F=B}}var N=m;N[0]=N[1]=N[2]=0;N[n.log2(R^D)]=D&R;N[n.log2(D^F)]=D&F;var j=F^7;if(j===_||j===O){j=R^7;N[n.log2(F^j)]=j&F}else{N[n.log2(R^j)]=j&R}var V=y;var U=_;for(var M=0;M<3;++M){if(U&1< 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}"]);var c=n(["precision mediump float;\n#define GLSLIFY 1\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 a(t,u,c,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":287,glslify:377}],227:[function(t,e,r){(function(r){"use strict";e.exports=m;var n=t("gl-buffer");var a=t("gl-vao");var i=t("vectorize-text");var o=t("./shaders").text;var s=window||r.global||{};var l=s.__TEXT_CACHE||{};s.__TEXT_CACHE={};var u=3;var c=u*4;function f(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}var h=f.prototype;var p=[0,0];h.bind=function(t,e,r,n){this.vao.bind();this.shader.bind();var a=this.shader.uniforms;a.model=t;a.view=e;a.projection=r;a.pixelScale=n;p[0]=this.gl.drawingBufferWidth;p[1]=this.gl.drawingBufferHeight;this.shader.uniforms.resolution=p};h.unbind=function(){this.vao.unbind()};h.update=function(t,e,r,n,a){var i=this.gl;var o=[];function s(t,e,r,n){var a=l[r];if(!a){a=l[r]={}}var i=a[e];if(!i){i=a[e]=g(e,{triangles:true,font:r,textAlign:"center",textBaseline:"middle"})}var s=(n||12)/12;var u=i.positions;var c=i.cells;var f=[Infinity,Infinity];var h=[-Infinity,-Infinity];for(var p=0,d=c.length;p=0;--m){var y=u[v[m]];o.push(s*y[0],-s*y[1],t)}}}var c=[0,0,0];var f=[0,0,0];var h=[0,0,0];var p=[0,0,0];for(var d=0;d<3;++d){h[d]=o.length/u|0;s(.5*(t[0][d]+t[1][d]),e[d],r);p[d]=(o.length/u|0)-h[d];c[d]=o.length/u|0;for(var v=0;v=0){a=r.length-n-1}var i=Math.pow(10,a);var o=Math.round(t*e*i);var s=o+"";if(s.indexOf("e")>=0){return s}var l=o/i,u=o%i;if(o<0){l=-Math.ceil(l)|0;u=-u|0}else{l=Math.floor(l)|0;u=u|0}var c=""+l;if(o<0){c="-"+c}if(a){var f=""+u;while(f.length=t[0][a];--s){i.push({x:s*e[a],text:n(e[a],s)})}r.push(i)}return r}function i(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length){return false}for(var n=0;nr){throw new Error("gl-buffer: If resizing buffer, must not specify offset")}t.bufferSubData(e,i,a);return r}function c(t,e){var r=n.malloc(t.length,e);var a=t.length;for(var i=0;i=0;--n){if(e[n]!==r){return false}r*=t[n]}return true}l.update=function(t,e){if(typeof e!=="number"){e=-1}this.bind();if(typeof t==="object"&&typeof t.shape!=="undefined"){var r=t.dtype;if(o.indexOf(r)<0){r="float32"}if(this.type===this.gl.ELEMENT_ARRAY_BUFFER){var s=gl.getExtension("OES_element_index_uint");if(s&&r!=="uint16"){r="uint32"}else{r="uint16"}}if(r===t.dtype&&f(t.shape,t.stride)){if(t.offset===0&&t.data.length===t.shape[0]){this.length=u(this.gl,this.type,this.length,this.usage,t.data,e)}else{this.length=u(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e)}}else{var l=n.malloc(t.size,r);var h=i(l,t.shape);a.assign(h,t);if(e<0){this.length=u(this.gl,this.type,this.length,this.usage,l,e)}else{this.length=u(this.gl,this.type,this.length,this.usage,l.subarray(0,t.size),e)}n.free(l)}}else if(Array.isArray(t)){var p;if(this.type===this.gl.ELEMENT_ARRAY_BUFFER){p=c(t,"uint16")}else{p=c(t,"float32")}if(e<0){this.length=u(this.gl,this.type,this.length,this.usage,p,e)}else{this.length=u(this.gl,this.type,this.length,this.usage,p.subarray(0,t.length),e)}n.free(p)}else if(typeof t==="object"&&typeof t.length==="number"){this.length=u(this.gl,this.type,this.length,this.usage,t,e)}else if(typeof t==="number"||t===undefined){if(e>=0){throw new Error("gl-buffer: Cannot specify offset when resizing buffer")}t=t|0;if(t<=0){t=1}this.gl.bufferData(this.type,t|0,this.usage);this.length=t}else{throw new Error("gl-buffer: Invalid data type")}};function h(t,e,r,n){r=r||t.ARRAY_BUFFER;n=n||t.DYNAMIC_DRAW;if(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(n!==t.DYNAMIC_DRAW&&n!==t.STATIC_DRAW&&n!==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 a=t.createBuffer();var i=new s(t,r,a,0,n);i.update(e);return i}e.exports=h},{ndarray:417,"ndarray-ops":411,"typedarray-pool":507}],231:[function(t,e,r){"use strict";var n=t("gl-vec3");var a=t("gl-vec4");var i=function(t,e,r){var a=n.create();if(t!==undefined){n.set(a,t,e,r)}return a};var o=function(t){var e=t[0],r=t[1],n=t[2];var a=[];for(var i=0;i=e){return r-1}}return r};var l=n.create();var u=n.create();var c=function(t,e,r){return tr?r:t};var f=function(t,e,r,a){var i=t[0];var o=t[1];var f=t[2];var h=r[0].length;var p=r[1].length;var d=r[2].length;var v=s(r[0],i);var g=s(r[1],o);var m=s(r[2],f);var y=v+1;var x=g+1;var b=m+1;if(a){v=c(v,0,h-1);y=c(y,0,h-1);g=c(g,0,p-1);x=c(x,0,p-1);m=c(m,0,d-1);b=c(b,0,d-1)}if(v<0||g<0||m<0||y>=h||x>=p||b>=d){return n.create()}var _=(i-r[0][v])/(r[0][y]-r[0][v]);var w=(o-r[1][g])/(r[1][x]-r[1][g]);var k=(f-r[2][m])/(r[2][b]-r[2][m]);if(_<0||_>1||isNaN(_))_=0;if(w<0||w>1||isNaN(w))w=0;if(k<0||k>1||isNaN(k))k=0;var M=m*h*p;var A=b*h*p;var T=g*h;var S=x*h;var E=v;var C=y;var L=e[T+M+E];var I=e[T+M+C];var z=e[S+M+E];var P=e[S+M+C];var O=e[T+A+E];var D=e[T+A+C];var R=e[S+A+E];var B=e[S+A+C];var F=n.create();n.lerp(F,L,I,_);n.lerp(l,z,P,_);n.lerp(F,F,l,w);n.lerp(l,O,D,_);n.lerp(u,R,B,_);n.lerp(l,l,u,w);n.lerp(F,F,l,k);return F};var h=function(t,e){if(e[0]===0&&e[1]===0){n.set(t,0,1,0)}else{n.set(t,-e[1],e[0],0)}return t};e.exports=function(t,e){var r;if(t.positions){r=t.positions}else{r=o(t.meshgrid)}var a=t.meshgrid;var s=t.vectors;var l={positions:[],vertexIntensity:[],vertexIntensityBounds:t.vertexIntensityBounds,vertexNormals:[],vectors:[],cells:[],coneOffset:t.coneOffset,colormap:t.colormap};if(t.positions.length===0){if(e){e[0]=[0,0,0];e[1]=[0,0,0]}return l}var u=0;var c=1/0,h=-1/0;var p=1/0,d=-1/0;var v=1/0,g=-1/0;var m=null;var y=null;var x=[];var b=1/0;for(var _=0;_u){u=n.length(k)}if(_){b=Math.min(b,2*n.distance(m,w)/(n.length(y)+n.length(k)))}m=w;y=k;x.push(k)}var M=[c,p,v];var A=[h,d,g];if(e){e[0]=M;e[1]=A}if(u===0){u=1}var T=1/u;if(!isFinite(b)||isNaN(b)){b=1}l.vectorScale=b;var S=i(0,1,0);var E=t.coneSize||.5;if(t.absoluteConeSize){E=t.absoluteConeSize*T}l.coneScale=E;for(var _=0,C=0;_1.0001){return null}g+=v[c]}if(Math.abs(g-1)>.001){return null}return[f,l(t,v),v]}},{barycentric:61,"polytope-closest-point/lib/closest_point_2d.js":448}],233:[function(t,e,r){"use strict";var n=1e-6;var a=1e-6;var i=t("gl-shader");var o=t("gl-buffer");var s=t("gl-vao");var l=t("gl-texture2d");var u=t("normals");var c=t("gl-mat4/multiply");var f=t("gl-mat4/invert");var h=t("ndarray");var p=t("colormap");var d=t("simplicial-complex-contour");var v=t("typedarray-pool");var g=t("./shaders");var m=t("./closest-point");var y=g.meshShader;var x=g.pickShader;var b=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function _(t,e,r,n,a,i,o,s,l,u,c,f,h,p,d,v,g,m,y,x,_,w,k,M,A,T,S,E){this.gl=t;this.cells=[];this.positions=[];this.intensity=[];this.texture=e;this.dirty=true;this.triShader=r;this.lineShader=n;this.pointShader=a;this.pickShader=i;this.pointPickShader=o;this.contourShader=s;this.trianglePositions=l;this.triangleVectors=u;this.triangleColors=f;this.triangleNormals=p;this.triangleUVs=h;this.triangleIds=c;this.triangleVAO=d;this.triangleCount=0;this.lineWidth=1;this.edgePositions=v;this.edgeColors=m;this.edgeUVs=y;this.edgeIds=g;this.edgeVAO=x;this.edgeCount=0;this.pointPositions=_;this.pointColors=k;this.pointUVs=M;this.pointSizes=A;this.pointIds=w;this.pointVAO=T;this.pointCount=0;this.contourLineWidth=1;this.contourPositions=S;this.contourVAO=E;this.contourCount=0;this.contourColor=[0,0,0];this.contourEnable=true;this.pickId=1;this.bounds=[[Infinity,Infinity,Infinity],[-Infinity,-Infinity,-Infinity]];this.clipBounds=[[-Infinity,-Infinity,-Infinity],[Infinity,Infinity,Infinity]];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.coneScale=2;this.vectorScale=1;this.coneOffset=1/4;this._model=b;this._view=b;this._projection=b;this._resolution=[1,1]}var w=_.prototype;w.isOpaque=function(){return this.opacity>=1};w.isTransparent=function(){return this.opacity<1};w.pickSlots=1;w.setPickBase=function(t){this.pickId=t};function k(t){var e=p({colormap:t,nshades:256,format:"rgba"});var r=new Uint8Array(256*4);for(var n=0;n<256;++n){var a=e[n];for(var i=0;i<3;++i){r[4*n+i]=a[i]}r[4*n+3]=a[3]*255}return h(r,[256,256,4],[4,0,1])}function M(t,e,r){var n=new Array(e);for(var a=0;a0){var d=this.triShader;d.bind();d.uniforms=s;this.triangleVAO.bind();e.drawArrays(e.TRIANGLES,0,this.triangleCount*3);this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var d=this.lineShader;d.bind();d.uniforms=s;this.edgeVAO.bind();e.lineWidth(this.lineWidth);e.drawArrays(e.LINES,0,this.edgeCount*2);this.edgeVAO.unbind()}if(this.pointCount>0){var d=this.pointShader;d.bind();d.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 d=this.contourShader;d.bind();d.uniforms=s;this.contourVAO.bind();e.drawArrays(e.LINES,0,this.contourCount);this.contourVAO.unbind()}};w.drawPick=function(t){t=t||{};var e=this.gl;var r=t.model||b;var n=t.view||b;var a=t.projection||b;var i=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]];for(var o=0;o<3;++o){i[0][o]=Math.max(i[0][o],this.clipBounds[0][o]);i[1][o]=Math.min(i[1][o],this.clipBounds[1][o])}this._model=[].slice.call(r);this._view=[].slice.call(n);this._projection=[].slice.call(a);this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:a,clipBounds:i,vectorScale:this.vectorScale,coneScale:this.coneScale,coneOffset:this.coneOffset,pickId:this.pickId/255};var l=this.pickShader;l.bind();l.uniforms=s;if(this.triangleCount>0){this.triangleVAO.bind();e.drawArrays(e.TRIANGLES,0,this.triangleCount*3);this.triangleVAO.unbind()}if(this.edgeCount>0){this.edgeVAO.bind();e.lineWidth(this.lineWidth);e.drawArrays(e.LINES,0,this.edgeCount*2);this.edgeVAO.unbind()}if(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()}};w.pick=function(t){if(!t){return null}if(t.id!==this.pickId){return null}var e=t.value[0]+256*t.value[1]+65536*t.value[2];var r=this.cells[e];var n=this.positions[r[1]].slice(0,3);return{index:Math.floor(r[1]/48),position:n,dataCoordinate:n}};w.dispose=function(){this.texture.dispose();this.triShader.dispose();this.pickShader.dispose();this.triangleVAO.dispose();this.trianglePositions.dispose();this.triangleVectors.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()};function T(t){var e=i(t,y.vertex,y.fragment,null,y.attributes);e.attributes.position.location=0;e.attributes.color.location=2;e.attributes.uv.location=3;e.attributes.vector.location=5;return e}function S(t){var e=i(t,wireShader.vertex,wireShader.fragment);e.attributes.position.location=0;e.attributes.color.location=2;e.attributes.uv.location=3;return e}function E(t){var e=i(t,pointShader.vertex,pointShader.fragment);e.attributes.position.location=0;e.attributes.color.location=2;e.attributes.uv.location=3;e.attributes.pointSize.location=4;return e}function C(t){var e=i(t,x.vertex,x.fragment,null,x.attributes);e.attributes.position.location=0;e.attributes.id.location=1;e.attributes.vector.location=5;return e}function L(t){var e=i(t,pointPickShader.vertex,pointPickShader.fragment);e.attributes.position.location=0;e.attributes.id.location=1;e.attributes.pointSize.location=4;return e}function I(t){var e=i(t,contourShader.vertex,contourShader.fragment);e.attributes.position.location=0;return e}function z(t,e){if(arguments.length===1){e=t;t=e.gl}var r=e.triShader||T(t);var n=null;var a=null;var i=C(t);var u=null;var c=null;var f=l(t,h(new Uint8Array([255,255,255,255]),[1,1,4]));f.generateMipmap();f.minFilter=t.LINEAR_MIPMAP_LINEAR;f.magFilter=t.LINEAR;var p=o(t);var d=o(t);var v=o(t);var g=o(t);var m=o(t);var y=o(t);var x=s(t,[{buffer:p,type:t.FLOAT,size:4},{buffer:y,type:t.UNSIGNED_BYTE,size:4,normalized:true},{buffer:v,type:t.FLOAT,size:4},{buffer:g,type:t.FLOAT,size:2},{buffer:m,type:t.FLOAT,size:3},{buffer:d,type:t.FLOAT,size:3}]);var b=o(t);var w=o(t);var k=o(t);var M=o(t);var A=s(t,[{buffer:b,type:t.FLOAT,size:3},{buffer:M,type:t.UNSIGNED_BYTE,size:4,normalized:true},{buffer:w,type:t.FLOAT,size:4},{buffer:k,type:t.FLOAT,size:2}]);var S=o(t);var E=o(t);var L=o(t);var I=o(t);var z=o(t);var P=s(t,[{buffer:S,type:t.FLOAT,size:3},{buffer:z,type:t.UNSIGNED_BYTE,size:4,normalized:true},{buffer:E,type:t.FLOAT,size:4},{buffer:L,type:t.FLOAT,size:2},{buffer:I,type:t.FLOAT,size:1}]);var O=o(t);var D=s(t,[{buffer:O,type:t.FLOAT,size:3}]);var R=new _(t,f,r,n,a,i,u,c,p,d,y,v,g,m,x,b,M,w,k,A,S,z,E,L,I,P,O,D);R.update(e);return R}e.exports=z},{"./closest-point":232,"./shaders":234,colormap:113,"gl-buffer":230,"gl-mat4/invert":254,"gl-mat4/multiply":256,"gl-shader":287,"gl-texture2d":303,"gl-vao":308,ndarray:417,normals:420,"simplicial-complex-contour":479,"typedarray-pool":507}],234:[function(t,e,r){var n=t("glslify");var a=n(["precision mediump float;\n#define GLSLIFY 1\n\nfloat inverse(float m) {\n return 1.0 / m;\n}\n\nmat2 inverse(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(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(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\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float index, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n index = mod(index, segmentCount * 6.0);\n\n float segment = floor(index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex == 3.0) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n // angle = 2pi * ((segment + ((segmentIndex == 1.0 || segmentIndex == 5.0) ? 1.0 : 0.0)) / segmentCount)\n float nextAngle = float(segmentIndex == 1.0 || segmentIndex == 5.0);\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex <= 2.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec3 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\nuniform float vectorScale;\nuniform float coneScale;\n\nuniform float coneOffset;\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 // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal), 0.0);\n normal = normalize(normal * inverse(mat3(model)));\n\n // vec4 m_position = model * vec4(conePosition, 1.0);\n vec4 t_position = view * conePosition;\n gl_Position = projection * t_position;\n f_color = color; //vec4(position.w, color.r, 0, 0);\n f_normal = normal;\n f_data = conePosition.xyz;\n f_eyeDirection = eyePosition - conePosition.xyz;\n f_lightDirection = lightPosition - conePosition.xyz;\n f_uv = uv;\n}\n"]);var i=n(["precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(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\nfloat cookTorranceSpecular(\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(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\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(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = 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}"]);var o=n(["precision mediump float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the cone vertex and normal at the given index.\n//\n// The returned vertex is for a cone with its top at origin and height of 1.0,\n// pointing in the direction of the vector attribute.\n//\n// Each cone is made up of a top vertex, a center base vertex and base perimeter vertices.\n// These vertices are used to make up the triangles of the cone by the following:\n// segment + 0 top vertex\n// segment + 1 perimeter vertex a+1\n// segment + 2 perimeter vertex a\n// segment + 3 center base vertex\n// segment + 4 perimeter vertex a\n// segment + 5 perimeter vertex a+1\n// Where segment is the number of the radial segment * 6 and a is the angle at that radial segment.\n// To go from index to segment, floor(index / 6)\n// To go from segment to angle, 2*pi * (segment/segmentCount)\n// To go from index to segment index, index - (segment*6)\n//\nvec3 getConePosition(vec3 d, float index, float coneOffset, out vec3 normal) {\n\n const float segmentCount = 8.0;\n\n index = mod(index, segmentCount * 6.0);\n\n float segment = floor(index/6.0);\n float segmentIndex = index - (segment*6.0);\n\n normal = -normalize(d);\n\n if (segmentIndex == 3.0) {\n return mix(vec3(0.0), -d, coneOffset);\n }\n\n // angle = 2pi * ((segment + ((segmentIndex == 1.0 || segmentIndex == 5.0) ? 1.0 : 0.0)) / segmentCount)\n float nextAngle = float(segmentIndex == 1.0 || segmentIndex == 5.0);\n float angle = 2.0 * 3.14159 * ((segment + nextAngle) / segmentCount);\n\n vec3 v1 = mix(d, vec3(0.0), coneOffset);\n vec3 v2 = v1 - d;\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d)*0.25;\n vec3 y = v * sin(angle) * length(d)*0.25;\n vec3 v3 = v2 + x + y;\n if (segmentIndex <= 2.0) {\n vec3 tx = u * sin(angle);\n vec3 ty = v * -cos(angle);\n vec3 tangent = tx + ty;\n normal = normalize(cross(v3 - v1, tangent));\n }\n\n if (segmentIndex == 0.0) {\n return mix(d, vec3(0.0), coneOffset);\n }\n return v3;\n}\n\nattribute vec3 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nuniform float vectorScale;\nuniform float coneScale;\nuniform float coneOffset;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n vec3 normal;\n vec4 conePosition = model * vec4(position.xyz, 1.0) + vec4(getConePosition(mat3(model) * ((vectorScale * coneScale) * vector), position.w, coneOffset, normal), 0.0);\n gl_Position = projection * view * conePosition;\n f_id = id;\n f_position = position.xyz;\n}\n"]);var s=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]);r.meshShader={vertex:a,fragment:i,attributes:[{name:"position",type:"vec4"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec3"}]};r.pickShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec3"}]}},{glslify:377}],235:[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",34000:"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"}},{}],236:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function t(e){return n[e]}},{"./1.0/numbers":235}],237:[function(t,e,r){"use strict";e.exports=h;var n=t("gl-buffer");var a=t("gl-vao");var i=t("./shaders/index");var o=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function s(t,e,r,n){this.gl=t;this.shader=n;this.buffer=e;this.vao=r;this.pixelRatio=1;this.bounds=[[Infinity,Infinity,Infinity],[-Infinity,-Infinity,-Infinity]];this.clipBounds=[[-Infinity,-Infinity,-Infinity],[Infinity,Infinity,Infinity]];this.lineWidth=[1,1,1];this.capSize=[10,10,10];this.lineCount=[0,0,0];this.lineOffset=[0,0,0];this.opacity=1}var l=s.prototype;l.isOpaque=function(){return this.opacity>=1};l.isTransparent=function(){return this.opacity<1};l.drawTransparent=l.draw=function(t){var e=this.gl;var r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||o;var a=r.projection=t.projection||o;r.model=t.model||o;r.clipBounds=this.clipBounds;r.opacity=this.opacity;var i=n[12];var s=n[13];var l=n[14];var u=n[15];var c=this.pixelRatio*(a[3]*i+a[7]*s+a[11]*l+a[15]*u)/e.drawingBufferHeight;this.vao.bind();for(var f=0;f<3;++f){e.lineWidth(this.lineWidth[f]);r.capSize=this.capSize[f]*c;if(this.lineCount[f]){e.drawArrays(e.LINES,this.lineOffset[f],this.lineCount[f])}}this.vao.unbind()};function u(t,e){for(var r=0;r<3;++r){t[0][r]=Math.min(t[0][r],e[r]);t[1][r]=Math.max(t[1][r],e[r])}}var c=function(){var t=new Array(3);for(var e=0;e<3;++e){var r=[];for(var n=1;n<=2;++n){for(var a=-1;a<=1;a+=2){var i=(n+e)%3;var o=[0,0,0];o[i]=a;r.push(o)}}t[e]=r}return t}();function f(t,e,r,n){var a=c[n];for(var i=0;i0){var v=c.slice();v[s]+=p[1][s];a.push(c[0],c[1],c[2],d[0],d[1],d[2],d[3],0,0,0,v[0],v[1],v[2],d[0],d[1],d[2],d[3],0,0,0);u(this.bounds,v);o+=2+f(a,v,d,s)}}this.lineCount[s]=o-this.lineOffset[s]}this.buffer.update(a)}};l.dispose=function(){this.shader.dispose();this.buffer.dispose();this.vao.dispose()};function h(t){var e=t.gl;var r=n(e);var o=a(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}]);var l=i(e);l.attributes.position.location=0;l.attributes.color.location=1;l.attributes.offset.location=2;var u=new s(e,r,o,l);u.update(t);return u}},{"./shaders/index":238,"gl-buffer":230,"gl-vao":308}],238:[function(t,e,r){"use strict";var n=t("glslify");var a=t("gl-shader");var i=n(["precision mediump float;\n#define GLSLIFY 1\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}"]);var o=n(["precision mediump float;\n#define GLSLIFY 1\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 a(t,i,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},{"gl-shader":287,glslify:377}],239:[function(t,e,r){"use strict";var n=t("gl-texture2d");e.exports=x;var a=null;var i;var o;var s;var l;function u(t){var e=t.getParameter(t.FRAMEBUFFER_BINDING);var r=t.getParameter(t.RENDERBUFFER_BINDING);var n=t.getParameter(t.TEXTURE_BINDING_2D);return[e,r,n]}function c(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]);t.bindRenderbuffer(t.RENDERBUFFER,e[1]);t.bindTexture(t.TEXTURE_2D,e[2])}function f(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);a=new Array(r+1);for(var n=0;n<=r;++n){var i=new Array(r);for(var o=0;o1){l.drawBuffersWEBGL(a[s])}var y=r.getExtension("WEBGL_depth_texture");if(y){if(f){t.depth=p(r,i,o,y.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT)}else if(v){t.depth=p(r,i,o,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)}}else{if(v&&f){t._depth_rb=d(r,i,o,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT)}else if(v){t._depth_rb=d(r,i,o,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT)}else if(f){t._depth_rb=d(r,i,o,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT)}}var x=r.checkFramebufferStatus(r.FRAMEBUFFER);if(x!==r.FRAMEBUFFER_COMPLETE){t._destroyed=true;r.bindFramebuffer(r.FRAMEBUFFER,null);r.deleteFramebuffer(t.handle);t.handle=null;if(t.depth){t.depth.dispose();t.depth=null}if(t._depth_rb){r.deleteRenderbuffer(t._depth_rb);t._depth_rb=null}for(var m=0;ma||r<0||r>a){throw new Error("gl-fbo: Can't resize FBO, invalid dimensions")}t._shape[0]=e;t._shape[1]=r;var i=u(n);for(var o=0;oc||r<0||r>c){throw new Error("gl-fbo: Parameters are too large for FBO")}n=n||{};var h=1;if("color"in n){h=Math.max(n.color|0,0);if(h<0){throw new Error("gl-fbo: Must specify a nonnegative number of colors")}if(h>1){if(!u){throw new Error("gl-fbo: Multiple draw buffer extension not supported")}else if(h>t.getParameter(u.MAX_COLOR_ATTACHMENTS_WEBGL)){throw new Error("gl-fbo: Context does not support "+h+" draw buffers")}}}var p=t.UNSIGNED_BYTE;var d=t.getExtension("OES_texture_float");if(n.float&&h>0){if(!d){throw new Error("gl-fbo: Context does not support floating point textures")}p=t.FLOAT}else if(n.preferFloat&&h>0){if(d){p=t.FLOAT}}var v=true;if("depth"in n){v=!!n.depth}var m=false;if("stencil"in n){m=!!n.stencil}return new g(t,e,r,p,h,v,m,u)}},{"gl-texture2d":303}],240:[function(t,e,r){var n=t("sprintf-js").sprintf;var a=t("gl-constants/lookup");var i=t("glsl-shader-name");var o=t("add-line-numbers");e.exports=s;function s(t,e,r){"use strict";var s=i(e)||"of unknown name (see npm glsl-shader-name)";var l="unknown type";if(r!==undefined){l=r===a.FRAGMENT_SHADER?"fragment":"vertex"}var u=n("Error compiling %s shader %s:\n",l,s);var c=n("%s%s",u,t);var f=t.split("\n");var h={};for(var p=0;p>p*8&255}this.pickOffset=r;a.bind();var d=a.uniforms;d.viewTransform=t;d.pickOffset=e;d.shape=this.shape;var v=a.attributes;this.positionBuffer.bind();v.position.pointer();this.weightBuffer.bind();v.weight.pointer(s.UNSIGNED_BYTE,false);this.idBuffer.bind();v.pickId.pointer(s.UNSIGNED_BYTE,false);s.drawArrays(s.TRIANGLES,0,o);return r+this.shape[0]*this.shape[1]}}();c.pick=function(t,e,r){var n=this.pickOffset;var a=this.shape[0]*this.shape[1];if(r=n+a){return null}var i=r-n;var o=this.xData;var s=this.yData;return{object:this,pointId:i,dataCoord:[o[i%this.shape[0]],s[i/this.shape[0]|0]]}};c.update=function(t){t=t||{};var e=t.shape||[0,0];var r=t.x||a(e[0]);var o=t.y||a(e[1]);var s=t.z||new Float32Array(e[0]*e[1]);this.xData=r;this.yData=o;var l=t.colorLevels||[0];var u=t.colorValues||[0,0,0,1];var c=l.length;var h=this.bounds;var p=h[0]=r[0];var d=h[1]=o[0];var v=h[2]=r[r.length-1];var g=h[3]=o[o.length-1];var m=1/(v-p);var y=1/(g-d);var x=e[0];var b=e[1];this.shape=[x,b];var _=(x-1)*(b-1)*(f.length>>>1);this.numVertices=_;var w=i.mallocUint8(_*4);var k=i.mallocFloat32(_*2);var M=i.mallocUint8(_*2);var A=i.mallocUint32(_);var T=0;for(var S=0;S 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\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_1540259130(pixelArcLength).xyz);\n}"]);var l=[{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 a(t,i,o,null,l)};r.createPickShader=function(t){return a(t,i,s,null,l)}},{"gl-shader":287,glslify:377}],245:[function(t,e,r){"use strict";e.exports=y;var n=t("gl-buffer");var a=t("gl-vao");var i=t("gl-texture2d");var o=t("glsl-read-float");var s=t("binary-search-bounds");var l=t("ndarray");var u=t("./lib/shaders");var c=u.createShader;var f=u.createPickShader;var h=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function p(t,e){var r=0;for(var n=0;n<3;++n){var a=t[n]-e[n];r+=a*a}return Math.sqrt(r)}function d(t){var e=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]];for(var r=0;r<3;++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 v(t,e,r,n){this.arcLength=t;this.position=e;this.index=r;this.dataCoordinate=n}function g(t,e,r,n,a,i){this.gl=t;this.shader=e;this.pickShader=r;this.buffer=n;this.vao=a;this.clipBounds=[[-Infinity,-Infinity,-Infinity],[Infinity,Infinity,Infinity]];this.points=[];this.arcLength=[];this.vertexCount=0;this.bounds=[[0,0,0],[0,0,0]];this.pickId=0;this.lineWidth=1;this.texture=i;this.dashScale=1;this.opacity=1;this.dirty=true;this.pixelRatio=1}var m=g.prototype;m.isTransparent=function(){return this.opacity<1};m.isOpaque=function(){return this.opacity>=1};m.pickSlots=1;m.setPickBase=function(t){this.pickId=t};m.drawTransparent=m.draw=function(t){var e=this.gl;var r=this.shader;var n=this.vao;r.bind();r.uniforms={model:t.model||h,view:t.view||h,projection:t.projection||h,clipBounds:d(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);n.unbind()};m.drawPick=function(t){var e=this.gl;var r=this.pickShader;var n=this.vao;r.bind();r.uniforms={model:t.model||h,view:t.view||h,projection:t.projection||h,pickId:this.pickId,clipBounds:d(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio};n.bind();n.draw(e.TRIANGLE_STRIP,this.vertexCount);n.unbind()};m.update=function(t){var e,r;this.dirty=true;var n=!!t.connectGaps;if("dashScale"in t){this.dashScale=t.dashScale}if("opacity"in t){this.opacity=+t.opacity}var a=t.position||t.positions;if(!a){return}var i=t.color||t.colors||[0,0,0,1];var o=t.lineWidth||1;var u=[];var c=[];var f=[];var h=0;var d=0;var v=[[Infinity,Infinity,Infinity],[-Infinity,-Infinity,-Infinity]];var g=false;t:for(e=1;e0){for(var x=0;x<24;++x){u.push(u[u.length-12])}d+=2;g=true}continue t}v[0][r]=Math.min(v[0][r],m[r],y[r]);v[1][r]=Math.max(v[1][r],m[r],y[r])}var b,_;if(Array.isArray(i[0])){b=i[e-1];_=i[e]}else{b=_=i}if(b.length===3){b=[b[0],b[1],b[2],1]}if(_.length===3){_=[_[0],_[1],_[2],1]}var w;if(Array.isArray(o)){w=o[e-1]}else{w=o}var k=h;h+=p(m,y);if(g){for(r=0;r<2;++r){u.push(m[0],m[1],m[2],y[0],y[1],y[2],k,w,b[0],b[1],b[2],b[3])}d+=2;g=false}u.push(m[0],m[1],m[2],y[0],y[1],y[2],k,w,b[0],b[1],b[2],b[3],m[0],m[1],m[2],y[0],y[1],y[2],k,-w,b[0],b[1],b[2],b[3],y[0],y[1],y[2],m[0],m[1],m[2],h,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],m[0],m[1],m[2],h,w,_[0],_[1],_[2],_[3]);d+=4}this.buffer.update(u);c.push(h);f.push(a[a.length-1].slice());this.bounds=v;this.vertexCount=d;this.points=f;this.arcLength=c;if("dashes"in t){var M=t.dashes;var A=M.slice();A.unshift(0);for(e=1;e1.0001){return null}g+=v[c]}if(Math.abs(g-1)>.001){return null}return[f,l(t,v),v]}},{barycentric:61,"polytope-closest-point/lib/closest_point_2d.js":448}],267:[function(t,e,r){var n=t("glslify");var a=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}\n"]);var i=n(["#extension GL_OES_standard_derivatives : enable\n\nprecision highp float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(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\nfloat cookTorranceSpecular(\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(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\nvec3 normals(vec3 pos) {\n vec3 fdx = dFdx(pos);\n vec3 fdy = dFdy(pos);\n return normalize(cross(fdx, fdy));\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 vec3 normal = normals(f_data);\n\n if (\n dot(N, normal) < 0.0\n ) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular(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}\n"]);var o=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model, view, projection;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_color = color;\n f_data = position;\n f_uv = uv;\n}"]);var s=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec3 f_data;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}"]);var l=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 uv;\nattribute float pointSize;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}"]);var u=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform sampler2D texture;\nuniform float opacity;\n\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec2 pointR = gl_PointCoord.xy - vec2(0.5,0.5);\n if(dot(pointR, pointR) > 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}"]);var c=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}"]);var f=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]);var h=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}"]);var p=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}"]);var d=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n"]);r.meshShader={vertex:a,fragment:i,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]};r.wireShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]};r.pointShader={vertex:l,fragment:u,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]};r.pickShader={vertex:c,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]};r.pointPickShader={vertex:h,fragment:f,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]};r.contourShader={vertex:p,fragment:d,attributes:[{name:"position",type:"vec3"}]}},{glslify:377}],268:[function(t,e,r){"use strict";var n=1e-6;var a=1e-6;var i=t("gl-shader");var o=t("gl-buffer");var s=t("gl-vao");var l=t("gl-texture2d");var u=t("normals");var c=t("gl-mat4/multiply");var f=t("gl-mat4/invert");var h=t("ndarray");var p=t("colormap");var d=t("simplicial-complex-contour");var v=t("typedarray-pool");var g=t("./lib/shaders");var m=t("./lib/closest-point");var y=g.meshShader;var x=g.wireShader;var b=g.pointShader;var _=g.pickShader;var w=g.pointPickShader;var k=g.contourShader;var M=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function A(t,e,r,n,a,i,o,s,l,u,c,f,h,p,d,v,g,m,y,x,b,_,w,k,A,T,S){this.gl=t;this.cells=[];this.positions=[];this.intensity=[];this.texture=e;this.dirty=true;this.triShader=r;this.lineShader=n;this.pointShader=a;this.pickShader=i;this.pointPickShader=o;this.contourShader=s;this.trianglePositions=l;this.triangleColors=c;this.triangleNormals=h;this.triangleUVs=f;this.triangleIds=u;this.triangleVAO=p;this.triangleCount=0;this.lineWidth=1;this.edgePositions=d;this.edgeColors=g;this.edgeUVs=m;this.edgeIds=v;this.edgeVAO=y;this.edgeCount=0;this.pointPositions=x;this.pointColors=_;this.pointUVs=w;this.pointSizes=k;this.pointIds=b;this.pointVAO=A;this.pointCount=0;this.contourLineWidth=1;this.contourPositions=T;this.contourVAO=S;this.contourCount=0;this.contourColor=[0,0,0];this.contourEnable=true;this.pickId=1;this.bounds=[[Infinity,Infinity,Infinity],[-Infinity,-Infinity,-Infinity]];this.clipBounds=[[-Infinity,-Infinity,-Infinity],[Infinity,Infinity,Infinity]];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=M;this._view=M;this._projection=M;this._resolution=[1,1]}var T=A.prototype;T.isOpaque=function(){return this.opacity>=1};T.isTransparent=function(){return this.opacity<1};T.pickSlots=1;T.setPickBase=function(t){this.pickId=t};function S(t){var e=p({colormap:t,nshades:256,format:"rgba"});var r=new Uint8Array(256*4);for(var n=0;n<256;++n){var a=e[n];for(var i=0;i<3;++i){r[4*n+i]=a[i]}r[4*n+3]=a[3]*255}return h(r,[256,256,4],[4,0,1])}function E(t,e,r){var n=new Array(e);for(var a=0;a0){var d=this.triShader;d.bind();d.uniforms=s;this.triangleVAO.bind();e.drawArrays(e.TRIANGLES,0,this.triangleCount*3);this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var d=this.lineShader;d.bind();d.uniforms=s;this.edgeVAO.bind();e.lineWidth(this.lineWidth);e.drawArrays(e.LINES,0,this.edgeCount*2);this.edgeVAO.unbind()}if(this.pointCount>0){var d=this.pointShader;d.bind();d.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 d=this.contourShader;d.bind();d.uniforms=s;this.contourVAO.bind();e.drawArrays(e.LINES,0,this.contourCount);this.contourVAO.unbind()}};T.drawPick=function(t){t=t||{};var e=this.gl;var r=t.model||M;var n=t.view||M;var a=t.projection||M;var i=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]];for(var o=0;o<3;++o){i[0][o]=Math.max(i[0][o],this.clipBounds[0][o]);i[1][o]=Math.min(i[1][o],this.clipBounds[1][o])}this._model=[].slice.call(r);this._view=[].slice.call(n);this._projection=[].slice.call(a);this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:a,clipBounds:i,pickId:this.pickId/255};var l=this.pickShader;l.bind();l.uniforms=s;if(this.triangleCount>0){this.triangleVAO.bind();e.drawArrays(e.TRIANGLES,0,this.triangleCount*3);this.triangleVAO.unbind()}if(this.edgeCount>0){this.edgeVAO.bind();e.lineWidth(this.lineWidth);e.drawArrays(e.LINES,0,this.edgeCount*2);this.edgeVAO.unbind()}if(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()}};T.pick=function(t){if(!t){return null}if(t.id!==this.pickId){return null}var e=t.value[0]+256*t.value[1]+65536*t.value[2];var r=this.cells[e];var n=this.positions;var a=new Array(r.length);for(var i=0;il[M]){i.uniforms.dataAxis=t;i.uniforms.screenOffset=e;i.uniforms.color=g[n];i.uniforms.angle=m[n];u.drawArrays(u.TRIANGLES,l[M],l[A]-l[M])}}if(y[n]&&k){e[n^1]-=T*p*x[n];i.uniforms.dataAxis=r;i.uniforms.screenOffset=e;i.uniforms.color=b[n];i.uniforms.angle=_[n];u.drawArrays(u.TRIANGLES,w,k)}e[n^1]=T*c[2+(n^1)]-1;if(d[n+2]){e[n^1]+=T*p*v[n+2];if(Ml[M]){i.uniforms.dataAxis=t;i.uniforms.screenOffset=e;i.uniforms.color=g[n+2];i.uniforms.angle=m[n+2];u.drawArrays(u.TRIANGLES,l[M],l[A]-l[M])}}if(y[n+2]&&k){e[n^1]+=T*p*x[n+2];i.uniforms.dataAxis=r;i.uniforms.screenOffset=e;i.uniforms.color=b[n+2];i.uniforms.angle=_[n+2];u.drawArrays(u.TRIANGLES,w,k)}}}();u.drawTitle=function(){var t=[0,0];var e=[0,0];return function(){var r=this.plot;var n=this.shader;var a=r.gl;var i=r.screenBox;var o=r.titleCenter;var s=r.titleAngle;var l=r.titleColor;var u=r.pixelRatio;if(!this.titleCount){return}for(var c=0;c<2;++c){e[c]=2*(o[c]*u-i[c])/(i[2+c]-i[c])-1}n.bind();n.uniforms.dataAxis=t;n.uniforms.screenOffset=e;n.uniforms.angle=s;n.uniforms.color=l;a.drawArrays(a.TRIANGLES,this.titleOffset,this.titleCount)}}();u.bind=function(){var t=[0,0];var e=[0,0];var r=[0,0];return function(){var n=this.plot;var a=this.shader;var i=n._tickBounds;var o=n.dataBox;var s=n.screenBox;var l=n.viewBox;a.bind();for(var u=0;u<2;++u){var c=i[u];var f=i[u+2];var h=f-c;var p=.5*(o[u+2]+o[u]);var d=o[u+2]-o[u];var v=l[u];var g=l[u+2];var m=g-v;var y=s[u];var x=s[u+2];var b=x-y;e[u]=2*h/d*m/b;t[u]=2*(c-p)/d*m/b}r[1]=2*n.pixelRatio/(s[3]-s[1]);r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]);a.uniforms.dataScale=e;a.uniforms.dataShift=t;a.uniforms.textScale=r;this.vbo.bind();a.attributes.textCoordinate.pointer()}}();u.update=function(t){var e=[];var r=t.ticks;var n=t.bounds;var a,o,s,l,u,c;for(c=0;c<2;++c){var f=[Math.floor(e.length/3)],h=[-Infinity];var p=r[c];for(a=0;a=0)){continue}var v=e[d]-n[d]*(e[d+2]-e[d])/(n[d+2]-n[d]);if(d===0){o.drawLine(v,e[1],v,e[3],p[d],h[d])}else{o.drawLine(e[0],v,e[2],v,p[d],h[d])}}}for(var d=0;d=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};u.addObject=function(t){if(this.objects.indexOf(t)<0){this.objects.push(t);this.setDirty()}};u.removeObject=function(t){var e=this.objects;for(var r=0;r0){var r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function m(t){if(typeof t==="boolean"){return t}return true}function y(t){t=t||{};var e=false;var r=t.pixelRatio||parseFloat(window.devicePixelRatio);var y=t.canvas;if(!y){y=document.createElement("canvas");if(t.container){var x=t.container;x.appendChild(y)}else{document.body.appendChild(y)}}var b=t.gl;if(!b){b=v(y,t.glOptions||{premultipliedAlpha:true,antialias:true})}if(!b){throw new Error("webgl not supported")}var _=t.bounds||[[-10,-10,-10],[10,10,10]];var w=new d;var k=l(b,[b.drawingBufferWidth,b.drawingBufferHeight],{preferFloat:!p});var M=h(b);var A=t.camera||{eye:[2,0,0],center:[0,0,0],up:[0,1,0],zoomMin:.1,zoomMax:100,mode:"turntable"};var T=t.axes||{};var S=a(b,T);S.enable=!T.disable;var E=t.spikes||{};var C=o(b,E);var L=[];var I=[];var z=[];var P=[];var O=true;var D=true;var R=new Array(16);var B=new Array(16);var F={view:null,projection:R,model:B};var D=true;var N=[b.drawingBufferWidth,b.drawingBufferHeight];var j={gl:b,contextLost:false,pixelRatio:t.pixelRatio||parseFloat(window.devicePixelRatio),canvas:y,selection:w,camera:n(y,A),axes:S,axesPixels:null,spikes:C,bounds:_,objects:L,shape:N,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:m(t.autoResize),autoBounds:m(t.autoBounds),autoScale:!!t.autoScale,autoCenter:m(t.autoCenter),clipToBounds:m(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:F,oncontextloss:null,mouseListener:null};var V=[b.drawingBufferWidth/j.pixelRatio|0,b.drawingBufferHeight/j.pixelRatio|0];function U(){if(e){return}if(!j.autoResize){return}var t=y.parentNode;var r=1;var n=1;if(t&&t!==document.body){r=t.clientWidth;n=t.clientHeight}else{r=window.innerWidth;n=window.innerHeight}var a=Math.ceil(r*j.pixelRatio)|0;var i=Math.ceil(n*j.pixelRatio)|0;if(a!==y.width||i!==y.height){y.width=a;y.height=i;var o=y.style;o.position=o.position||"absolute";o.left="0px";o.top="0px";o.width=r+"px";o.height=n+"px";O=true}}if(j.autoResize){U()}window.addEventListener("resize",U);function q(){var t=L.length;var e=P.length;for(var r=0;r0&&z[e-1]===0){z.pop();P.pop().dispose()}}j.update=function(t){if(e){return}t=t||{};O=true;D=true};j.add=function(t){if(e){return}t.axes=S;L.push(t);I.push(-1);O=true;D=true;q()};j.remove=function(t){if(e){return}var r=L.indexOf(t);if(r<0){return}L.splice(r,1);I.pop();O=true;D=true;q()};j.dispose=function(){if(e){return}e=true;window.removeEventListener("resize",U);y.removeEventListener("webglcontextlost",W);j.mouseListener.enabled=false;if(j.contextLost){return}S.dispose();C.dispose();for(var t=0;tw.distance){continue}for(var c=0;c 1.0) {\n discard;\n }\n baseColor = mix(borderColor, color, step(radius, centerFraction));\n gl_FragColor = vec4(baseColor.rgb * baseColor.a, baseColor.a);\n }\n}\n"]);r.pickVertex=n(["precision mediump float;\n#define GLSLIFY 1\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=n(["precision mediump float;\n#define GLSLIFY 1\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"])},{glslify:377}],279:[function(t,e,r){"use strict";var n=t("gl-shader");var a=t("gl-buffer");var i=t("typedarray-pool");var o=t("./lib/shader");e.exports=c;function s(t,e,r,n,a){this.plot=t;this.offsetBuffer=e;this.pickBuffer=r;this.shader=n;this.pickShader=a;this.sizeMin=.5;this.sizeMinCap=2;this.sizeMax=20;this.areaRatio=1;this.pointCount=0;this.color=[1,0,0,1];this.borderColor=[0,0,0,1];this.blend=false;this.pickOffset=0;this.points=null}var l=s.prototype;l.dispose=function(){this.shader.dispose();this.pickShader.dispose();this.offsetBuffer.dispose();this.pickBuffer.dispose();this.plot.removeObject(this)};l.update=function(t){var e;t=t||{};function r(e,r){if(e in t){return t[e]}return r}this.sizeMin=r("sizeMin",.5);this.sizeMax=r("sizeMax",20);this.color=r("color",[1,0,0,1]).slice();this.areaRatio=r("areaRatio",1);this.borderColor=r("borderColor",[0,0,0,1]).slice();this.blend=r("blend",false);var n=t.positions.length>>>1;var a=t.positions instanceof Float32Array;var o=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n;var s=t.positions;var l=a?s:i.mallocFloat32(s.length);var u=o?t.idToIndex:i.mallocInt32(n);if(!a){l.set(s)}if(!o){l.set(s);for(e=0;e>>1;var a;for(a=0;a=e[0]&&i<=e[2]&&o>=e[1]&&o<=e[3])r++}return r}l.unifiedDraw=function(){var t=[1,0,0,0,1,0,0,0,1];var e=[0,0,0,0];return function(r){var n=r!==void 0;var a=n?this.pickShader:this.shader;var i=this.plot.gl;var o=this.plot.dataBox;if(this.pointCount===0){return r}var s=o[2]-o[0];var l=o[3]-o[1];var c=u(this.points,o);var f=this.plot.pickPixelRatio*Math.max(Math.min(this.sizeMinCap,this.sizeMin),Math.min(this.sizeMax,this.sizeMax/Math.pow(c,.33333)));t[0]=2/s;t[4]=2/l;t[6]=-2*o[0]/s-1;t[7]=-2*o[1]/l-1;this.offsetBuffer.bind();a.bind();a.attributes.position.pointer();a.uniforms.matrix=t;a.uniforms.color=this.color;a.uniforms.borderColor=this.borderColor;a.uniforms.pointCloud=f<5;a.uniforms.pointSize=f;a.uniforms.centerFraction=Math.min(1,Math.max(0,Math.sqrt(1-this.areaRatio)));if(n){e[0]=r&255;e[1]=r>>8&255;e[2]=r>>16&255;e[3]=r>>24&255;this.pickBuffer.bind();a.attributes.pickId.pointer(i.UNSIGNED_BYTE);a.uniforms.pickOffset=e;this.pickOffset=r}var h=i.getParameter(i.BLEND);var p=i.getParameter(i.DITHER);if(h&&!this.blend)i.disable(i.BLEND);if(p)i.disable(i.DITHER);i.drawArrays(i.POINTS,0,this.pointCount);if(h&&!this.blend)i.enable(i.BLEND);if(p)i.enable(i.DITHER);return r+this.pointCount}}();l.draw=l.unifiedDraw;l.drawPick=l.unifiedDraw;l.pick=function(t,e,r){var n=this.pickOffset;var a=this.pointCount;if(r=n+a){return null}var i=r-n;var o=this.points;return{object:this,pointId:i,dataCoord:[o[2*i],o[2*i+1]]}};function c(t,e){var r=t.gl;var i=a(r);var l=a(r);var u=n(r,o.pointVertex,o.pointFragment);var c=n(r,o.pickVertex,o.pickFragment);var f=new s(t,i,l,u,c);f.update(e);t.addObject(f);return f}},{"./lib/shader":278,"gl-buffer":230,"gl-shader":287,"typedarray-pool":507}],280:[function(t,e,r){e.exports=n;function n(t,e,r,n){var a=e[0],i=e[1],o=e[2],s=e[3],l=r[0],u=r[1],c=r[2],f=r[3];var h,p,d,v,g;p=a*l+i*u+o*c+s*f;if(p<0){p=-p;l=-l;u=-u;c=-c;f=-f}if(1-p>1e-6){h=Math.acos(p);d=Math.sin(h);v=Math.sin((1-n)*h)/d;g=Math.sin(n*h)/d}else{v=1-n;g=n}t[0]=v*a+g*l;t[1]=v*i+g*u;t[2]=v*o+g*c;t[3]=v*s+g*f;return t}},{}],281:[function(t,e,r){"use strict";var n=t("vectorize-text");e.exports=i;var a={};function i(t,e){var r=a[e];if(!r){r=a[e]={}}if(t in r){return r[t]}var i=n(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e});var o=n(t,{triangles:true,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e});var s=[[Infinity,Infinity],[-Infinity,-Infinity]];for(var l=0;l=1){return true}for(var t=0;t<3;++t){if(this.axesProject[t]&&this.projectOpacity[t]>=1){return true}}return false};var g=[0,0];var m=[0,0,0];var y=[0,0,0];var x=[0,0,0,1];var b=[0,0,0,1];var _=u.slice();var w=[0,0,0];var k=[[0,0,0],[0,0,0]];function M(t){t[0]=t[1]=t[2]=0;return t}function A(t,e){t[0]=e[0];t[1]=e[1];t[2]=e[2];t[3]=1;return t}function T(t,e,r,n){t[0]=e[0];t[1]=e[1];t[2]=e[2];t[r]=n;return t}function S(t){var e=k;for(var r=0;r<2;++r){for(var n=0;n<3;++n){e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8)}}return e}function E(t,e,r,n,a){var i=e.axesProject;var s=e.gl;var l=t.uniforms;var c=r.model||u;var h=r.view||u;var p=r.projection||u;var d=e.axesBounds;var v=S(e.clipBounds);var k;if(e.axes&&e.axes.lastCubeProps){k=e.axes.lastCubeProps.axis}else{k=[1,1,1]}g[0]=2/s.drawingBufferWidth;g[1]=2/s.drawingBufferHeight;t.bind();l.view=h;l.projection=p;l.screenSize=g;l.highlightId=e.highlightId;l.highlightScale=e.highlightScale;l.clipBounds=v;l.pickGroup=e.pickId/255;l.pixelRatio=e.pixelRatio;for(var E=0;E<3;++E){if(!i[E]){continue}if(e.projectOpacity[E]<1!==n){continue}l.scale=e.projectScale[E];l.opacity=e.projectOpacity[E];var C=_;for(var L=0;L<16;++L){C[L]=0}for(var L=0;L<4;++L){C[5*L]=1}C[5*E]=0;if(k[E]<0){C[12+E]=d[0][E]}else{C[12+E]=d[1][E]}o(C,c,C);l.model=C;var I=(E+1)%3;var z=(E+2)%3;var P=M(m);var O=M(y);P[I]=1;O[z]=1;var D=f(p,h,c,A(x,P));var R=f(p,h,c,A(b,O));if(Math.abs(D[1])>Math.abs(R[1])){var B=D;D=R;R=B;B=P;P=O;O=B;var F=I;I=z;z=F}if(D[0]<0){P[I]=-1}if(R[1]>0){O[z]=-1}var N=0;var j=0;for(var L=0;L<4;++L){N+=Math.pow(c[4*I+L],2);j+=Math.pow(c[4*z+L],2)}P[I]/=Math.sqrt(N);O[z]/=Math.sqrt(j);l.axes[0]=P;l.axes[1]=O;l.fragClipBounds[0]=T(w,v[0],E,-1e8);l.fragClipBounds[1]=T(w,v[1],E,1e8);e.vao.draw(s.TRIANGLES,e.vertexCount);if(e.lineWidth>0){s.lineWidth(e.lineWidth);e.vao.draw(s.LINES,e.lineVertexCount,e.vertexCount)}}}var C=[-1e8,-1e8,-1e8];var L=[1e8,1e8,1e8];var I=[C,L];function z(t,e,r,n,a,i){var o=r.gl;r.vao.bind();if(a===r.opacity<1||i){t.bind();var s=t.uniforms;s.model=n.model||u;s.view=n.view||u;s.projection=n.projection||u;g[0]=2/o.drawingBufferWidth;g[1]=2/o.drawingBufferHeight;s.screenSize=g;s.highlightId=r.highlightId;s.highlightScale=r.highlightScale;s.fragClipBounds=I;s.clipBounds=r.axes.bounds;s.opacity=r.opacity;s.pickGroup=r.pickId/255;s.pixelRatio=r.pixelRatio;r.vao.draw(o.TRIANGLES,r.vertexCount);if(r.lineWidth>0){o.lineWidth(r.lineWidth);r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount)}}E(e,r,n,a,i);r.vao.unbind()}v.draw=function(t){var e=this.useOrtho?this.orthoShader:this.shader;z(e,this.projectShader,this,t,false,false)};v.drawTransparent=function(t){var e=this.useOrtho?this.orthoShader:this.shader;z(e,this.projectShader,this,t,true,false)};v.drawPick=function(t){var e=this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader;z(e,this.pickProjectShader,this,t,false,true)};v.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||e<0){return null}var r=this.points[e];var n=this._selectResult;n.index=e;for(var a=0;a<3;++a){n.position[a]=n.dataCoordinate[a]=r[a]}return n};v.highlight=function(t){if(!t){this.highlightId=[1,1,1,1]}else{var e=t.index;var r=e&255;var n=e>>8&255;var a=e>>16&255;this.highlightId=[r/255,n/255,a/255,0]}};v.update=function(t){t=t||{};if("perspective"in t){this.useOrtho=!t.perspective}if("orthographic"in t){this.useOrtho=!!t.orthographic}if("lineWidth"in t){this.lineWidth=t.lineWidth}if("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]}}if("opacity"in t){this.opacity=t.opacity}this.dirty=true;var n=t.position;if(!n){return}var a=t.font||"normal";var o=t.alignment||[0,0];var s=[Infinity,Infinity,Infinity];var u=[-Infinity,-Infinity,-Infinity];var c=t.glyph;var f=t.color;var h=t.size;var p=t.angle;var d=t.lineColor;var v=0;var g=0;var m=0;var y=n.length;t:for(var x=0;x0){I[0]=-o[0]*(1+A[0][0])}var q=k.cells;var H=k.positions;for(var _=0;_0){var x=r*h;l.drawBox(p-x,d-x,v+x,d+x,s);l.drawBox(p-x,g-x,v+x,g+x,s);l.drawBox(p-x,d-x,p+x,g+x,s);l.drawBox(v-x,d-x,v+x,g+x,s)}};s.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()};s.dispose=function(){this.boxBuffer.dispose();this.boxShader.dispose();this.plot.removeOverlay(this)};function l(t,e){var r=t.gl;var s=a(r,[0,0,0,1,1,0,1,1]);var l=n(r,i.boxVertex,i.boxFragment);var u=new o(t,s,l);u.update(e);t.addOverlay(u);return u}},{"./lib/shaders":284,"gl-buffer":230,"gl-shader":287}],286:[function(t,e,r){"use strict";e.exports=f;var n=t("gl-fbo");var a=t("typedarray-pool");var i=t("ndarray");var o=t("bit-twiddle").nextPow2;var s=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(_inline_16_arg0_<255||_inline_16_arg1_<255||_inline_16_arg2_<255||_inline_16_arg3_<255){var _inline_16_l=_inline_16_arg4_-_inline_16_arg6_[0],_inline_16_a=_inline_16_arg5_-_inline_16_arg6_[1],_inline_16_f=_inline_16_l*_inline_16_l+_inline_16_a*_inline_16_a;_inline_16_fthis.buffer.length){a.free(this.buffer);var n=this.buffer=a.mallocUint8(o(r*e*4));for(var i=0;ir){for(t=r;te){for(t=e;t=0){var k=w.type.charAt(w.type.length-1)|0;var M=new Array(k);for(var A=0;A=0){T+=1}b[_]=T}}var S=new Array(r.length);function E(){h.program=o.program(p,h._vref,h._fref,x,b);for(var t=0;t=0){var d=h.charCodeAt(h.length-1)-48;if(d<2||d>4){throw new n("","Invalid data type for attribute "+f+": "+h)}o(t,e,p[0],a,d,i,f)}else if(h.indexOf("mat")>=0){var d=h.charCodeAt(h.length-1)-48;if(d<2||d>4){throw new n("","Invalid data type for attribute "+f+": "+h)}s(t,e,p,a,d,i,f)}else{throw new n("","Unknown data type for attribute "+f+": "+h)}break}}return i}},{"./GLError":288}],290:[function(t,e,r){"use strict";var n=t("./reflect");var a=t("./GLError");e.exports=s;function i(t){var e=new Function("y","return function(){return y}");return e(t)}function o(t,e){var r=new Array(t);for(var n=0;n4){throw new a("","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 a("","Unrecognized data type for vector "+name+": "+r)}}else if(r.indexOf("mat")===0&&r.length===4){var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4){throw new a("","Invalid uniform dimension type for matrix "+name+": "+r)}return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}else{throw new a("","Unknown uniform data type for "+name+": "+r)}break}}function c(t,e){if(typeof e!=="object"){return[[t,e]]}var r=[];for(var n in e){var a=e[n];var i=t;if(parseInt(n)+""===n){i+="["+n+"]"}else{i+="."+n}if(typeof a==="object"){r.push.apply(r,c(i,a))}else{r.push([i,a])}}return r}function f(e){var n=["return function updateProperty(obj){"];var a=c("",e);for(var i=0;i4){throw new a("","Invalid data type")}if(t.charAt(0)==="b"){return o(r,false)}return o(r,0)}else if(t.indexOf("mat")===0&&t.length===4){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4){throw new a("","Invalid uniform dimension type for matrix "+name+": "+t)}return o(r*r,0)}else{throw new a("","Unknown uniform data type for "+name+": "+t)}break}}function p(t,e,n){if(typeof n==="object"){var a=d(n);Object.defineProperty(t,e,{get:i(a),set:f(n),enumerable:true,configurable:false})}else{if(s[n]){Object.defineProperty(t,e,{get:l(n),set:f(n),enumerable:true,configurable:false})}else{t[e]=h(r[n].type)}}}function d(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){if(!(l[0]in o)){o[l[0]]=[]}o=o[l[0]];for(var u=1;u1){for(var l=0;l 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the tube vertex and normal at the given index.\n//\n// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.\n//\n// Each tube segment is made up of a ring of vertices.\n// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.\n// The indexes of tube segments run from 0 to 8.\n//\nvec3 getTubePosition(vec3 d, float index, out vec3 normal) {\n float segmentCount = 8.0;\n\n float angle = 2.0 * 3.14159 * (index / segmentCount);\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d);\n vec3 y = v * sin(angle) * length(d);\n vec3 v3 = x + y;\n\n normal = normalize(v3);\n\n return v3;\n}\n\nattribute vec4 vector;\nattribute vec4 color, position;\nattribute vec2 uv;\nuniform float tubeScale;\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 // Scale the vector magnitude to stay constant with\n // model & view changes.\n vec3 normal;\n vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal), 0.0);\n normal = normalize(normal * inverse(mat3(model)));\n\n vec4 t_position = view * tubePosition;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = tubePosition.xyz;\n f_eyeDirection = eyePosition - tubePosition.xyz;\n f_lightDirection = lightPosition - tubePosition.xyz;\n f_uv = uv;\n}\n"]);var i=n(["precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution(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\nfloat cookTorranceSpecular(\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(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\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 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(L, V, N, roughness, fresnel);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n vec4 surfaceColor = 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}"]);var o=n(["precision mediump float;\n#define GLSLIFY 1\n\nvec3 getOrthogonalVector(vec3 v) {\n // Return up-vector for only-z vector.\n // Return ax + by + cz = 0, a point that lies on the plane that has v as a normal and that isn't (0,0,0).\n // From the above if-statement we have ||a|| > 0 U ||b|| > 0.\n // Assign z = 0, x = -b, y = a:\n // a*-b + b*a + c*0 = -ba + ba + 0 = 0\n if (v.x*v.x > v.z*v.z || v.y*v.y > v.z*v.z) {\n return normalize(vec3(-v.y, v.x, 0.0));\n } else {\n return normalize(vec3(0.0, v.z, -v.y));\n }\n}\n\n// Calculate the tube vertex and normal at the given index.\n//\n// The returned vertex is for a tube ring with its center at origin, radius of length(d), pointing in the direction of d.\n//\n// Each tube segment is made up of a ring of vertices.\n// These vertices are used to make up the triangles of the tube by connecting them together in the vertex array.\n// The indexes of tube segments run from 0 to 8.\n//\nvec3 getTubePosition(vec3 d, float index, out vec3 normal) {\n float segmentCount = 8.0;\n\n float angle = 2.0 * 3.14159 * (index / segmentCount);\n\n vec3 u = getOrthogonalVector(d);\n vec3 v = normalize(cross(u, d));\n\n vec3 x = u * cos(angle) * length(d);\n vec3 y = v * sin(angle) * length(d);\n vec3 v3 = x + y;\n\n normal = normalize(v3);\n\n return v3;\n}\n\nattribute vec4 vector;\nattribute vec4 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform float tubeScale;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n vec3 normal;\n vec4 tubePosition = model * vec4(position.xyz, 1.0) + vec4(getTubePosition(mat3(model) * (tubeScale * vector.w * normalize(vector.xyz)), position.w, normal), 0.0);\n gl_Position = projection * view * tubePosition;\n f_id = id;\n f_position = position.xyz;\n}\n"]);var s=n(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_FragColor = vec4(pickId, f_id.xyz);\n}"]);r.meshShader={vertex:a,fragment:i,attributes:[{name:"position",type:"vec4"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"vector",type:"vec4"}]};r.pickShader={vertex:o,fragment:s,attributes:[{name:"position",type:"vec4"},{name:"id",type:"vec4"},{name:"vector",type:"vec4"}]}},{glslify:377}],299:[function(t,e,r){"use strict";var n=1e-6;var a=1e-6;var i=t("gl-shader");var o=t("gl-buffer");var s=t("gl-vao");var l=t("gl-texture2d");var u=t("normals");var c=t("gl-mat4/multiply");var f=t("gl-mat4/invert");var h=t("ndarray");var p=t("colormap");var d=t("simplicial-complex-contour");var v=t("typedarray-pool");var g=t("./shaders");var m=t("./closest-point");var y=g.meshShader;var x=g.pickShader;var b=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function _(t,e,r,n,a,i,o,s,l,u,c,f,h,p,d,v,g,m,y,x,_,w,k,M,A,T,S,E){this.gl=t;this.cells=[];this.positions=[];this.intensity=[];this.texture=e;this.dirty=true;this.triShader=r;this.lineShader=n;this.pointShader=a;this.pickShader=i;this.pointPickShader=o;this.contourShader=s;this.trianglePositions=l;this.triangleVectors=u;this.triangleColors=f;this.triangleNormals=p;this.triangleUVs=h;this.triangleIds=c;this.triangleVAO=d;this.triangleCount=0;this.lineWidth=1;this.edgePositions=v;this.edgeColors=m;this.edgeUVs=y;this.edgeIds=g;this.edgeVAO=x;this.edgeCount=0;this.pointPositions=_;this.pointColors=k;this.pointUVs=M;this.pointSizes=A;this.pointIds=w;this.pointVAO=T;this.pointCount=0;this.contourLineWidth=1;this.contourPositions=S;this.contourVAO=E;this.contourCount=0;this.contourColor=[0,0,0];this.contourEnable=false;this.pickId=1;this.bounds=[[Infinity,Infinity,Infinity],[-Infinity,-Infinity,-Infinity]];this.clipBounds=[[-Infinity,-Infinity,-Infinity],[Infinity,Infinity,Infinity]];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.tubeScale=1;this._model=b;this._view=b;this._projection=b;this._resolution=[1,1]}var w=_.prototype;w.isOpaque=function(){return this.opacity>=1};w.isTransparent=function(){return this.opacity<1};w.pickSlots=1;w.setPickBase=function(t){this.pickId=t};function k(t){var e=p({colormap:t,nshades:256,format:"rgba"});var r=new Uint8Array(256*4);for(var n=0;n<256;++n){var a=e[n];for(var i=0;i<3;++i){r[4*n+i]=a[i]}r[4*n+3]=a[3]*255}return h(r,[256,256,4],[4,0,1])}function M(t,e,r){var n=new Array(e);for(var a=0;a0){var d=this.triShader;d.bind();d.uniforms=s;this.triangleVAO.bind();e.drawArrays(e.TRIANGLES,0,this.triangleCount*3);this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){var d=this.lineShader;d.bind();d.uniforms=s;this.edgeVAO.bind();e.lineWidth(this.lineWidth);e.drawArrays(e.LINES,0,this.edgeCount*2);this.edgeVAO.unbind()}if(this.pointCount>0){var d=this.pointShader;d.bind();d.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 d=this.contourShader;d.bind();d.uniforms=s;this.contourVAO.bind();e.drawArrays(e.LINES,0,this.contourCount);this.contourVAO.unbind()}};w.drawPick=function(t){t=t||{};var e=this.gl;var r=t.model||b;var n=t.view||b;var a=t.projection||b;var i=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]];for(var o=0;o<3;++o){i[0][o]=Math.max(i[0][o],this.clipBounds[0][o]);i[1][o]=Math.min(i[1][o],this.clipBounds[1][o])}this._model=[].slice.call(r);this._view=[].slice.call(n);this._projection=[].slice.call(a);this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:a,clipBounds:i,tubeScale:this.tubeScale,pickId:this.pickId/255};var l=this.pickShader;l.bind();l.uniforms=s;if(this.triangleCount>0){this.triangleVAO.bind();e.drawArrays(e.TRIANGLES,0,this.triangleCount*3);this.triangleVAO.unbind()}if(this.edgeCount>0){this.edgeVAO.bind();e.lineWidth(this.lineWidth);e.drawArrays(e.LINES,0,this.edgeCount*2);this.edgeVAO.unbind()}if(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()}};w.pick=function(t){if(!t){return null}if(t.id!==this.pickId){return null}var e=t.value[0]+256*t.value[1]+65536*t.value[2];var r=this.cells[e];var n=this.positions[r[1]].slice(0,3);var a=this.intensity[r[1]];var i=this.vectors[r[1]].slice(0,3);var o=this.vectors[r[1]][3];return{index:e,position:n,intensity:a,velocity:i,divergence:o,dataCoordinate:n}};w.dispose=function(){this.texture.dispose();this.triShader.dispose();this.pickShader.dispose();this.triangleVAO.dispose();this.trianglePositions.dispose();this.triangleVectors.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()};function T(t){var e=i(t,y.vertex,y.fragment,null,y.attributes);e.attributes.position.location=0;e.attributes.color.location=2;e.attributes.uv.location=3;e.attributes.vector.location=5;return e}function S(t){var e=i(t,wireShader.vertex,wireShader.fragment);e.attributes.position.location=0;e.attributes.color.location=2;e.attributes.uv.location=3;return e}function E(t){var e=i(t,pointShader.vertex,pointShader.fragment);e.attributes.position.location=0;e.attributes.color.location=2;e.attributes.uv.location=3;e.attributes.pointSize.location=4;return e}function C(t){var e=i(t,x.vertex,x.fragment,null,x.attributes);e.attributes.position.location=0;e.attributes.id.location=1;e.attributes.vector.location=5;return e}function L(t){var e=i(t,pointPickShader.vertex,pointPickShader.fragment);e.attributes.position.location=0;e.attributes.id.location=1;e.attributes.pointSize.location=4;return e}function I(t){var e=i(t,contourShader.vertex,contourShader.fragment);e.attributes.position.location=0;return e}function z(t,e){if(arguments.length===1){e=t;t=e.gl}var r=e.triShader||T(t);var n=null;var a=null;var i=C(t);var u=null;var c=null;var f=l(t,h(new Uint8Array([255,255,255,255]),[1,1,4]));f.generateMipmap();f.minFilter=t.LINEAR_MIPMAP_LINEAR;f.magFilter=t.LINEAR;var p=o(t);var d=o(t);var v=o(t);var g=o(t);var m=o(t);var y=o(t);var x=s(t,[{buffer:p,type:t.FLOAT,size:4},{buffer:y,type:t.UNSIGNED_BYTE,size:4,normalized:true},{buffer:v,type:t.FLOAT,size:4},{buffer:g,type:t.FLOAT,size:2},{buffer:m,type:t.FLOAT,size:3},{buffer:d,type:t.FLOAT,size:4}]);var b=o(t);var w=o(t);var k=o(t);var M=o(t);var A=s(t,[{buffer:b,type:t.FLOAT,size:3},{buffer:M,type:t.UNSIGNED_BYTE,size:4,normalized:true},{buffer:w,type:t.FLOAT,size:4},{buffer:k,type:t.FLOAT,size:2}]);var S=o(t);var E=o(t);var L=o(t);var I=o(t);var z=o(t);var P=s(t,[{buffer:S,type:t.FLOAT,size:3},{buffer:z,type:t.UNSIGNED_BYTE,size:4,normalized:true},{buffer:E,type:t.FLOAT,size:4},{buffer:L,type:t.FLOAT,size:2},{buffer:I,type:t.FLOAT,size:1}]);var O=o(t);var D=s(t,[{buffer:O,type:t.FLOAT,size:3}]);var R=new _(t,f,r,n,a,i,u,c,p,d,y,v,g,m,x,b,M,w,k,A,S,z,E,L,I,P,O,D);R.update(e);return R}e.exports=z},{"./closest-point":297,"./shaders":298,colormap:113,"gl-buffer":230,"gl-mat4/invert":254,"gl-mat4/multiply":256,"gl-shader":287,"gl-texture2d":303,"gl-vao":308,ndarray:417,normals:420,"simplicial-complex-contour":479,"typedarray-pool":507}],300:[function(t,e,r){"use strict";var n=t("gl-vec3");var a=t("gl-vec4");var i=function(t,e,r,i){var o=t.points;var s=t.velocities;var l=t.divergences;var u,c,f,h,p,d;d=n.set(n.create(),0,1,0);h=n.create();p=n.create();var v=n.create();var g=[];var m=[];var y=[];var x=[];var b=[];var _=[];var w=0;var k=0;var M=a.create();var A=a.create();var T=8;for(var S=0;S0){for(var E=0;Eo){o=c}}}var f=t.map(function(t){return i(t,r,a,o)});var h=[];var p=[];var d=[];var v=[];for(var s=0;se)return r-1}return r};var c=n.create();var f=n.create();var h=function(t,e,r){return tr?r:t};var p=function(t,e,r,a){var i=t[0];var o=t[1];var s=t[2];var l=r[0].length;var p=r[1].length;var d=r[2].length;var v=u(r[0],i);var g=u(r[1],o);var m=u(r[2],s);var y=v+1;var x=g+1;var b=m+1;if(r[0][v]===i)y=v;if(r[1][g]===o)x=g;if(r[2][m]===s)b=m;if(a){v=h(v,0,l-1);y=h(y,0,l-1);g=h(g,0,p-1);x=h(x,0,p-1);m=h(m,0,d-1);b=h(b,0,d-1)}if(v<0||g<0||m<0||y>=l||x>=p||b>=d){return n.create()}var _=(i-r[0][v])/(r[0][y]-r[0][v]);var w=(o-r[1][g])/(r[1][x]-r[1][g]);var k=(s-r[2][m])/(r[2][b]-r[2][m]);if(_<0||_>1||isNaN(_))_=0;if(w<0||w>1||isNaN(w))w=0;if(k<0||k>1||isNaN(k))k=0;var M=m*l*p;var A=b*l*p;var T=g*l;var S=x*l;var E=v;var C=y;var L=e[T+M+E];var I=e[T+M+C];var z=e[S+M+E];var P=e[S+M+C];var O=e[T+A+E];var D=e[T+A+C];var R=e[S+A+E];var B=e[S+A+C];var F=n.create();n.lerp(F,L,I,_);n.lerp(c,z,P,_);n.lerp(F,F,c,w);n.lerp(c,O,D,_);n.lerp(f,R,B,_);n.lerp(c,c,f,w);n.lerp(F,F,c,k);return F};var d=function(t,e){var r=e[0];var n=e[1];var a=e[2];t[0]=r>=0?r:-r;t[1]=n>=0?n:-n;t[2]=a>=0?a:-a;return t};var v=function(t){var e=1/0;t.sort(function(t,e){return t-e});for(var r=1;r=f&&r<=d&&n>=h&&n<=v&&a>=p&&a<=m};var x=n.distance(e[0],e[1]);var b=10*x/a;var _=b*b;var w=1;var k=0;var M=n.create();if(r.length>=2){w=g(r)}for(var A=0;Ak&&!isNaN(P)&&isFinite(P)){k=P}I.push(P);c.push({points:S,velocities:E,divergences:I});var O=0;while(O_){n.scale(D,D,b/Math.sqrt(R))}n.add(D,D,T);C=t.getVelocity(D);if(n.squaredDistance(L,D)-_>-1e-4*_){S.push(D);L=D;E.push(C);var z=t.getDivergence(D,C);var P=n.length(z);if(P>k&&!isNaN(P)&&isFinite(P)){k=P}I.push(P)}T=D}}for(var A=0;A 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 = max(beckmannSpecular(L, V, N, roughness), 0.);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //decide how to interpolate color \u2014 in vertex or in fragment\n vec4 surfaceColor = step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) + step(.5, vertexColor) * vColor;\n\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"]);var s=a(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z = clipPosition.z + zOffset;\n\n gl_Position = clipPosition;\n value = f;\n kill = -1.0;\n worldCoordinate = dataCoordinate;\n planeCoordinate = uv.zw;\n\n vColor = texture2D(colormap, vec2(value, value));\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"]);var l=a(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n"]);r.createShader=function(t){var e=n(t,i,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);e.attributes.uv.location=0;e.attributes.f.location=1;e.attributes.normal.location=2;return e};r.createPickShader=function(t){var e=n(t,i,l,null,[{name:"uv",type:"vec4"},{name:"f",type:"vec3"},{name:"normal",type:"vec3"}]);e.attributes.uv.location=0;e.attributes.f.location=1;e.attributes.normal.location=2;return e};r.createContourShader=function(t){var e=n(t,s,o,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);e.attributes.uv.location=0;e.attributes.f.location=1;return e};r.createPickContourShader=function(t){var e=n(t,s,l,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);e.attributes.uv.location=0;e.attributes.f.location=1;return e}},{"gl-shader":287,glslify:377}],302:[function(t,e,r){"use strict";e.exports=q;var n=t("bit-twiddle");var a=t("gl-buffer");var i=t("gl-vao");var o=t("gl-texture2d");var s=t("typedarray-pool");var l=t("colormap");var u=t("ndarray-ops");var c=t("ndarray-pack");var f=t("ndarray");var h=t("surface-nets");var p=t("gl-mat4/multiply");var d=t("gl-mat4/invert");var v=t("binary-search-bounds");var g=t("ndarray-gradient");var m=t("./lib/shaders");var y=m.createShader;var x=m.createContourShader;var b=m.createPickShader;var _=m.createPickContourShader;var w=4*(4+3+3);var k=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];var M=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]];var A=[[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;t<3;++t){var e=A[t];var r=(t+1)%3;var n=(t+2)%3;e[r+0]=1;e[n+3]=1;e[t+6]=1}})();function T(t,e,r,n,a){this.position=t;this.index=e;this.uv=r;this.level=n;this.dataCoordinate=a}var S=256;function E(t){var e=c([l({colormap:t,nshades:S,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);u.divseq(e,255);return e}function C(t,e,r,n,a,i,o,l,u,c,h,p,d,v){this.gl=t;this.shape=e;this.bounds=r;this.intensityBounds=[];this._shader=n;this._pickShader=a;this._coordinateBuffer=i;this._vao=o;this._colorMap=l;this._contourShader=u;this._contourPickShader=c;this._contourBuffer=h;this._contourVAO=p;this._contourOffsets=[[],[],[]];this._contourCounts=[[],[],[]];this._vertexCount=0;this._pickResult=new T([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]);this._dynamicBuffer=d;this._dynamicVAO=v;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=true;this.showSurface=true;this.enableHighlight=[true,true,true];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=[true,true,true];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=[[Infinity,Infinity,Infinity],[-Infinity,-Infinity,-Infinity]];this.surfaceProject=[false,false,false];this.contourProject=[[false,false,false],[false,false,false],[false,false,false]];this.colorBounds=[false,false];this._field=[f(s.mallocFloat(1024),[0,0]),f(s.mallocFloat(1024),[0,0]),f(s.mallocFloat(1024),[0,0])];this.pickId=1;this.clipBounds=[[-Infinity,-Infinity,-Infinity],[Infinity,Infinity,Infinity]];this.snapToData=false;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.vertexColor=0;this.dirty=true}var L=C.prototype;L.isTransparent=function(){return this.opacity<1};L.isOpaque=function(){if(this.opacity>=1){return true}for(var t=0;t<3;++t){if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0){return true}}return false};L.pickSlots=1;L.setPickBase=function(t){this.pickId=t};var I=[0,0,0];var z={showSurface:false,showContour:false,projections:[k.slice(),k.slice(),k.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function P(t,e){var r,n,a;var i=e.axes&&e.axes.lastCubeProps.axis||I;var o=e.showSurface;var s=e.showContour;for(r=0;r<3;++r){o=o||e.surfaceProject[r];for(n=0;n<3;++n){s=s||e.contourProject[r][n]}}for(r=0;r<3;++r){var l=z.projections[r];for(n=0;n<16;++n){l[n]=0}for(n=0;n<4;++n){l[5*n]=1}l[5*r]=0;l[12+r]=e.axesBounds[+(i[r]>0)][r];p(l,t.model,l);var u=z.clipBounds[r];for(a=0;a<2;++a){for(n=0;n<3;++n){u[a][n]=t.clipBounds[a][n]}}u[0][r]=-1e8;u[1][r]=1e8}z.showSurface=o;z.showContour=s;return z}var O={model:k,view:k,projection:k,inverseModel:k.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,vertexColor:0};var D=k.slice();var R=[1,0,0,0,1,0,0,0,1];function B(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE);this._colorMap.bind(0);var n=O;n.model=t.model||k;n.view=t.view||k;n.projection=t.projection||k;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=d(n.inverseModel,n.model);for(var a=0;a<2;++a){var i=n.clipBounds[a];for(var o=0;o<3;++o){i[o]=Math.min(Math.max(this.clipBounds[a][o],-1e8),1e8)}}n.kambient=this.ambientLight;n.kdiffuse=this.diffuseLight;n.kspecular=this.specularLight;n.roughness=this.roughness;n.fresnel=this.fresnel;n.opacity=this.opacity;n.height=0;n.permutation=R;n.vertexColor=this.vertexColor;var s=D;p(s,n.view,n.model);p(s,n.projection,s);d(s,s);for(a=0;a<3;++a){n.eyePosition[a]=s[12+a]/s[15]}var l=s[15];for(a=0;a<3;++a){l+=this.lightPosition[a]*s[4*a+3]}for(a=0;a<3;++a){var u=s[12+a];for(o=0;o<3;++o){u+=s[4*o+a]*this.lightPosition[o]}n.lightPosition[a]=u/l}var c=P(n,this);if(c.showSurface&&e===this.opacity<1){this._shader.bind();this._shader.uniforms=n;this._vao.bind();if(this.showSurface&&this._vertexCount){this._vao.draw(r.TRIANGLES,this._vertexCount)}for(a=0;a<3;++a){if(!this.surfaceProject[a]||!this.vertexCount){continue}this._shader.uniforms.model=c.projections[a];this._shader.uniforms.clipBounds=c.clipBounds[a];this._vao.draw(r.TRIANGLES,this._vertexCount)}this._vao.unbind()}if(c.showContour&&!e){var f=this._contourShader;n.kambient=1;n.kdiffuse=0;n.kspecular=0;n.opacity=1;f.bind();f.uniforms=n;var h=this._contourVAO;h.bind();for(a=0;a<3;++a){f.uniforms.permutation=A[a];r.lineWidth(this.contourWidth[a]);for(o=0;o>4)/16)/255;var a=Math.floor(n);var i=n-a;var o=e[1]*(t.value[1]+(t.value[2]&15)/16)/255;var s=Math.floor(o);var l=o-s;a+=1;s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c){var f=c?i:1-i;for(var h=0;h<2;++h){var p=h?l:1-l;var d=a+c;var g=s+h;var m=f*p;for(var y=0;y<3;++y){u[y]+=this._field[y].get(d,g)*m}}}var x=this._pickResult.level;for(var b=0;b<3;++b){x[b]=v.le(this.contourLevels[b],u[b]);if(x[b]<0){if(this.contourLevels[b].length>0){x[b]=0}}else if(x[b]Math.abs(w-u[b])){x[b]+=1}}}r.index[0]=i<.5?a:a+1;r.index[1]=l<.5?s:s+1;r.uv[0]=n/e[0];r.uv[1]=o/e[1];for(y=0;y<3;++y){r.dataCoordinate[y]=this._field[y].get(r.index[0],r.index[1])}return r};function N(t,e){var r=e.shape.slice();var n=t.shape.slice();u.assign(t.lo(1,1).hi(r[0],r[1]),e);u.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1));u.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1));u.assign(t.lo(0,1).hi(1,r[1]),e.hi(1));u.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 j(t,e){if(Array.isArray(t)){return[e(t[0]),e(t[1]),e(t[2])]}return[e(t),e(t),e(t)]}function V(t){if(Array.isArray(t)){if(t.length===3){return[t[0],t[1],t[2],1]}return[t[0],t[1],t[2],t[3]]}return[0,0,0,1]}function U(t){if(Array.isArray(t)){if(Array.isArray(t)){return[V(t[0]),V(t[1]),V(t[2])]}else{var e=V(t);return[e.slice(),e.slice(),e.slice()]}}}L.update=function(t){t=t||{};this.dirty=true;if("contourWidth"in t){this.contourWidth=j(t.contourWidth,Number)}if("showContour"in t){this.showContour=j(t.showContour,Boolean)}if("showSurface"in t){this.showSurface=!!t.showSurface}if("contourTint"in t){this.contourTint=j(t.contourTint,Boolean)}if("contourColor"in t){this.contourColor=U(t.contourColor)}if("contourProject"in t){this.contourProject=j(t.contourProject,function(t){return j(t,Boolean)})}if("surfaceProject"in t){this.surfaceProject=t.surfaceProject}if("dynamicColor"in t){this.dynamicColor=U(t.dynamicColor)}if("dynamicTint"in t){this.dynamicTint=j(t.dynamicTint,Number)}if("dynamicWidth"in t){this.dynamicWidth=j(t.dynamicWidth,Number)}if("opacity"in t){this.opacity=t.opacity}if("colorBounds"in t){this.colorBounds=t.colorBounds}if("vertexColor"in t){this.vertexColor=t.vertexColor?1:0}var e=t.field||t.coords&&t.coords[2]||null;var r=false;if(!e){if(this._field[2].shape[0]||this._field[2].shape[2]){e=this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2)}else{e=this._field[2].hi(0,0)}}if("field"in t||"coords"in t){var a=(e.shape[0]+2)*(e.shape[1]+2);if(a>this._field[2].data.length){s.freeFloat(this._field[2].data);this._field[2].data=s.mallocFloat(n.nextPow2(a))}this._field[2]=f(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]);N(this._field[2],e);this.shape=e.shape.slice();var i=this.shape;for(var o=0;o<2;++o){if(this._field[2].size>this._field[o].data.length){s.freeFloat(this._field[o].data);this._field[o].data=s.mallocFloat(this._field[2].size)}this._field[o]=f(this._field[o].data,[i[0]+2,i[1]+2])}if(t.coords){var l=t.coords;if(!Array.isArray(l)||l.length!==3){throw new Error("gl-surface: invalid coordinates for x/y")}for(o=0;o<2;++o){var u=l[o];for(m=0;m<2;++m){if(u.shape[m]!==i[m]){throw new Error("gl-surface: coords have incorrect shape")}}N(this._field[o],u)}}else if(t.ticks){var c=t.ticks;if(!Array.isArray(c)||c.length!==2){throw new Error("gl-surface: invalid ticks")}for(o=0;o<2;++o){var p=c[o];if(Array.isArray(p)||p.length){p=f(p)}if(p.shape[0]!==i[o]){throw new Error("gl-surface: invalid tick length")}var d=f(p.data,i);d.stride[o]=p.stride[0];d.stride[o^1]=0;N(this._field[o],d)}}else{for(o=0;o<2;++o){var v=[0,0];v[o]=1;this._field[o]=f(this._field[o].data,[i[0]+2,i[1]+2],v,0)}this._field[0].set(0,0,0);for(var m=0;m0){for(var bt=0;bt<5;++bt){tt.pop()}q-=1}continue t}}}nt.push(q)}this._contourOffsets[et]=rt;this._contourCounts[et]=nt}var _t=s.mallocFloat(tt.length);for(o=0;oa||r<0||r>a){throw new Error("gl-texture2d: Invalid texture size")}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];return t}function p(t,e,r,n,a,i){this.gl=t;this.handle=e;this.format=a;this.type=i;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 o=this;var s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return o._wrapS},set:function(t){return o.wrapS=t}},{get:function(){return o._wrapT},set:function(t){return o.wrapT=t}}]);this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return o._shape[0]},set:function(t){return o.width=t}},{get:function(){return o._shape[1]},set:function(t){return o.height=t}}]);this._shapeVector=l}var d=p.prototype;Object.defineProperties(d,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&o.indexOf(t)>=0){if(!e.getExtension("OES_texture_float_linear")){t=e.NEAREST}}if(s.indexOf(t)<0){throw new Error("gl-texture2d: Unknown filter mode "+t)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t);return this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&o.indexOf(t)>=0){if(!e.getExtension("OES_texture_float_linear")){t=e.NEAREST}}if(s.indexOf(t)<0){throw new Error("gl-texture2d: Unknown filter mode "+t)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t);return this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;this._anisoSamples=Math.max(t,1)|0;if(e!==this._anisoSamples){var r=this.gl.getExtension("EXT_texture_filter_anisotropic");if(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){this.bind();if(l.indexOf(t)<0){throw new Error("gl-texture2d: Unknown wrap mode "+t)}this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t);return this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){this.bind();if(l.indexOf(t)<0){throw new Error("gl-texture2d: Unknown wrap mode "+t)}this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t);return this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(!Array.isArray(t)){t=[t,t]}if(t.length!==2){throw new Error("gl-texture2d: Must specify wrap mode for rows and columns")}for(var e=0;e<2;++e){if(l.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;this.bind();r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS);r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT);return t}},shape:{get:function(){return this._shapeVector},set:function(t){if(!Array.isArray(t)){t=[t|0,t|0]}else{if(t.length!==2){throw new Error("gl-texture2d: Invalid texture shape")}}h(this,t[0]|0,t[1]|0);return[t[0]|0,t[1]|0]}},width:{get:function(){return this._shape[0]},set:function(t){t=t|0;h(this,t,this._shape[1]);return t}},height:{get:function(){return this._shape[1]},set:function(t){t=t|0;h(this,this._shape[0],t);return t}}});d.bind=function(t){var e=this.gl;if(t!==undefined){e.activeTexture(e.TEXTURE0+(t|0))}e.bindTexture(e.TEXTURE_2D,this.handle);if(t!==undefined){return t|0}return e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0};d.dispose=function(){this.gl.deleteTexture(this.handle)};d.generateMipmap=function(){this.bind();this.gl.generateMipmap(this.gl.TEXTURE_2D);var t=Math.min(this._shape[0],this._shape[1]);for(var e=0;t>0;++e,t>>>=1){if(this._mipLevels.indexOf(e)<0){this._mipLevels.push(e)}}};d.setPixels=function(t,e,r,n){var a=this.gl;this.bind();if(Array.isArray(e)){n=r;r=e[1]|0;e=e[0]|0}else{e=e||0;r=r||0}n=n||0;var i=c(t)?t:t.raw;if(i){var o=this._mipLevels.indexOf(n)<0;if(o){a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,i);this._mipLevels.push(n)}else{a.texSubImage2D(a.TEXTURE_2D,n,e,r,this.format,this.type,i)}}else if(t.shape&&t.stride&&t.data){if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0){throw new Error("gl-texture2d: Texture dimensions are out of bounds")}g(a,e,r,n,this.format,this.type,this._mipLevels,t)}else{throw new Error("gl-texture2d: Unsupported data type")}};function v(t,e){if(t.length===3){return e[2]===1&&e[1]===t[0]*t[2]&&e[0]===t[2]}return e[0]===1&&e[1]===t[0]}function g(t,e,r,o,s,l,u,c){var h=c.dtype;var p=c.shape.slice();if(p.length<2||p.length>3){throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d")}var d=0,g=0;var m=v(p,c.stride.slice());if(h==="float32"){d=t.FLOAT}else if(h==="float64"){d=t.FLOAT;m=false;h="float32"}else if(h==="uint8"){d=t.UNSIGNED_BYTE}else{d=t.UNSIGNED_BYTE;m=false;h="uint8"}var y=1;if(p.length===2){g=t.LUMINANCE;p=[p[0],p[1],1];c=n(c.data,p,[c.stride[0],c.stride[1],1],c.offset)}else if(p.length===3){if(p[2]===1){g=t.ALPHA}else if(p[2]===2){g=t.LUMINANCE_ALPHA}else if(p[2]===3){g=t.RGB}else if(p[2]===4){g=t.RGBA}else{throw new Error("gl-texture2d: Invalid shape for pixel coords")}y=p[2]}else{throw new Error("gl-texture2d: Invalid shape for texture")}if((g===t.LUMINANCE||g===t.ALPHA)&&(s===t.LUMINANCE||s===t.ALPHA)){g=s}if(g!==s){throw new Error("gl-texture2d: Incompatible texture format for setPixels")}var x=c.size;var b=u.indexOf(o)<0;if(b){u.push(o)}if(d===l&&m){if(c.offset===0&&c.data.length===x){if(b){t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,c.data)}else{t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,c.data)}}else{if(b){t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,c.data.subarray(c.offset,c.offset+x))}else{t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,c.data.subarray(c.offset,c.offset+x))}}}else{var _;if(l===t.FLOAT){_=i.mallocFloat32(x)}else{_=i.mallocUint8(x)}var w=n(_,p,[p[2],p[2]*p[0],1]);if(d===t.FLOAT&&l===t.UNSIGNED_BYTE){f(w,c)}else{a.assign(w,c)}if(b){t.texImage2D(t.TEXTURE_2D,o,s,p[0],p[1],0,s,l,_.subarray(0,x))}else{t.texSubImage2D(t.TEXTURE_2D,o,e,r,p[0],p[1],s,l,_.subarray(0,x))}if(l===t.FLOAT){i.freeFloat32(_)}else{i.freeUint8(_)}}}function m(t){var e=t.createTexture();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);return e}function y(t,e,r,n,a){var i=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>i||r<0||r>i){throw new Error("gl-texture2d: Invalid texture shape")}if(a===t.FLOAT&&!t.getExtension("OES_texture_float")){throw new Error("gl-texture2d: Floating point textures not supported on this platform")}var o=m(t);t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,a,null);return new p(t,o,e,r,n,a)}function x(t,e,r,n,a,i){var o=m(t);t.texImage2D(t.TEXTURE_2D,0,a,a,i,e);return new p(t,o,r,n,a,i)}function b(t,e){var r=e.dtype;var o=e.shape.slice();var s=t.getParameter(t.MAX_TEXTURE_SIZE);if(o[0]<0||o[0]>s||o[1]<0||o[1]>s){throw new Error("gl-texture2d: Invalid texture size")}var l=v(o,e.stride.slice());var u=0;if(r==="float32"){u=t.FLOAT}else if(r==="float64"){u=t.FLOAT;l=false;r="float32"}else if(r==="uint8"){u=t.UNSIGNED_BYTE}else{u=t.UNSIGNED_BYTE;l=false;r="uint8"}var c=0;if(o.length===2){c=t.LUMINANCE;o=[o[0],o[1],1];e=n(e.data,o,[e.stride[0],e.stride[1],1],e.offset)}else if(o.length===3){if(o[2]===1){c=t.ALPHA}else if(o[2]===2){c=t.LUMINANCE_ALPHA}else if(o[2]===3){c=t.RGB}else if(o[2]===4){c=t.RGBA}else{throw new Error("gl-texture2d: Invalid shape for pixel coords")}}else{throw new Error("gl-texture2d: Invalid shape for texture")}if(u===t.FLOAT&&!t.getExtension("OES_texture_float")){u=t.UNSIGNED_BYTE;l=false}var h,d;var g=e.size;if(!l){var y=[o[2],o[2]*o[0],1];d=i.malloc(g,r);var x=n(d,o,y,0);if((r==="float32"||r==="float64")&&u===t.UNSIGNED_BYTE){f(x,e)}else{a.assign(x,e)}h=d.subarray(0,g)}else if(e.offset===0&&e.data.length===g){h=e.data}else{h=e.data.subarray(e.offset,e.offset+g)}var b=m(t);t.texImage2D(t.TEXTURE_2D,0,c,o[0],o[1],0,c,u,h);if(!l){i.free(d)}return new p(t,b,o[0],o[1],c,u)}function _(t){if(arguments.length<=1){throw new Error("gl-texture2d: Missing arguments for texture2d constructor")}if(!o){u(t)}if(typeof arguments[1]==="number"){return y(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE)}if(Array.isArray(arguments[1])){return y(t,arguments[1][0]|0,arguments[1][1]|0,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE)}if(typeof arguments[1]==="object"){var e=arguments[1];var r=c(e)?e:e.raw;if(r){return x(t,r,e.width|0,e.height|0,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE)}else if(e.shape&&e.data&&e.stride){return b(t,e)}}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}},{ndarray:417,"ndarray-ops":411,"typedarray-pool":507}],304:[function(t,e,r){"use strict";var n=t("pick-by-alias");e.exports=function t(e){if(!e)e={};else if(typeof e==="string")e={container:e};if(i(e)){e={container:e}}else if(o(e)){e={container:e}}else if(s(e)){e={gl:e}}else{e=n(e,{container:"container target element el canvas holder parent parentNode wrapper use ref root node",gl:"gl context webgl glContext",attrs:"attributes attrs contextAttributes",pixelRatio:"pixelRatio pxRatio px ratio pxratio pixelratio"},true)}if(!e.pixelRatio)e.pixelRatio=window.pixelRatio||1;if(e.gl){return e.gl}if(e.canvas){e.container=e.canvas.parentNode}if(e.container){if(typeof e.container==="string"){var r=document.querySelector(e.container);if(!r)throw Error("Element "+e.container+" is not found");e.container=r}if(i(e.container)){e.canvas=e.container;e.container=e.canvas.parentNode}else if(!e.canvas){e.canvas=document.createElement("canvas");e.container.appendChild(e.canvas);a(e)}}else if(!e.canvas){e.container=document.body||document.documentElement;e.canvas=document.createElement("canvas");e.canvas.style.position="absolute";e.canvas.style.top=0;e.canvas.style.left=0;e.container.appendChild(e.canvas);a(e)}if(!e.gl){try{e.gl=e.canvas.getContext("webgl",e.attrs)}catch(t){try{e.gl=e.canvas.getContext("experimental-webgl",e.attrs)}catch(t){e.gl=e.canvas.getContext("webgl-experimental",e.attrs)}}}return e.gl};function a(t){if(t.container){if(t.container==document.body){if(!document.body.style.width)t.canvas.width=t.width||t.pixelRatio*window.innerWidth;if(!document.body.style.height)t.canvas.height=t.height||t.pixelRatio*window.innerHeight}else{var e=t.container.getBoundingClientRect();t.canvas.width=t.width||e.right-e.left;t.canvas.height=t.height||e.bottom-e.top}}}function i(t){return typeof t.getContext==="function"&&"width"in t&&"height"in t}function o(t){return typeof t.nodeName==="string"&&typeof t.appendChild==="function"&&typeof t.getBoundingClientRect==="function"}function s(t){return typeof t.drawArrays==="function"||typeof t.drawElements==="function"}},{"pick-by-alias":432}],305:[function(t,e,r){"use strict";function n(t,e,r){if(e){e.bind()}else{t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}var n=t.getParameter(t.MAX_VERTEX_ATTRIBS)|0;if(r){if(r.length>n){throw new Error("gl-vao: Too many vertex attributes")}for(var a=0;a1){return 0}else{return Math.acos(s)}}},{"./dot":317,"./fromValues":319,"./normalize":328}],311:[function(t,e,r){e.exports=n;function n(t){var e=new Float32Array(3);e[0]=t[0];e[1]=t[1];e[2]=t[2];return e}},{}],312:[function(t,e,r){e.exports=n;function n(t,e){t[0]=e[0];t[1]=e[1];t[2]=e[2];return t}},{}],313:[function(t,e,r){e.exports=n;function n(){var t=new Float32Array(3);t[0]=0;t[1]=0;t[2]=0;return t}},{}],314:[function(t,e,r){e.exports=n;function n(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[0],s=r[1],l=r[2];t[0]=a*l-i*s;t[1]=i*o-n*l;t[2]=n*s-a*o;return t}},{}],315:[function(t,e,r){e.exports=n;function n(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2];return Math.sqrt(r*r+n*n+a*a)}},{}],316:[function(t,e,r){e.exports=n;function n(t,e,r){t[0]=e[0]/r[0];t[1]=e[1]/r[1];t[2]=e[2]/r[2];return t}},{}],317:[function(t,e,r){e.exports=n;function n(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}},{}],318:[function(t,e,r){e.exports=a;var n=t("./create")();function a(t,e,r,a,i,o){var s,l;if(!e){e=3}if(!r){r=0}if(a){l=Math.min(a*e+r,t.length)}else{l=t.length}for(s=r;s0){i=1/Math.sqrt(i);t[0]=e[0]*i;t[1]=e[1]*i;t[2]=e[2]*i}return t}},{}],329:[function(t,e,r){e.exports=n;function n(t,e){e=e||1;var r=Math.random()*2*Math.PI;var n=Math.random()*2-1;var a=Math.sqrt(1-n*n)*e;t[0]=Math.cos(r)*a;t[1]=Math.sin(r)*a;t[2]=n*e;return t}},{}],330:[function(t,e,r){e.exports=n;function n(t,e,r,n){var a=[],i=[];a[0]=e[0]-r[0];a[1]=e[1]-r[1];a[2]=e[2]-r[2];i[0]=a[0];i[1]=a[1]*Math.cos(n)-a[2]*Math.sin(n);i[2]=a[1]*Math.sin(n)+a[2]*Math.cos(n);t[0]=i[0]+r[0];t[1]=i[1]+r[1];t[2]=i[2]+r[2];return t}},{}],331:[function(t,e,r){e.exports=n;function n(t,e,r,n){var a=[],i=[];a[0]=e[0]-r[0];a[1]=e[1]-r[1];a[2]=e[2]-r[2];i[0]=a[2]*Math.sin(n)+a[0]*Math.cos(n);i[1]=a[1];i[2]=a[2]*Math.cos(n)-a[0]*Math.sin(n);t[0]=i[0]+r[0];t[1]=i[1]+r[1];t[2]=i[2]+r[2];return t}},{}],332:[function(t,e,r){e.exports=n;function n(t,e,r,n){var a=[],i=[];a[0]=e[0]-r[0];a[1]=e[1]-r[1];a[2]=e[2]-r[2];i[0]=a[0]*Math.cos(n)-a[1]*Math.sin(n);i[1]=a[0]*Math.sin(n)+a[1]*Math.cos(n);i[2]=a[2];t[0]=i[0]+r[0];t[1]=i[1]+r[1];t[2]=i[2]+r[2];return t}},{}],333:[function(t,e,r){e.exports=n;function n(t,e,r){t[0]=e[0]*r;t[1]=e[1]*r;t[2]=e[2]*r;return t}},{}],334:[function(t,e,r){e.exports=n;function n(t,e,r,n){t[0]=e[0]+r[0]*n;t[1]=e[1]+r[1]*n;t[2]=e[2]+r[2]*n;return t}},{}],335:[function(t,e,r){e.exports=n;function n(t,e,r,n){t[0]=e;t[1]=r;t[2]=n;return t}},{}],336:[function(t,e,r){e.exports=n;function n(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2];return r*r+n*n+a*a}},{}],337:[function(t,e,r){e.exports=n;function n(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}},{}],338:[function(t,e,r){e.exports=n;function n(t,e,r){t[0]=e[0]-r[0];t[1]=e[1]-r[1];t[2]=e[2]-r[2];return t}},{}],339:[function(t,e,r){e.exports=n;function n(t,e,r){var n=e[0],a=e[1],i=e[2];t[0]=n*r[0]+a*r[3]+i*r[6];t[1]=n*r[1]+a*r[4]+i*r[7];t[2]=n*r[2]+a*r[5]+i*r[8];return t}},{}],340:[function(t,e,r){e.exports=n;function n(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[3]*n+r[7]*a+r[11]*i+r[15];o=o||1;t[0]=(r[0]*n+r[4]*a+r[8]*i+r[12])/o;t[1]=(r[1]*n+r[5]*a+r[9]*i+r[13])/o;t[2]=(r[2]*n+r[6]*a+r[10]*i+r[14])/o;return t}},{}],341:[function(t,e,r){e.exports=n;function n(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*i-l*a,f=u*a+l*n-o*i,h=u*i+o*a-s*n,p=-o*n-s*a-l*i;t[0]=c*u+p*-o+f*-l-h*-s;t[1]=f*u+p*-s+h*-o-c*-l;t[2]=h*u+p*-l+c*-s-f*-o;return t}},{}],342:[function(t,e,r){e.exports=n;function n(t,e,r){t[0]=e[0]+r[0];t[1]=e[1]+r[1];t[2]=e[2]+r[2];t[3]=e[3]+r[3];return t}},{}],343:[function(t,e,r){e.exports=n;function n(t){var e=new Float32Array(4);e[0]=t[0];e[1]=t[1];e[2]=t[2];e[3]=t[3];return e}},{}],344:[function(t,e,r){e.exports=n;function n(t,e){t[0]=e[0];t[1]=e[1];t[2]=e[2];t[3]=e[3];return t}},{}],345:[function(t,e,r){e.exports=n;function n(){var t=new Float32Array(4);t[0]=0;t[1]=0;t[2]=0;t[3]=0;return t}},{}],346:[function(t,e,r){e.exports=n;function n(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2],i=e[3]-t[3];return Math.sqrt(r*r+n*n+a*a+i*i)}},{}],347:[function(t,e,r){e.exports=n;function n(t,e,r){t[0]=e[0]/r[0];t[1]=e[1]/r[1];t[2]=e[2]/r[2];t[3]=e[3]/r[3];return t}},{}],348:[function(t,e,r){e.exports=n;function n(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}},{}],349:[function(t,e,r){e.exports=n;function n(t,e,r,n){var a=new Float32Array(4);a[0]=t;a[1]=e;a[2]=r;a[3]=n;return a}},{}],350:[function(t,e,r){e.exports={create:t("./create"),clone:t("./clone"),fromValues:t("./fromValues"),copy:t("./copy"),set:t("./set"),add:t("./add"),subtract:t("./subtract"),multiply:t("./multiply"),divide:t("./divide"),min:t("./min"),max:t("./max"),scale:t("./scale"),scaleAndAdd:t("./scaleAndAdd"),distance:t("./distance"),squaredDistance:t("./squaredDistance"),length:t("./length"),squaredLength:t("./squaredLength"),negate:t("./negate"),inverse:t("./inverse"),normalize:t("./normalize"),dot:t("./dot"),lerp:t("./lerp"),random:t("./random"),transformMat4:t("./transformMat4"),transformQuat:t("./transformQuat")}},{"./add":342,"./clone":343,"./copy":344,"./create":345,"./distance":346,"./divide":347,"./dot":348,"./fromValues":349,"./inverse":351,"./length":352,"./lerp":353,"./max":354,"./min":355,"./multiply":356,"./negate":357,"./normalize":358,"./random":359,"./scale":360,"./scaleAndAdd":361,"./set":362,"./squaredDistance":363,"./squaredLength":364,"./subtract":365,"./transformMat4":366,"./transformQuat":367}],351:[function(t,e,r){e.exports=n;function n(t,e){t[0]=1/e[0];t[1]=1/e[1];t[2]=1/e[2];t[3]=1/e[3];return t}},{}],352:[function(t,e,r){e.exports=n;function n(t){var e=t[0],r=t[1],n=t[2],a=t[3];return Math.sqrt(e*e+r*r+n*n+a*a)}},{}],353:[function(t,e,r){e.exports=n;function n(t,e,r,n){var a=e[0],i=e[1],o=e[2],s=e[3];t[0]=a+n*(r[0]-a);t[1]=i+n*(r[1]-i);t[2]=o+n*(r[2]-o);t[3]=s+n*(r[3]-s);return t}},{}],354:[function(t,e,r){e.exports=n;function n(t,e,r){t[0]=Math.max(e[0],r[0]);t[1]=Math.max(e[1],r[1]);t[2]=Math.max(e[2],r[2]);t[3]=Math.max(e[3],r[3]);return t}},{}],355:[function(t,e,r){e.exports=n;function n(t,e,r){t[0]=Math.min(e[0],r[0]);t[1]=Math.min(e[1],r[1]);t[2]=Math.min(e[2],r[2]);t[3]=Math.min(e[3],r[3]);return t}},{}],356:[function(t,e,r){e.exports=n;function n(t,e,r){t[0]=e[0]*r[0];t[1]=e[1]*r[1];t[2]=e[2]*r[2];t[3]=e[3]*r[3];return t}},{}],357:[function(t,e,r){e.exports=n;function n(t,e){t[0]=-e[0];t[1]=-e[1];t[2]=-e[2];t[3]=-e[3];return t}},{}],358:[function(t,e,r){e.exports=n;function n(t,e){var r=e[0],n=e[1],a=e[2],i=e[3];var o=r*r+n*n+a*a+i*i;if(o>0){o=1/Math.sqrt(o);t[0]=r*o;t[1]=n*o;t[2]=a*o;t[3]=i*o}return t}},{}],359:[function(t,e,r){var n=t("./normalize");var a=t("./scale");e.exports=i;function i(t,e){e=e||1;t[0]=Math.random();t[1]=Math.random();t[2]=Math.random();t[3]=Math.random();n(t,t);a(t,t,e);return t}},{"./normalize":358,"./scale":360}],360:[function(t,e,r){e.exports=n;function n(t,e,r){t[0]=e[0]*r;t[1]=e[1]*r;t[2]=e[2]*r;t[3]=e[3]*r;return t}},{}],361:[function(t,e,r){e.exports=n;function n(t,e,r,n){t[0]=e[0]+r[0]*n;t[1]=e[1]+r[1]*n;t[2]=e[2]+r[2]*n;t[3]=e[3]+r[3]*n;return t}},{}],362:[function(t,e,r){e.exports=n;function n(t,e,r,n,a){t[0]=e;t[1]=r;t[2]=n;t[3]=a;return t}},{}],363:[function(t,e,r){e.exports=n;function n(t,e){var r=e[0]-t[0],n=e[1]-t[1],a=e[2]-t[2],i=e[3]-t[3];return r*r+n*n+a*a+i*i}},{}],364:[function(t,e,r){e.exports=n;function n(t){var e=t[0],r=t[1],n=t[2],a=t[3];return e*e+r*r+n*n+a*a}},{}],365:[function(t,e,r){e.exports=n;function n(t,e,r){t[0]=e[0]-r[0];t[1]=e[1]-r[1];t[2]=e[2]-r[2];t[3]=e[3]-r[3];return t}},{}],366:[function(t,e,r){e.exports=n;function n(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3];t[0]=r[0]*n+r[4]*a+r[8]*i+r[12]*o;t[1]=r[1]*n+r[5]*a+r[9]*i+r[13]*o;t[2]=r[2]*n+r[6]*a+r[10]*i+r[14]*o;t[3]=r[3]*n+r[7]*a+r[11]*i+r[15]*o;return t}},{}],367:[function(t,e,r){e.exports=n;function n(t,e,r){var n=e[0],a=e[1],i=e[2],o=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*i-l*a,f=u*a+l*n-o*i,h=u*i+o*a-s*n,p=-o*n-s*a-l*i;t[0]=c*u+p*-o+f*-l-h*-s;t[1]=f*u+p*-s+h*-o-c*-l;t[2]=h*u+p*-l+c*-s-f*-o;t[3]=e[3];return t}},{}],368:[function(t,e,r){e.exports=i;var n=new Uint8Array(4);var a=new Float32Array(n.buffer);function i(t,e,r,i){n[0]=i;n[1]=r;n[2]=e;n[3]=t;return a[0]}},{}],369:[function(t,e,r){var n=t("glsl-tokenizer");var a=t("atob-lite");e.exports=i;function i(t){var e=Array.isArray(t)?t:n(t);for(var r=0;r0)continue;n=t.slice(0,1).join("")}N(n);z+=n.length;T=T.slice(n.length);return T.length}while(1)}function Z(){if(/[^a-fA-F0-9]/.test(M)){N(T.join(""));k=l;return e}T.push(M);A=M;return e+1}function $(){if(M==="."){T.push(M);k=v;A=M;return e+1}if(/[eE]/.test(M)){T.push(M);k=v;A=M;return e+1}if(M==="x"&&T.length===1&&T[0]==="0"){k=_;T.push(M);A=M;return e+1}if(/[^\d]/.test(M)){N(T.join(""));k=l;return e}T.push(M);A=M;return e+1}function J(){if(M==="f"){T.push(M);A=M;e+=1}if(/[eE]/.test(M)){T.push(M);A=M;return e+1}if(M==="-"&&/[eE]/.test(A)){T.push(M);A=M;return e+1}if(/[^\d]/.test(M)){N(T.join(""));k=l;return e}T.push(M);A=M;return e+1}function K(){if(/[^\d\w_]/.test(M)){var t=T.join("");if(F.indexOf(t)>-1){k=y}else if(B.indexOf(t)>-1){k=m}else{k=g}N(T.join(""));k=l;return e}T.push(M);A=M;return e+1}}},{"./lib/builtins":372,"./lib/builtins-300es":371,"./lib/literals":374,"./lib/literals-300es":373,"./lib/operators":375}],371:[function(t,e,r){var n=t("./builtins");n=n.slice().filter(function(t){return!/^(gl\_|texture)/.test(t)});e.exports=n.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"])},{"./builtins":372}],372:[function(t,e,r){e.exports=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]},{}],373:[function(t,e,r){var n=t("./literals");e.exports=n.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"])},{"./literals":374}],374:[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"]},{}],375:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],376:[function(t,e,r){var n=t("./index");e.exports=a;function a(t,e){var r=n(e);var a=[];a=a.concat(r(t));a=a.concat(r(null));return a}},{"./index":370}],377:[function(t,e,r){e.exports=function(t){if(typeof t==="string")t=[t];var e=[].slice.call(arguments,1);var r=[];for(var n=0;n>1;var c=-7;var f=r?a-1:0;var h=r?-1:1;var p=t[e+f];f+=h;i=p&(1<<-c)-1;p>>=-c;c+=s;for(;c>0;i=i*256+t[e+f],f+=h,c-=8){}o=i&(1<<-c)-1;i>>=-c;c+=n;for(;c>0;o=o*256+t[e+f],f+=h,c-=8){}if(i===0){i=1-u}else if(i===l){return o?NaN:(p?-1:1)*Infinity}else{o=o+Math.pow(2,n);i=i-u}return(p?-1:1)*o*Math.pow(2,i-n)};r.write=function(t,e,r,n,a,i){var o,s,l;var u=i*8-a-1;var c=(1<>1;var h=a===23?Math.pow(2,-24)-Math.pow(2,-77):0;var p=n?0:i-1;var d=n?1:-1;var v=e<0||e===0&&1/e<0?1:0;e=Math.abs(e);if(isNaN(e)||e===Infinity){s=isNaN(e)?1:0;o=c}else{o=Math.floor(Math.log(e)/Math.LN2);if(e*(l=Math.pow(2,-o))<1){o--;l*=2}if(o+f>=1){e+=h/l}else{e+=h*Math.pow(2,1-f)}if(e*l>=2){o++;l/=2}if(o+f>=c){s=0;o=c}else if(o+f>=1){s=(e*l-1)*Math.pow(2,a);o=o+f}else{s=e*Math.pow(2,f-1)*Math.pow(2,a);o=0}}for(;a>=8;t[r+p]=s&255,p+=d,s/=256,a-=8){}o=o<0;t[r+p]=o&255,p+=d,o/=256,u-=8){}t[r+p-d]|=v*128}},{}],381:[function(t,e,r){"use strict";e.exports=p;var n=t("robust-orientation");var a=t("simplicial-complex").compareCells;function i(t,e){return t-e}function o(t,e,r){this.vertices=t;this.adjacent=e;this.boundary=r;this.lastVisited=-1}o.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};function s(t,e,r){this.vertices=t;this.cell=e;this.index=r}function l(t,e){return a(t.vertices,e.vertices)}function u(t){var e=["function orient(){var tuple=this.tuple;return test("];for(var r=0;r<=t;++r){if(r>0){e.push(",")}e.push("tuple[",r,"]")}e.push(")}return orient");var a=new Function("test",e.join(""));var i=n[t+1];if(!i){i=n}return a(i)}var c=[];function f(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;n<=t;++n){this.tuple[n]=this.vertices[n]}var a=c[t];if(!a){a=c[t]=u(t)}this.orient=a}var h=f.prototype;h.handleBoundaryDegeneracy=function(t,e){var r=this.dimension;var n=this.vertices.length-1;var a=this.tuple;var i=this.vertices;var o=[t];t.lastVisited=-n;while(o.length>0){t=o.pop();var s=t.vertices;var l=t.adjacent;for(var u=0;u<=r;++u){var c=l[u];if(!c.boundary||c.lastVisited<=-n){continue}var f=c.vertices;for(var h=0;h<=r;++h){var p=f[h];if(p<0){a[h]=e}else{a[h]=i[p]}}var d=this.orient();if(d>0){return c}c.lastVisited=-n;if(d===0){o.push(c)}}}return null};h.walk=function(t,e){var r=this.vertices.length-1;var n=this.dimension;var a=this.vertices;var i=this.tuple;var o=e?this.interior.length*Math.random()|0:this.interior.length-1;var s=this.interior[o];t:while(!s.boundary){var l=s.vertices;var u=s.adjacent;for(var c=0;c<=n;++c){i[c]=a[l[c]]}s.lastVisited=r;for(var c=0;c<=n;++c){var f=u[c];if(f.lastVisited>=r){continue}var h=i[c];i[c]=t;var p=this.orient();i[c]=h;if(p<0){s=f;continue t}else{if(!f.boundary){f.lastVisited=r}else{f.lastVisited=-r}}}return}return s};h.addPeaks=function(t,e){var r=this.vertices.length-1;var n=this.dimension;var a=this.vertices;var i=this.tuple;var u=this.interior;var c=this.simplices;var f=[e];e.lastVisited=r;e.vertices[e.vertices.indexOf(-1)]=r;e.boundary=false;u.push(e);var h=[];while(f.length>0){var e=f.pop();var p=e.vertices;var d=e.adjacent;var v=p.indexOf(r);if(v<0){continue}for(var g=0;g<=n;++g){if(g===v){continue}var m=d[g];if(!m.boundary||m.lastVisited>=r){continue}var y=m.vertices;if(m.lastVisited!==-r){var x=0;for(var b=0;b<=n;++b){if(y[b]<0){x=b;i[b]=t}else{i[b]=a[y[b]]}}var _=this.orient();if(_>0){y[x]=r;m.boundary=false;u.push(m);f.push(m);m.lastVisited=r;continue}else{m.lastVisited=-r}}var w=m.adjacent;var k=p.slice();var M=d.slice();var A=new o(k,M,true);c.push(A);var T=w.indexOf(e);if(T<0){continue}w[T]=A;M[v]=m;k[g]=-1;M[g]=e;d[g]=A;A.flip();for(var b=0;b<=n;++b){var S=k[b];if(S<0||S===r){continue}var E=new Array(n-1);var C=0;for(var L=0;L<=n;++L){var I=k[L];if(I<0||L===b){continue}E[C++]=I}h.push(new s(E,A,b))}}}h.sort(l);for(var g=0;g+1=0){o[l++]=s[c]}else{u=c&1}}if(u===(t&1)){var f=o[0];o[0]=o[1];o[1]=f}e.push(o)}}return e};function p(t,e){var r=t.length;if(r===0){throw new Error("Must have at least d+1 points")}var a=t[0].length;if(r<=a){throw new Error("Must input at least d+1 points")}var i=t.slice(0,a+1);var s=n.apply(void 0,i);if(s===0){throw new Error("Input not in general position")}var l=new Array(a+1);for(var u=0;u<=a;++u){l[u]=u}if(s<0){l[0]=1;l[1]=0}var c=new o(l,new Array(a+1),false);var h=c.adjacent;var p=new Array(a+2);for(var u=0;u<=a;++u){var d=l.slice();for(var v=0;v<=a;++v){if(v===u){d[v]=-1}}var g=d[0];d[0]=d[1];d[1]=g;var m=new o(d,new Array(a+1),true);h[u]=m;p[u]=m}p[a+1]=c;for(var u=0;u<=a;++u){var d=h[u].vertices;var y=h[u].adjacent;for(var v=0;v<=a;++v){var x=d[v];if(x<0){y[v]=c;continue}for(var b=0;b<=a;++b){if(h[b].vertices.indexOf(x)<0){y[v]=h[b]}}}}var _=new f(a,i,p);var w=!!e;for(var u=a+1;u3*(e+1)){f(this,t)}else{this.left.insert(t)}}else{this.left=x([t])}}else if(t[0]>this.mid){if(this.right){if(4*(this.right.count+1)>3*(e+1)){f(this,t)}else{this.right.insert(t)}}else{this.right=x([t])}}else{var r=n.ge(this.leftPoints,t,m);var a=n.ge(this.rightPoints,t,y);this.leftPoints.splice(r,0,t);this.rightPoints.splice(a,0,t)}};l.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)){return h(this,t)}var s=this.left.remove(t);if(s===o){this.left=null;this.count-=1;return i}else if(s===i){this.count-=1}return s}else if(t[0]>this.mid){if(!this.right){return a}var l=this.left?this.left.count:0;if(4*l>3*(e-1)){return h(this,t)}var s=this.right.remove(t);if(s===o){this.right=null;this.count-=1;return i}else if(s===i){this.count-=1}return s}else{if(this.count===1){if(this.leftPoints[0]===t){return o}else{return a}}if(this.leftPoints.length===1&&this.leftPoints[0]===t){if(this.left&&this.right){var c=this;var f=this.left;while(f.right){c=f;f=f.right}if(c===this){f.right=this.right}else{var p=this.left;var s=this.right;c.count-=f.count;c.right=f.left;f.left=p;f.right=s}u(this,f);this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else if(this.left){u(this,this.left)}else{u(this,this.right)}return i}for(var p=n.ge(this.leftPoints,t,m);p=0&&t[n][1]>=e;--n){var a=r(t[n]);if(a){return a}}}function v(t,e){for(var r=0;rthis.mid){if(this.right){var r=this.right.queryPoint(t,e);if(r){return r}}return d(this.rightPoints,t,e)}else{return v(this.leftPoints,e)}};l.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n=this.right.queryInterval(t,e,r);if(n){return n}}if(ethis.mid){return d(this.rightPoints,t,r)}else{return v(this.leftPoints,r)}};function g(t,e){return t-e}function m(t,e){var r=t[0]-e[0];if(r){return r}return t[1]-e[1]}function y(t,e){var r=t[1]-e[1];if(r){return r}return t[0]-e[0]}function x(t){if(t.length===0){return null}var e=[];for(var r=0;r>1];var a=[];var i=[];var o=[];for(var r=0;r4)return true;return false}},{}],392:[function(t,e,r){function n(t,e,r){return t*(1-r)+e*r}e.exports=n},{}],393:[function(e,r,n){(function(e){(function(e,a){typeof n==="object"&&typeof r!=="undefined"?r.exports=a():typeof t==="function"&&t.amd?t(a):e.mapboxgl=a()})(this,function(){"use strict";var t,r,n;function a(e,a){if(!t){t=a}else if(!r){r=a}else{var i="var sharedChunk = {}; ("+t+")(sharedChunk); ("+r+")(sharedChunk);";var o={};t(o);n=a(o);n.workerUrl=window.URL.createObjectURL(new Blob([i],{type:"text/javascript"}))}}a(["exports"],function(t){"use strict";var r="undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:{};function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function a(t,e){return t(e={exports:{}},e.exports),e.exports}var i=o;function o(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=r,this.p2y=n}o.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},o.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},o.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},o.prototype.solveCurveX=function(t,e){var r,n,a,i,o;for(void 0===e&&(e=1e-6),a=t,o=0;o<8;o++){if(i=this.sampleCurveX(a)-t,Math.abs(i)(n=1))return n;for(;ri?r=a:n=a,a=.5*(n-r)+r}return a},o.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var s=function(t,e,r){this.column=t,this.row=e,this.zoom=r};s.prototype.clone=function(){return new s(this.column,this.row,this.zoom)},s.prototype.zoomTo=function(t){return this.clone()._zoomTo(t)},s.prototype.sub=function(t){return this.clone()._sub(t)},s.prototype._zoomTo=function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},s.prototype._sub=function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this};var l=u;function u(t,e){this.x=t,this.y=e}function c(t,e,r,n){var a=new i(t,e,r,n);return function(t){return a.solve(t)}}u.prototype={clone:function(){return new u(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,a=r*this.x+e*this.y;return this.x=n,this.y=a,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),a=e.x+r*(this.x-e.x)-n*(this.y-e.y),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=a,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},u.convert=function(t){return t instanceof u?t:Array.isArray(t)?new u(t[0],t[1]):t};var f=c(.25,.1,.25,1);function h(t,e,r){return Math.min(r,Math.max(e,t))}function p(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,a=e;n(e.y-t.y)*(r.x-t.x)}function k(t){for(var e=0,r=0,n=t.length,a=n-1,i=void 0,o=void 0;r=200&&r.status<300&&r.response?e(null,{data:n,cacheControl:r.getResponseHeader("Cache-Control"),expires:r.getResponseHeader("Expires")}):e(new A(r.statusText,r.status,t.url))},r.send(),r};function E(t,e,r){r[t]=r[t]||[],r[t].push(e)}function C(t,e,r){if(r&&r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}var L=function(t,e){void 0===e&&(e={}),p(this,e),this.type=t},I=function(t){function e(e,r){void 0===r&&(r={}),t.call(this,"error",p({error:e},r))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(L),z=function(){};z.prototype.on=function(t,e){return this._listeners=this._listeners||{},E(t,e,this._listeners),this},z.prototype.off=function(t,e){return C(t,e,this._listeners),C(t,e,this._oneTimeListeners),this},z.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},E(t,e,this._oneTimeListeners),this},z.prototype.fire=function(t){"string"==typeof t&&(t=new L(t,arguments[1]||{}));var e=t.type;if(this.listens(e)){t.target=this;for(var r=0,n=this._listeners&&this._listeners[e]?this._listeners[e].slice():[];r0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},z.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var P={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.0511,180,85.0511]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},lineMetrics:{type:"boolean",default:!1}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_fill:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_circle:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_line:{"line-cap":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{butt:{},round:{},square:{}},default:"butt"},"line-join":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:{bevel:{},round:{},miter:{}},default:"miter"},"line-miter-limit":{type:"number",default:2,function:"interpolated","zoom-function":!0,requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number",default:1.05,function:"interpolated","zoom-function":!0,requires:[{"line-join":"round"}]},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_symbol:{"symbol-placement":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{point:{},line:{}},default:"point"},"symbol-spacing":{type:"number",default:250,minimum:1,function:"interpolated","zoom-function":!0,units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1},"icon-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["icon-image"]},"icon-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"]},"icon-size":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,units:"factor of the original icon size",requires:["icon-image"]},"icon-text-fit":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"]},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",function:"interpolated","zoom-function":!0,requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}]},"icon-image":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,tokens:!0},"icon-rotate":{type:"number",default:0,period:360,function:"interpolated","zoom-function":!0,"property-function":!0,units:"degrees",requires:["icon-image"]},"icon-padding":{type:"number",default:2,minimum:0,function:"interpolated","zoom-function":!0,units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"icon-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"]},"icon-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"]},"text-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"]},"text-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"]},"text-field":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:"",tokens:!0},"text-font":{type:"array",value:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"]},"text-size":{type:"number",default:16,minimum:0,units:"pixels",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-line-height":{type:"number",default:1.2,units:"ems",function:"interpolated","zoom-function":!0,requires:["text-field"]},"text-letter-spacing":{type:"number",default:0,units:"ems",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-justify":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:{left:{},center:{},right:{}},default:"center",requires:["text-field"]},"text-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field"]},"text-max-angle":{type:"number",default:45,units:"degrees",function:"interpolated","zoom-function":!0,requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number",default:0,period:360,units:"degrees",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",function:"interpolated","zoom-function":!0,requires:["text-field"]},"text-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"]},"text-offset":{type:"array",value:"number",units:"ems",function:"interpolated","zoom-function":!0,"property-function":!0,length:2,default:[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["text-field"]},"text-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!1,requires:["text-field","icon-image"]},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Heatmap"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},transition:!1,"zoom-function":!0,"property-function":!1,function:"piecewise-constant"},position:{type:"array",default:[1.15,210,30],length:3,value:"number",transition:!0,function:"interpolated","zoom-function":!0,"property-function":!1},color:{type:"color",default:"#ffffff",function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0},intensity:{type:"number",default:.5,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",function:"piecewise-constant","zoom-function":!0,default:!0},"fill-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:1,minimum:0,maximum:1,transition:!0},"fill-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["fill-translate"]},"fill-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0}},paint_line:{"line-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["line-translate"]},"line-width":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-gap-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-offset":{type:"number",default:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-dasharray":{type:"array",value:"number",function:"piecewise-constant","zoom-function":!0,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0},"line-gradient":{type:"color",function:"interpolated","zoom-function":!1,"property-function":!1,transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}]}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-blur":{type:"number",default:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map"},"circle-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"viewport"},"circle-stroke-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-stroke-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"heatmap-weight":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!1},"heatmap-intensity":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],function:"interpolated","zoom-function":!1,"property-function":!1,transition:!1},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-halo-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-halo-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-hue-rotate":{type:"number",default:0,period:360,function:"interpolated","zoom-function":!0,transition:!0,units:"degrees"},"raster-brightness-min":{type:"number",function:"interpolated","zoom-function":!0,default:0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number",function:"interpolated","zoom-function":!0,default:1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-fade-duration":{type:"number",default:300,minimum:0,function:"interpolated","zoom-function":!0,transition:!1,units:"milliseconds"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,function:"interpolated","zoom-function":!0,transition:!1},"hillshade-illumination-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"viewport"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"hillshade-shadow-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",function:"interpolated","zoom-function":!0,transition:!0},"hillshade-accent-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0}},paint_background:{"background-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible"}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!1,default:1,minimum:0,maximum:1,transition:!0},"fill-extrusion-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-extrusion-pattern"}]},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"fill-extrusion-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"]},"fill-extrusion-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0},"fill-extrusion-height":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:0,minimum:0,units:"meters",transition:!0},"fill-extrusion-base":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"]}}},O=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)};function D(t){var e=t.key,r=t.value;return r?[new O(e,r,"constants have been deprecated as of v8")]:[]}function R(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,a=e;n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var J=[V,U,q,H,G,W,Z(Y)];function K(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&!K(t.itemType,e.itemType)&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=J;r255?255:t}function a(t){return t<0?0:t>1?1:t}function i(t){return"%"===t[t.length-1]?n(parseFloat(t)/100*255):n(parseInt(t))}function o(t){return"%"===t[t.length-1]?a(parseFloat(t)/100):a(parseFloat(t))}function s(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,a=t.replace(/ /g,"").toLowerCase();if(a in r)return r[a].slice();if("#"===a[0])return 4===a.length?(e=parseInt(a.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===a.length&&(e=parseInt(a.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var c=a.substr(0,l),f=a.substr(l+1,u-(l+1)).split(","),h=1;switch(c){case"rgba":if(4!==f.length)return null;h=o(f.pop());case"rgb":return 3!==f.length?null:[i(f[0]),i(f[1]),i(f[2]),h];case"hsla":if(4!==f.length)return null;h=o(f.pop());case"hsl":if(3!==f.length)return null;var p=(parseFloat(f[0])%360+360)%360/360,d=o(f[1]),v=o(f[2]),g=v<=.5?v*(d+1):v+d-v*d,m=2*v-g;return[n(255*s(m,g,p+1/3)),n(255*s(m,g,p)),n(255*s(m,g,p-1/3)),h];default:return null}}return null}}catch(t){}}).parseCSSColor,tt=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};tt.parse=function(t){if(t){if(t instanceof tt)return t;if("string"==typeof t){var e=Q(t);if(e)return new tt(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},tt.prototype.toString=function(){var t=this.toArray(),e=t[0],r=t[1],n=t[2],a=t[3];return"rgba("+Math.round(e)+","+Math.round(r)+","+Math.round(n)+","+a+")"},tt.prototype.toArray=function(){var t=this.r,e=this.g,r=this.b,n=this.a;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*r/n,n]},tt.black=new tt(0,0,0,1),tt.white=new tt(1,1,1,1),tt.transparent=new tt(0,0,0,0);var et=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};et.prototype.compare=function(t,e){return this.collator.compare(t,e)},et.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var rt=function(t,e,r){this.type=X,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e};function nt(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function at(t){if(null===t)return V;if("string"==typeof t)return q;if("boolean"==typeof t)return H;if("number"==typeof t)return U;if(t instanceof tt)return G;if(t instanceof et)return X;if(Array.isArray(t)){for(var e,r=t.length,n=0,a=t;n4)return e.error("Expected 1, 2, or 3 arguments, but found "+(t.length-1)+" instead.");var r,n;if(t.length>2){var a=t[1];if("string"!=typeof a||!(a in ut))return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=ut[a]}else r=Y;if(t.length>3){if("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2]))return e.error('The length argument to "array" must be a positive integer literal',2);n=t[2]}var i=Z(r,n),o=e.parse(t[t.length-1],t.length-1,Y);return o?new ct(i,o):null},ct.prototype.evaluate=function(t){var e=this.input.evaluate(t);if(K(this.type,at(e)))throw new ot("Expected value to be of type "+$(this.type)+", but found "+$(at(e))+" instead.");return e},ct.prototype.eachChild=function(t){t(this.input)},ct.prototype.possibleOutputs=function(){return this.input.possibleOutputs()},ct.prototype.serialize=function(){var t=["array"],e=this.type.itemType;if("string"===e.kind||"number"===e.kind||"boolean"===e.kind){t.push(e.kind);var r=this.type.N;"number"==typeof r&&t.push(r)}return t.push(this.input.serialize()),t};var ft={"to-number":U,"to-color":G},ht=function(t,e){this.type=t,this.args=e};ht.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");for(var r=t[0],n=ft[r],a=[],i=1;i4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":nt(e[0],e[1],e[2],e[3])))return new tt(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new ot(r||"Could not parse color from value '"+("string"==typeof e?e:JSON.stringify(e))+"'")}for(var o=null,s=0,l=this.args;s=0)return!1;var r=!0;return t.eachChild(function(t){r&&!mt(t,e)&&(r=!1)}),r}vt.prototype.evaluate=function(t){return this._evaluate(t,this.args)},vt.prototype.eachChild=function(t){this.args.forEach(t)},vt.prototype.possibleOutputs=function(){return[void 0]},vt.prototype.serialize=function(){return[this.name].concat(this.args.map(function(t){return t.serialize()}))},vt.parse=function(t,e){var r=t[0],n=vt.definitions[r];if(!n)return e.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0);for(var a=Array.isArray(n)?n[0]:n.type,i=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=i.filter(function(e){var r=e[0];return!Array.isArray(r)||r.length===t.length-1}),s=[],l=1;lr&&ee))throw new ot("Input is not a number.");i=o-1}}return Math.max(o-1,0)}xt.prototype.parse=function(t,e,r,n,a){return void 0===a&&(a={}),e?this.concat(e,r,n)._parse(t,a):this._parse(t,a)},xt.prototype._parse=function(t,e){if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var r=t[0];if("string"!=typeof r)return this.error("Expression name must be a string, but found "+typeof r+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var n=this.registry[r];if(n){var a=n.parse(t,this);if(!a)return null;if(this.expectedType){var i=this.expectedType,o=a.type;if("string"!==i.kind&&"number"!==i.kind&&"boolean"!==i.kind&&"object"!==i.kind||"value"!==o.kind)if("array"===i.kind&&"value"===o.kind)e.omitTypeAnnotations||(a=new ct(i,a));else if("color"!==i.kind||"value"!==o.kind&&"string"!==o.kind){if(this.checkSubtype(this.expectedType,a.type))return null}else e.omitTypeAnnotations||(a=new ht(i,[a]));else e.omitTypeAnnotations||(a=new lt(i,[a]))}if(!(a instanceof it)&&function t(e){if(e instanceof yt)return t(e.boundExpression);if(e instanceof vt&&"error"===e.name)return!1;if(e instanceof rt)return!1;var r=e instanceof ht||e instanceof lt||e instanceof ct;var n=!0;e.eachChild(function(e){n=r?n&&t(e):n&&e instanceof it});if(!n)return!1;return gt(e)&&mt(e,["zoom","heatmap-density","line-progress","is-supported-script"])}(a)){var s=new dt;try{a=new it(a.type,a.evaluate(s))}catch(t){return this.error(t.message),null}}return a}return this.error('Unknown expression "'+r+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof t+" instead.")},xt.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,a=r?this.scope.concat(r):this.scope;return new xt(this.registry,n,e||null,a,this.errors)},xt.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map(function(t){return"["+t+"]"}).join("");this.errors.push(new N(n,t))},xt.prototype.checkSubtype=function(t,e){var r=K(t,e);return r&&this.error(r),r};var _t=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,a=r;n=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var f=e.parse(l,c,i);if(!f)return null;i=i||f.type,a.push([s,f])}return new _t(i,r,a)},_t.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var a=e.length;return n>=e[a-1]?r[a-1].evaluate(t):r[bt(e,n)].evaluate(t)},_t.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var kt=Object.freeze({number:wt,color:function(t,e,r){return new tt(wt(t.r,e.r,r),wt(t.g,e.g,r),wt(t.b,e.b,r),wt(t.a,e.a,r))},array:function(t,e,r){return t.map(function(t,n){return wt(t,e[n],r)})}}),Mt=function(t,e,r,n){this.type=t,this.interpolation=e,this.input=r,this.labels=[],this.outputs=[];for(var a=0,i=n;a1}))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:o}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(n=e.parse(n,2,U)))return null;var s=[],l=null;e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(var u=0;u=c)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',h);var d=e.parse(f,p,l);if(!d)return null;l=l||d.type,s.push([c,d])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new Mt(l,r,n,s):e.error("Type "+$(l)+" is not interpolatable.")},Mt.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var a=e.length;if(n>=e[a-1])return r[a-1].evaluate(t);var i=bt(e,n),o=e[i],s=e[i+1],l=Mt.interpolationFactor(this.interpolation,n,o,s),u=r[i].evaluate(t),c=r[i+1].evaluate(t);return kt[this.type.kind.toLowerCase()](u,c,l)},Mt.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new ot("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new ot("Array index must be an integer, but found "+e+" instead.");return r[e]},Et.prototype.eachChild=function(t){t(this.index),t(this.input)},Et.prototype.possibleOutputs=function(){return[void 0]},Et.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Ct=function(t,e,r,n,a,i){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=a,this.otherwise=i};Ct.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var a={},i=[],o=2;oNumber.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof h&&Math.floor(h)!==h)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,at(h)))return null}else r=at(h);if(void 0!==a[String(h)])return u.error("Branch labels must be unique.");a[String(h)]=i.length}var p=e.parse(l,o,n);if(!p)return null;n=n||p.type,i.push(p)}var d=e.parse(t[1],1,r);if(!d)return null;var v=e.parse(t[t.length-1],t.length-1,n);return v?new Ct(r,n,d,a,i,v):null},Ct.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},Ct.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},Ct.prototype.possibleOutputs=function(){return(t=[]).concat.apply(t,this.outputs.map(function(t){return t.possibleOutputs()})).concat(this.otherwise.possibleOutputs());var t},Ct.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},a=0,i=Object.keys(this.cases).sort();an.evaluate(t)}function Ut(t,e){var r=e[0],n=e[1];return r.evaluate(t)<=n.evaluate(t)}function qt(t,e){var r=e[0],n=e[1];return r.evaluate(t)>=n.evaluate(t)}function Ht(t){return{type:t}}function Gt(t){return{result:"success",value:t}}function Wt(t){return{result:"error",value:t}}vt.register(Rt,{error:[{kind:"error"},[q],function(t,e){var r=e[0];throw new ot(r.evaluate(t))}],typeof:[q,[Y],function(t,e){return $(at(e[0].evaluate(t)))}],"to-string":[q,[Y],function(t,e){var r=e[0],n=typeof(r=r.evaluate(t));return null===r?"":"string"===n||"number"===n||"boolean"===n?String(r):r instanceof tt?r.toString():JSON.stringify(r)}],"to-boolean":[H,[Y],function(t,e){var r=e[0];return Boolean(r.evaluate(t))}],"to-rgba":[Z(U,4),[G],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[G,[U,U,U],Bt],rgba:[G,[U,U,U,U],Bt],has:{type:H,overloads:[[[q],function(t,e){return Ft(e[0].evaluate(t),t.properties())}],[[q,W],function(t,e){var r=e[0],n=e[1];return Ft(r.evaluate(t),n.evaluate(t))}]]},get:{type:Y,overloads:[[[q],function(t,e){return Nt(e[0].evaluate(t),t.properties())}],[[q,W],function(t,e){var r=e[0],n=e[1];return Nt(r.evaluate(t),n.evaluate(t))}]]},properties:[W,[],function(t){return t.properties()}],"geometry-type":[q,[],function(t){return t.geometryType()}],id:[Y,[],function(t){return t.id()}],zoom:[U,[],function(t){return t.globals.zoom}],"heatmap-density":[U,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[U,[],function(t){return t.globals.lineProgress||0}],"+":[U,Ht(U),function(t,e){for(var r=0,n=0,a=e;n":[H,[q,Y],function(t,e){var r=e[0],n=e[1],a=t.properties()[r.value],i=n.value;return typeof a==typeof i&&a>i}],"filter-id->":[H,[Y],function(t,e){var r=e[0],n=t.id(),a=r.value;return typeof n==typeof a&&n>a}],"filter-<=":[H,[q,Y],function(t,e){var r=e[0],n=e[1],a=t.properties()[r.value],i=n.value;return typeof a==typeof i&&a<=i}],"filter-id-<=":[H,[Y],function(t,e){var r=e[0],n=t.id(),a=r.value;return typeof n==typeof a&&n<=a}],"filter->=":[H,[q,Y],function(t,e){var r=e[0],n=e[1],a=t.properties()[r.value],i=n.value;return typeof a==typeof i&&a>=i}],"filter-id->=":[H,[Y],function(t,e){var r=e[0],n=t.id(),a=r.value;return typeof n==typeof a&&n>=a}],"filter-has":[H,[Y],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[H,[],function(t){return null!==t.id()}],"filter-type-in":[H,[Z(q)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[H,[Z(Y)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[H,[q,Z(Y)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[H,[q,Z(Y)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var a=r+n>>1;if(e[a]===t)return!0;e[a]>t?n=a-1:r=a+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],">":{type:H,overloads:[[[U,U],Vt],[[q,q],Vt],[[q,q,X],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))>0}]]},"<":{type:H,overloads:[[[U,U],jt],[[q,q],jt],[[q,q,X],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))<0}]]},">=":{type:H,overloads:[[[U,U],qt],[[q,q],qt],[[q,q,X],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))>=0}]]},"<=":{type:H,overloads:[[[U,U],Ut],[[q,q],Ut],[[q,q,X],function(t,e){var r=e[0],n=e[1];return e[2].evaluate(t).compare(r.evaluate(t),n.evaluate(t))<=0}]]},all:{type:H,overloads:[[[H,H],function(t,e){var r=e[0],n=e[1];return r.evaluate(t)&&n.evaluate(t)}],[Ht(H),function(t,e){for(var r=0,n=e;rQt?Math.pow(t,1/3):t/Kt+$t}function ne(t){return t>Jt?t*t*t:Kt*(t-$t)}function ae(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ie(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function oe(t){var e=ie(t.r),r=ie(t.g),n=ie(t.b),a=re((.4124564*e+.3575761*r+.1804375*n)/Yt),i=re((.2126729*e+.7151522*r+.072175*n)/Xt);return{l:116*i-16,a:500*(a-i),b:200*(i-re((.0193339*e+.119192*r+.9503041*n)/Zt)),alpha:t.a}}function se(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=Xt*ne(e),r=Yt*ne(r),n=Zt*ne(n),new tt(ae(3.2404542*r-1.5371385*e-.4985314*n),ae(-.969266*r+1.8760108*e+.041556*n),ae(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}var le={forward:oe,reverse:se,interpolate:function(t,e,r){return{l:wt(t.l,e.l,r),a:wt(t.a,e.a,r),b:wt(t.b,e.b,r),alpha:wt(t.alpha,e.alpha,r)}}},ue={forward:function(t){var e=oe(t),r=e.l,n=e.a,a=e.b,i=Math.atan2(a,n)*ee;return{h:i<0?i+360:i,c:Math.sqrt(n*n+a*a),l:r,alpha:t.a}},reverse:function(t){var e=t.h*te,r=t.c;return se({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:function(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}(t.h,e.h,r),c:wt(t.c,e.c,r),l:wt(t.l,e.l,r),alpha:wt(t.alpha,e.alpha,r)}}},ce=Object.freeze({lab:le,hcl:ue});function fe(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function he(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function pe(t){return t}function de(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function ve(t,e,r,n,a){return de(typeof r===a?n[r]:void 0,t.default,e.default)}function ge(t,e,r){if("number"!==fe(r))return de(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var a=xe(t.stops,r);return t.stops[a][1]}function me(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==fe(r))return de(t.default,e.default);var a=t.stops.length;if(1===a)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[a-1][0])return t.stops[a-1][1];var i=xe(t.stops,r),o=function(t,e,r,n){var a=n-r,i=t-r;return 0===a?0:1===e?i/a:(Math.pow(e,i)-1)/(Math.pow(e,a)-1)}(r,n,t.stops[i][0],t.stops[i+1][0]),s=t.stops[i][1],l=t.stops[i+1][1],u=kt[e.type]||pe;if(t.colorSpace&&"rgb"!==t.colorSpace){var c=ce[t.colorSpace];u=function(t,e){return c.reverse(c.interpolate(c.forward(t),c.forward(e),o))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),n=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return u(r,n,o)}}:u(s,l,o)}function ye(t,e,r){return"color"===e.type?r=tt.parse(r):fe(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),de(r,t.default,e.default)}function xe(t,e){for(var r,n,a=0,i=t.length-1,o=0;a<=i;){if(r=t[o=Math.floor((a+i)/2)][0],n=t[o+1][0],e===r||e>r&&ee&&(i=o-1)}return Math.max(o-1,0)}var be=function(t,e){var r;this.expression=t,this._warningHistory={},this._defaultValue="color"===(r=e).type&&he(r.default)?new tt(0,0,0,0):"color"===r.type?tt.parse(r.default)||null:void 0===r.default?null:r.default,"enum"===e.type&&(this._enumValues=e.values)};function _e(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Rt}function we(t,e){var r=new xt(Rt,[],function(t){var e={color:G,string:q,number:U,enum:q,boolean:H};if("array"===t.type)return Z(e[t.value]||Y,t.length);return e[t.type]||null}(e)),n=r.parse(t);return n?Gt(new be(n,e)):Wt(r.errors)}be.prototype.evaluateWithoutErrorHandling=function(t,e){return this._evaluator||(this._evaluator=new dt),this._evaluator.globals=t,this._evaluator.feature=e,this.expression.evaluate(this._evaluator)},be.prototype.evaluate=function(t,e){this._evaluator||(this._evaluator=new dt),this._evaluator.globals=t,this._evaluator.feature=e;try{var r=this.expression.evaluate(this._evaluator);if(null==r)return this._defaultValue;if(this._enumValues&&!(r in this._enumValues))throw new ot("Expected value to be one of "+Object.keys(this._enumValues).map(function(t){return JSON.stringify(t)}).join(", ")+", but found "+JSON.stringify(r)+" instead.");return r}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var ke=function(t,e){this.kind=t,this._styleExpression=e};ke.prototype.evaluateWithoutErrorHandling=function(t,e){return this._styleExpression.evaluateWithoutErrorHandling(t,e)},ke.prototype.evaluate=function(t,e){return this._styleExpression.evaluate(t,e)};var Me=function(t,e,r){this.kind=t,this.zoomStops=r.labels,this._styleExpression=e,r instanceof Mt&&(this._interpolationType=r.interpolation)};function Ae(t,e){if("error"===(t=we(t,e)).result)return t;var r=t.value.expression,n=gt(r);if(!n&&!e["property-function"])return Wt([new N("","property expressions not supported")]);var a=mt(r,["zoom"]);if(!a&&!1===e["zoom-function"])return Wt([new N("","zoom expressions not supported")]);var i=function t(e){var r=null;if(e instanceof St)r=t(e.result);else if(e instanceof Tt)for(var n=0,a=e.args;nn.maximum?[new O(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function Ie(t){var e,r,n,a=t.valueSpec,i=B(t.value.type),o={},s="categorical"!==i&&void 0===t.value.property,l=!s,u="array"===fe(t.value.stops)&&"array"===fe(t.value.stops[0])&&"object"===fe(t.value.stops[0][0]),c=Ee({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===i)return[new O(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;e=e.concat(Ce({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:f})),"array"===fe(r)&&0===r.length&&e.push(new O(t.key,r,"array must have at least one stop"));return e},default:function(t){return Ke({key:t.key,value:t.value,valueSpec:a,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===i&&s&&c.push(new O(t.key,t.value,'missing required property "property"')),"identity"===i||t.value.stops||c.push(new O(t.key,t.value,'missing required property "stops"')),"exponential"===i&&"piecewise-constant"===t.valueSpec.function&&c.push(new O(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!t.valueSpec["property-function"]?c.push(new O(t.key,t.value,"property functions not supported")):s&&!t.valueSpec["zoom-function"]&&"heatmap-color"!==t.objectKey&&"line-gradient"!==t.objectKey&&c.push(new O(t.key,t.value,"zoom functions not supported"))),"categorical"!==i&&!u||void 0!==t.value.property||c.push(new O(t.key,t.value,'"property" property is required')),c;function f(t){var e=[],i=t.value,s=t.key;if("array"!==fe(i))return[new O(s,i,"array expected, "+fe(i)+" found")];if(2!==i.length)return[new O(s,i,"array length 2 expected, length "+i.length+" found")];if(u){if("object"!==fe(i[0]))return[new O(s,i,"object expected, "+fe(i[0])+" found")];if(void 0===i[0].zoom)return[new O(s,i,"object stop key must have zoom")];if(void 0===i[0].value)return[new O(s,i,"object stop key must have value")];if(n&&n>B(i[0].zoom))return[new O(s,i[0].zoom,"stop zoom values must appear in ascending order")];B(i[0].zoom)!==n&&(n=B(i[0].zoom),r=void 0,o={}),e=e.concat(Ee({key:s+"[0]",value:i[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Le,value:h}}))}else e=e.concat(h({key:s+"[0]",value:i[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},i));return e.concat(Ke({key:s+"[1]",value:i[1],valueSpec:a,style:t.style,styleSpec:t.styleSpec}))}function h(t,n){var s=fe(t.value),l=B(t.value),u=null!==t.value?t.value:n;if(e){if(s!==e)return[new O(t.key,u,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new O(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==i){var c="number expected, "+s+" found";return a["property-function"]&&void 0===i&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new O(t.key,u,c)]}return"categorical"!==i||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==i&&"number"===s&&void 0!==r&&l=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3===t.length&&(Array.isArray(t[1])||Array.isArray(t[2]));case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function Fe(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?Ne(t[1],t[2],"=="):"!="===r?Ue(Ne(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?Ne(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(Fe))):"all"===r?["all"].concat(t.slice(1).map(Fe)):"none"===r?["all"].concat(t.slice(1).map(Fe).map(Ue)):"in"===r?je(t[1],t.slice(2)):"!in"===r?Ue(je(t[1],t.slice(2))):"has"===r?Ve(t[1]):"!has"!==r||Ue(Ve(t[1]))}function Ne(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function je(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(function(t){return typeof t!=typeof e[0]})?["filter-in-large",t,["literal",e.sort(Be)]]:["filter-in-small",t,["literal",e]]}}function Ve(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ue(t){return["!",t]}function qe(t){return Oe(F(t.value))?ze(R({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value;var n=e.key;if("array"!==fe(r))return[new O(n,r,"array expected, "+fe(r)+" found")];var a=e.styleSpec;var i;var o=[];if(r.length<1)return[new O(n,r,"filter array must have at least 1 element")];o=o.concat(Pe({key:n+"[0]",value:r[0],valueSpec:a.filter_operator,style:e.style,styleSpec:e.styleSpec}));switch(B(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===B(r[1])&&o.push(new O(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&o.push(new O(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(i=fe(r[1]))&&o.push(new O(n+"[1]",r[1],"string expected, "+i+" found"));for(var s=2;s=u[h+0]&&n>=u[h+1]?(o[f]=!0,i.push(l[f])):o[f]=!1}}},cr.prototype._forEachCell=function(t,e,r,n,a,i,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),f=s;f<=u;f++)for(var h=l;h<=c;h++){var p=this.d*h+f;if(a.call(this,t,e,r,n,p,i,o))return}},cr.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},cr.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=ur+this.cells.length+1+1,r=0,n=0;n=0)){var f=t[c];u[c]=hr[l].shallow.indexOf(c)>=0?f:vr(f,e)}t instanceof Error&&(u.message=t.message)}return{name:l,properties:u}}throw new Error("can't serialize object of type "+typeof t)}function gr(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof fr)return t;if(Array.isArray(t))return t.map(function(t){return gr(t)});if("object"==typeof t){var e=t,r=e.name,n=e.properties;if(!r)throw new Error("can't deserialize object of anonymous class");var a=hr[r].klass;if(!a)throw new Error("can't deserialize unregistered class "+r);if(a.deserialize)return a.deserialize(n._serialized);for(var i=Object.create(a.prototype),o=0,s=Object.keys(n);o=0?n[l]:gr(n[l])}return i}throw new Error("can't deserialize object of type "+typeof t)}var mr=function(){this.first=!0};mr.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function xr(t){for(var e=0,r=t;e=65097&&t<=65103)||(!!yr["CJK Compatibility Ideographs"](t)||(!!yr["CJK Compatibility"](t)||(!!yr["CJK Radicals Supplement"](t)||(!!yr["CJK Strokes"](t)||(!(!yr["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||(!!yr["CJK Unified Ideographs Extension A"](t)||(!!yr["CJK Unified Ideographs"](t)||(!!yr["Enclosed CJK Letters and Months"](t)||(!!yr["Hangul Compatibility Jamo"](t)||(!!yr["Hangul Jamo Extended-A"](t)||(!!yr["Hangul Jamo Extended-B"](t)||(!!yr["Hangul Jamo"](t)||(!!yr["Hangul Syllables"](t)||(!!yr.Hiragana(t)||(!!yr["Ideographic Description Characters"](t)||(!!yr.Kanbun(t)||(!!yr["Kangxi Radicals"](t)||(!!yr["Katakana Phonetic Extensions"](t)||(!(!yr.Katakana(t)||12540===t)||(!(!yr["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||(!(!yr["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||(!!yr["Unified Canadian Aboriginal Syllabics"](t)||(!!yr["Unified Canadian Aboriginal Syllabics Extended"](t)||(!!yr["Vertical Forms"](t)||(!!yr["Yijing Hexagram Symbols"](t)||(!!yr["Yi Syllables"](t)||!!yr["Yi Radicals"](t))))))))))))))))))))))))))))))}function wr(t){return!(_r(t)||function(t){return!!(yr["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||yr["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||yr["Letterlike Symbols"](t)||yr["Number Forms"](t)||yr["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||yr["Control Pictures"](t)&&9251!==t||yr["Optical Character Recognition"](t)||yr["Enclosed Alphanumerics"](t)||yr["Geometric Shapes"](t)||yr["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||yr["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||yr["CJK Symbols and Punctuation"](t)||yr.Katakana(t)||yr["Private Use Area"](t)||yr["CJK Compatibility Forms"](t)||yr["Small Form Variants"](t)||yr["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function kr(t,e){return!(!e&&(t>=1424&&t<=2303||yr["Arabic Presentation Forms-A"](t)||yr["Arabic Presentation Forms-B"](t)))&&!(t>=2304&&t<=3583||t>=3840&&t<=4255||yr.Khmer(t))}var Mr,Ar=!1,Tr=null,Sr=!1,Er=new z,Cr={applyArabicShaping:null,processBidirectionalText:null,isLoaded:function(){return Sr||null!=Cr.applyArabicShaping}},Lr=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new mr,this.transition={})};Lr.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;rthis.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(e=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}return r};var Dr=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};Dr.prototype.possiblyEvaluate=function(t){for(var e=new Fr(this._properties),r=0,n=Object.keys(this._values);rn.zoomHistory.lastIntegerZoom?{from:t,to:e,fromScale:2,toScale:1,t:i+(1-i)*o}:{from:r,to:e,fromScale:.5,toScale:1,t:1-(1-o)*i}},Vr.prototype.interpolate=function(t){return t};var Ur=function(t){this.specification=t};Ur.prototype.possiblyEvaluate=function(t,e){return!!t.expression.evaluate(e)},Ur.prototype.interpolate=function(){return!1};var qr=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},t){var r=t[e],n=this.defaultPropertyValues[e]=new Ir(r,void 0),a=this.defaultTransitionablePropertyValues[e]=new zr(r);this.defaultTransitioningPropertyValues[e]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}};pr("DataDrivenProperty",jr),pr("DataConstantProperty",Nr),pr("CrossFadedProperty",Vr),pr("ColorRampProperty",Ur);var Hr=function(t){function e(e,r){for(var n in t.call(this),this.id=e.id,this.metadata=e.metadata,this.type=e.type,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,this.visibility="visible","background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),this._featureFilter=function(){return!0},r.layout&&(this._unevaluatedLayout=new Rr(r.layout)),this._transitionablePaint=new Pr(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var a in e.layout)this.setLayoutProperty(a,e.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){if(null!=e){var n="layers."+this.id+".layout."+t;if(this._validate(or,n,t,e,r))return}"visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility="none"===e?e:"visible"},e.prototype.getPaintProperty=function(t){return g(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(null!=e){var n="layers."+this.id+".paint."+t;if(this._validate(ir,n,t,e,r))return}g(t,"-transition")?this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0):this._transitionablePaint.setValue(t,e)},e.prototype.isHidden=function(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility)},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t)),this.paint=this._transitioningPaint.possiblyEvaluate(t)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return"none"===this.visibility&&(t.layout=t.layout||{},t.layout.visibility="none"),y(t,function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)})},e.prototype._validate=function(t,e,r,n,a){return(!a||!1!==a.validate)&&sr(this,t.call(nr,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:P,style:{glyphs:!0,sprite:!0}}))},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e}(z),Gr={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Wr=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},Yr=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Xr(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map(function(t){var a,i=(a=t.type,Gr[a].BYTES_PER_ELEMENT),o=r=Zr(r,Math.max(e,i)),s=t.components||1;return n=Math.max(n,i),r+=i*s,{name:t.name,type:t.type,components:s,offset:o}}),size:Zr(r,Math.max(n,e)),alignment:e}}function Zr(t,e){return Math.ceil(t/e)*e}Yr.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Yr.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},Yr.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Yr.prototype.clear=function(){this.length=0},Yr.prototype.resize=function(t){this.reserve(t),this.length=t},Yr.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},Yr.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var $r=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.int16[n+0]=t,this.int16[n+1]=e,r},e}(Yr);$r.prototype.bytesPerElement=4,pr("StructArrayLayout2i4",$r);var Jr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var a=this.length;this.resize(a+1);var i=4*a;return this.int16[i+0]=t,this.int16[i+1]=e,this.int16[i+2]=r,this.int16[i+3]=n,a},e}(Yr);Jr.prototype.bytesPerElement=8,pr("StructArrayLayout4i8",Jr);var Kr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i){var o=this.length;this.resize(o+1);var s=6*o;return this.int16[s+0]=t,this.int16[s+1]=e,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=i,o},e}(Yr);Kr.prototype.bytesPerElement=12,pr("StructArrayLayout2i4i12",Kr);var Qr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i,o,s){var l=this.length;this.resize(l+1);var u=6*l,c=12*l;return this.int16[u+0]=t,this.int16[u+1]=e,this.int16[u+2]=r,this.int16[u+3]=n,this.uint8[c+8]=a,this.uint8[c+9]=i,this.uint8[c+10]=o,this.uint8[c+11]=s,l},e}(Yr);Qr.prototype.bytesPerElement=12,pr("StructArrayLayout4i4ub12",Qr);var tn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i,o,s){var l=this.length;this.resize(l+1);var u=8*l;return this.int16[u+0]=t,this.int16[u+1]=e,this.int16[u+2]=r,this.int16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=i,this.uint16[u+6]=o,this.uint16[u+7]=s,l},e}(Yr);tn.prototype.bytesPerElement=16,pr("StructArrayLayout4i4ui16",tn);var en=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var a=3*n;return this.float32[a+0]=t,this.float32[a+1]=e,this.float32[a+2]=r,n},e}(Yr);en.prototype.bytesPerElement=12,pr("StructArrayLayout3f12",en);var rn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;this.resize(e+1);var r=1*e;return this.uint32[r+0]=t,e},e}(Yr);rn.prototype.bytesPerElement=4,pr("StructArrayLayout1ul4",rn);var nn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i,o,s,l,u,c){var f=this.length;this.resize(f+1);var h=12*f,p=6*f;return this.int16[h+0]=t,this.int16[h+1]=e,this.int16[h+2]=r,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=i,this.uint32[p+3]=o,this.uint16[h+8]=s,this.uint16[h+9]=l,this.int16[h+10]=u,this.int16[h+11]=c,f},e}(Yr);nn.prototype.bytesPerElement=24,pr("StructArrayLayout6i1ul2ui2i24",nn);var an=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i){var o=this.length;this.resize(o+1);var s=6*o;return this.int16[s+0]=t,this.int16[s+1]=e,this.int16[s+2]=r,this.int16[s+3]=n,this.int16[s+4]=a,this.int16[s+5]=i,o},e}(Yr);an.prototype.bytesPerElement=12,pr("StructArrayLayout2i2i2i12",an);var on=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=4*r;return this.uint8[n+0]=t,this.uint8[n+1]=e,r},e}(Yr);on.prototype.bytesPerElement=4,pr("StructArrayLayout2ub4",on);var sn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,a,i,o,s,l,u,c,f,h,p){var d=this.length;this.resize(d+1);var v=20*d,g=10*d,m=40*d;return this.int16[v+0]=t,this.int16[v+1]=e,this.uint16[v+2]=r,this.uint16[v+3]=n,this.uint32[g+2]=a,this.uint32[g+3]=i,this.uint32[g+4]=o,this.uint16[v+10]=s,this.uint16[v+11]=l,this.uint16[v+12]=u,this.float32[g+7]=c,this.float32[g+8]=f,this.uint8[m+36]=h,this.uint8[m+37]=p,d},e}(Yr);sn.prototype.bytesPerElement=40,pr("StructArrayLayout2i2ui3ul3ui2f2ub40",sn);var ln=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;this.resize(e+1);var r=1*e;return this.float32[r+0]=t,e},e}(Yr);ln.prototype.bytesPerElement=4,pr("StructArrayLayout1f4",ln);var un=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var a=3*n;return this.int16[a+0]=t,this.int16[a+1]=e,this.int16[a+2]=r,n},e}(Yr);un.prototype.bytesPerElement=6,pr("StructArrayLayout3i6",un);var cn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var a=2*n,i=4*n;return this.uint32[a+0]=t,this.uint16[i+2]=e,this.uint16[i+3]=r,n},e}(Yr);cn.prototype.bytesPerElement=8,pr("StructArrayLayout1ul2ui8",cn);var fn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;this.resize(n+1);var a=3*n;return this.uint16[a+0]=t,this.uint16[a+1]=e,this.uint16[a+2]=r,n},e}(Yr);fn.prototype.bytesPerElement=6,pr("StructArrayLayout3ui6",fn);var hn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.uint16[n+0]=t,this.uint16[n+1]=e,r},e}(Yr);hn.prototype.bytesPerElement=4,pr("StructArrayLayout2ui4",hn);var pn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;this.resize(r+1);var n=2*r;return this.float32[n+0]=t,this.float32[n+1]=e,r},e}(Yr);pn.prototype.bytesPerElement=8,pr("StructArrayLayout2f8",pn);var dn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var a=this.length;this.resize(a+1);var i=4*a;return this.float32[i+0]=t,this.float32[i+1]=e,this.float32[i+2]=r,this.float32[i+3]=n,a},e}(Yr);dn.prototype.bytesPerElement=16,pr("StructArrayLayout4f16",dn);var vn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},radius:{configurable:!0},signedDistanceFromAnchor:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointX.set=function(t){this._structArray.int16[this._pos2+0]=t},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorPointY.set=function(t){this._structArray.int16[this._pos2+1]=t},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.x1.set=function(t){this._structArray.int16[this._pos2+2]=t},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.y1.set=function(t){this._structArray.int16[this._pos2+3]=t},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.x2.set=function(t){this._structArray.int16[this._pos2+4]=t},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.y2.set=function(t){this._structArray.int16[this._pos2+5]=t},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+8]=t},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+9]=t},r.radius.get=function(){return this._structArray.int16[this._pos2+10]},r.radius.set=function(t){this._structArray.int16[this._pos2+10]=t},r.signedDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+11]},r.signedDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+11]=t},r.anchorPoint.get=function(){return new l(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(Wr);vn.prototype.size=24;var gn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new vn(this,t)},e}(nn);pr("CollisionBoxArray",gn);var mn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},hidden:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorX.set=function(t){this._structArray.int16[this._pos2+0]=t},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.anchorY.set=function(t){this._structArray.int16[this._pos2+1]=t},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.glyphStartIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.numGlyphs.set=function(t){this._structArray.uint16[this._pos2+3]=t},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.vertexStartIndex.set=function(t){this._structArray.uint32[this._pos4+2]=t},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineStartIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.lineLength.set=function(t){this._structArray.uint32[this._pos4+4]=t},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.segment.set=function(t){this._structArray.uint16[this._pos2+10]=t},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.lowerSize.set=function(t){this._structArray.uint16[this._pos2+11]=t},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.upperSize.set=function(t){this._structArray.uint16[this._pos2+12]=t},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetX.set=function(t){this._structArray.float32[this._pos4+7]=t},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.lineOffsetY.set=function(t){this._structArray.float32[this._pos4+8]=t},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.writingMode.set=function(t){this._structArray.uint8[this._pos1+36]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+37]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+37]=t},Object.defineProperties(e.prototype,r),e}(Wr);mn.prototype.size=40;var yn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new mn(this,t)},e}(sn);pr("PlacedSymbolArray",yn);var xn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={offsetX:{configurable:!0}};return r.offsetX.get=function(){return this._structArray.float32[this._pos4+0]},r.offsetX.set=function(t){this._structArray.float32[this._pos4+0]=t},Object.defineProperties(e.prototype,r),e}(Wr);xn.prototype.size=4;var bn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e.prototype.get=function(t){return new xn(this,t)},e}(ln);pr("GlyphOffsetArray",bn);var _n=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={x:{configurable:!0},y:{configurable:!0},tileUnitDistanceFromAnchor:{configurable:!0}};return r.x.get=function(){return this._structArray.int16[this._pos2+0]},r.x.set=function(t){this._structArray.int16[this._pos2+0]=t},r.y.get=function(){return this._structArray.int16[this._pos2+1]},r.y.set=function(t){this._structArray.int16[this._pos2+1]=t},r.tileUnitDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+2]},r.tileUnitDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+2]=t},Object.defineProperties(e.prototype,r),e}(Wr);_n.prototype.size=6;var wn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e.prototype.get=function(t){return new _n(this,t)},e}(un);pr("SymbolLineVertexArray",wn);var kn=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.featureIndex.set=function(t){this._structArray.uint32[this._pos4+0]=t},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},r.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+3]=t},Object.defineProperties(e.prototype,r),e}(Wr);kn.prototype.size=8;var Mn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new kn(this,t)},e}(cn);pr("FeatureIndexArray",Mn);var An=Xr([{name:"a_pos",components:2,type:"Int16"}],4).members,Tn=function(t){void 0===t&&(t=[]),this.segments=t};Tn.prototype.prepareSegment=function(t,e,r){var n=this.segments[this.segments.length-1];return t>Tn.MAX_VERTEX_ARRAY_LENGTH&&_("Max vertices per segment is "+Tn.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!n||n.vertexLength+t>Tn.MAX_VERTEX_ARRAY_LENGTH)&&(n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},this.segments.push(n)),n},Tn.prototype.get=function(){return this.segments},Tn.prototype.destroy=function(){for(var t=0,e=this.segments;tBn.max||o.yBn.max)&&_("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function Nn(t,e,r,n,a){t.emplaceBack(2*e+(n+1)/2,2*r+(a+1)/2)}var jn=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new $r,this.indexArray=new fn,this.segments=new Tn,this.programConfigurations=new Pn(An,t.layers,t.zoom)};function Vn(t,e,r){for(var n=0;n=3)for(var s=0;s1){if(Gn(t,e))return!0;for(var n=0;n1?t.distSqr(r):t.distSqr(r.sub(e)._mult(a)._add(e))}function Zn(t,e){for(var r,n,a,i=!1,o=0;oe.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(i=!i);return i}function $n(t,e){for(var r=!1,n=0,a=t.length-1;ne.y!=o.y>e.y&&e.x<(o.x-i.x)*(e.y-i.y)/(o.y-i.y)+i.x&&(r=!r)}return r}function Jn(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).binders[t].statistics.max}function Kn(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Qn(t,e,r,n,a){if(!e[0]&&!e[1])return t;var i=l.convert(e);"viewport"===r&&i._rotate(-n);for(var o=[],s=0;s=Dn||l<0||l>=Dn)){var u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),c=u.vertexLength;Nn(this.layoutVertexArray,s,l,-1,-1),Nn(this.layoutVertexArray,s,l,1,-1),Nn(this.layoutVertexArray,s,l,1,1),Nn(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),u.vertexLength+=4,u.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t)},pr("CircleBucket",jn,{omit:["layers"]});var ta={paint:new qr({"circle-radius":new jr(P.paint_circle["circle-radius"]),"circle-color":new jr(P.paint_circle["circle-color"]),"circle-blur":new jr(P.paint_circle["circle-blur"]),"circle-opacity":new jr(P.paint_circle["circle-opacity"]),"circle-translate":new Nr(P.paint_circle["circle-translate"]),"circle-translate-anchor":new Nr(P.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Nr(P.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Nr(P.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new jr(P.paint_circle["circle-stroke-width"]),"circle-stroke-color":new jr(P.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new jr(P.paint_circle["circle-stroke-opacity"])})},ea=a(function(t,e){var r;t.exports=((r=new Float32Array(3))[0]=0,r[1]=0,r[2]=0,function(){var t=new Float32Array(4);t[0]=0,t[1]=0,t[2]=0,t[3]=0}(),{vec3:{transformMat3:function(t,e,r){var n=e[0],a=e[1],i=e[2];return t[0]=n*r[0]+a*r[3]+i*r[6],t[1]=n*r[1]+a*r[4]+i*r[7],t[2]=n*r[2]+a*r[5]+i*r[8],t}},vec4:{transformMat4:function(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3];return t[0]=r[0]*n+r[4]*a+r[8]*i+r[12]*o,t[1]=r[1]*n+r[5]*a+r[9]*i+r[13]*o,t[2]=r[2]*n+r[6]*a+r[10]*i+r[14]*o,t[3]=r[3]*n+r[7]*a+r[11]*i+r[15]*o,t}},mat2:{create:function(){var t=new Float32Array(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},rotate:function(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*s,t[1]=a*l+o*s,t[2]=n*-s+i*l,t[3]=a*-s+o*l,t},scale:function(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=r[0],l=r[1];return t[0]=n*s,t[1]=a*s,t[2]=i*l,t[3]=o*l,t}},mat3:{create:function(){var t=new Float32Array(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},fromRotation:function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}},mat4:{create:function(){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},identity:function(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},translate:function(t,e,r){var n,a,i,o,s,l,u,c,f,h,p,d,v=r[0],g=r[1],m=r[2];return e===t?(t[12]=e[0]*v+e[4]*g+e[8]*m+e[12],t[13]=e[1]*v+e[5]*g+e[9]*m+e[13],t[14]=e[2]*v+e[6]*g+e[10]*m+e[14],t[15]=e[3]*v+e[7]*g+e[11]*m+e[15]):(n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],l=e[5],u=e[6],c=e[7],f=e[8],h=e[9],p=e[10],d=e[11],t[0]=n,t[1]=a,t[2]=i,t[3]=o,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=f,t[9]=h,t[10]=p,t[11]=d,t[12]=n*v+s*g+f*m+e[12],t[13]=a*v+l*g+h*m+e[13],t[14]=i*v+u*g+p*m+e[14],t[15]=o*v+c*g+d*m+e[15]),t},scale:function(t,e,r){var n=r[0],a=r[1],i=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]*a,t[5]=e[5]*a,t[6]=e[6]*a,t[7]=e[7]*a,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},multiply:function(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3],s=e[4],l=e[5],u=e[6],c=e[7],f=e[8],h=e[9],p=e[10],d=e[11],v=e[12],g=e[13],m=e[14],y=e[15],x=r[0],b=r[1],_=r[2],w=r[3];return t[0]=x*n+b*s+_*f+w*v,t[1]=x*a+b*l+_*h+w*g,t[2]=x*i+b*u+_*p+w*m,t[3]=x*o+b*c+_*d+w*y,x=r[4],b=r[5],_=r[6],w=r[7],t[4]=x*n+b*s+_*f+w*v,t[5]=x*a+b*l+_*h+w*g,t[6]=x*i+b*u+_*p+w*m,t[7]=x*o+b*c+_*d+w*y,x=r[8],b=r[9],_=r[10],w=r[11],t[8]=x*n+b*s+_*f+w*v,t[9]=x*a+b*l+_*h+w*g,t[10]=x*i+b*u+_*p+w*m,t[11]=x*o+b*c+_*d+w*y,x=r[12],b=r[13],_=r[14],w=r[15],t[12]=x*n+b*s+_*f+w*v,t[13]=x*a+b*l+_*h+w*g,t[14]=x*i+b*u+_*p+w*m,t[15]=x*o+b*c+_*d+w*y,t},perspective:function(t,e,r,n,a){var i=1/Math.tan(e/2),o=1/(n-a);return t[0]=i/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=i,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(a+n)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*a*n*o,t[15]=0,t},rotateX:function(t,e,r){var n=Math.sin(r),a=Math.cos(r),i=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],f=e[10],h=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]=i*a+u*n,t[5]=o*a+c*n,t[6]=s*a+f*n,t[7]=l*a+h*n,t[8]=u*a-i*n,t[9]=c*a-o*n,t[10]=f*a-s*n,t[11]=h*a-l*n,t},rotateZ:function(t,e,r){var n=Math.sin(r),a=Math.cos(r),i=e[0],o=e[1],s=e[2],l=e[3],u=e[4],c=e[5],f=e[6],h=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]=i*a+u*n,t[1]=o*a+c*n,t[2]=s*a+f*n,t[3]=l*a+h*n,t[4]=u*a-i*n,t[5]=c*a-o*n,t[6]=f*a-s*n,t[7]=h*a-l*n,t},invert:function(t,e){var r=e[0],n=e[1],a=e[2],i=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],f=e[9],h=e[10],p=e[11],d=e[12],v=e[13],g=e[14],m=e[15],y=r*s-n*o,x=r*l-a*o,b=r*u-i*o,_=n*l-a*s,w=n*u-i*s,k=a*u-i*l,M=c*v-f*d,A=c*g-h*d,T=c*m-p*d,S=f*g-h*v,E=f*m-p*v,C=h*m-p*g,L=y*C-x*E+b*S+_*T-w*A+k*M;return L?(L=1/L,t[0]=(s*C-l*E+u*S)*L,t[1]=(a*E-n*C-i*S)*L,t[2]=(v*k-g*w+m*_)*L,t[3]=(h*w-f*k-p*_)*L,t[4]=(l*T-o*C-u*A)*L,t[5]=(r*C-a*T+i*A)*L,t[6]=(g*b-d*k-m*x)*L,t[7]=(c*k-h*b+p*x)*L,t[8]=(o*E-s*T+u*M)*L,t[9]=(n*T-r*E-i*M)*L,t[10]=(d*w-v*b+m*y)*L,t[11]=(f*b-c*w-p*y)*L,t[12]=(s*A-o*S-l*M)*L,t[13]=(r*S-n*A+a*M)*L,t[14]=(v*x-d*_-g*y)*L,t[15]=(c*_-f*x+h*y)*L,t):null},ortho:function(t,e,r,n,a,i,o){var s=1/(e-r),l=1/(n-a),u=1/(i-o);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*s,t[13]=(a+n)*l,t[14]=(o+i)*u,t[15]=1,t}}})}),ra=(ea.vec3,ea.vec4),na=(ea.mat2,ea.mat3,ea.mat4),aa=function(t){function e(e){t.call(this,e,ta)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new jn(t)},e.prototype.queryRadius=function(t){var e=t;return Jn("circle-radius",this,e)+Jn("circle-stroke-width",this,e)+Kn(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,a,i,o){for(var s=Qn(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,i),l=this.paint.get("circle-radius").evaluate(e)+this.paint.get("circle-stroke-width").evaluate(e),u="map"===this.paint.get("circle-pitch-alignment"),c=u?s:function(t,e,r){return t.map(function(t){return t.map(function(t){return ia(t,e,r)})})}(s,o,a),f=u?l*i:l,h=0,p=r;ht.width||a.height>t.height||r.x>t.width-a.width||r.y>t.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||n.x>e.width-a.width||n.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=t.data,s=e.data,l=0;l80*r){n=i=t[0],a=o=t[1];for(var d=r;di&&(i=s),l>o&&(o=l);u=0!==(u=Math.max(i-n,o-a))?1/u:0}return ka(h,p,r,n,a,u),p}function _a(t,e,r,n,a){var i,o;if(a===Ua(t,e,r,n)>0)for(i=e;i=e;i-=n)o=Na(i,t[i],t[i+1],o);return o&&Da(o,o.next)&&(ja(o),o=o.next),o}function wa(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Da(n,n.next)&&0!==Oa(n.prev,n,n.next))n=n.next;else{if(ja(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function ka(t,e,r,n,a,i,o){if(t){!o&&i&&function(t,e,r,n){var a=t;do{null===a.z&&(a.z=La(a.x,a.y,e,r,n)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==t);a.prevZ.nextZ=null,a.prevZ=null,function(t){var e,r,n,a,i,o,s,l,u=1;do{for(r=t,t=null,i=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(a=r,r=r.nextZ,s--):(a=n,n=n.nextZ,l--),i?i.nextZ=a:t=a,a.prevZ=i,i=a;r=n}i.nextZ=null,u*=2}while(o>1)}(a)}(t,n,a,i);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,i?Aa(t,n,a,i):Ma(t))e.push(s.i/r),e.push(t.i/r),e.push(l.i/r),ja(t),t=l.next,u=l.next;else if((t=l)===u){o?1===o?ka(t=Ta(t,e,r),e,r,n,a,i,2):2===o&&Sa(t,e,r,n,a,i):ka(wa(t),e,r,n,a,i,1);break}}}function Ma(t){var e=t.prev,r=t,n=t.next;if(Oa(e,r,n)>=0)return!1;for(var a=t.next.next;a!==t.prev;){if(za(e.x,e.y,r.x,r.y,n.x,n.y,a.x,a.y)&&Oa(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function Aa(t,e,r,n){var a=t.prev,i=t,o=t.next;if(Oa(a,i,o)>=0)return!1;for(var s=a.xi.x?a.x>o.x?a.x:o.x:i.x>o.x?i.x:o.x,c=a.y>i.y?a.y>o.y?a.y:o.y:i.y>o.y?i.y:o.y,f=La(s,l,e,r,n),h=La(u,c,e,r,n),p=t.prevZ,d=t.nextZ;p&&p.z>=f&&d&&d.z<=h;){if(p!==t.prev&&p!==t.next&&za(a.x,a.y,i.x,i.y,o.x,o.y,p.x,p.y)&&Oa(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&za(a.x,a.y,i.x,i.y,o.x,o.y,d.x,d.y)&&Oa(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=f;){if(p!==t.prev&&p!==t.next&&za(a.x,a.y,i.x,i.y,o.x,o.y,p.x,p.y)&&Oa(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=h;){if(d!==t.prev&&d!==t.next&&za(a.x,a.y,i.x,i.y,o.x,o.y,d.x,d.y)&&Oa(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function Ta(t,e,r){var n=t;do{var a=n.prev,i=n.next.next;!Da(a,i)&&Ra(a,n,n.next,i)&&Ba(a,i)&&Ba(i,a)&&(e.push(a.i/r),e.push(n.i/r),e.push(i.i/r),ja(n),ja(n.next),n=t=i),n=n.next}while(n!==t);return n}function Sa(t,e,r,n,a,i){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Pa(o,s)){var l=Fa(o,s);return o=wa(o,o.next),l=wa(l,l.next),ka(o,e,r,n,a,i),void ka(l,e,r,n,a,i)}s=s.next}o=o.next}while(o!==t)}function Ea(t,e){return t.x-e.x}function Ca(t,e){if(e=function(t,e){var r,n=e,a=t.x,i=t.y,o=-1/0;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=a&&s>o){if(o=s,s===a){if(i===n.y)return n;if(i===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&a!==n.x&&za(ir.x)&&Ba(n,t)&&(r=n,h=l),n=n.next;return r}(t,e)){var r=Fa(e,t);wa(r,r.next)}}function La(t,e,r,n,a){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*a)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*a)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ia(t){var e=t,r=t;do{e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(i-s)-(a-o)*(n-s)>=0}function Pa(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Ra(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&Ba(t,e)&&Ba(e,t)&&function(t,e){var r=t,n=!1,a=(t.x+e.x)/2,i=(t.y+e.y)/2;do{r.y>i!=r.next.y>i&&r.next.y!==r.y&&a<(r.next.x-r.x)*(i-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)}function Oa(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Da(t,e){return t.x===e.x&&t.y===e.y}function Ra(t,e,r,n){return!!(Da(t,e)&&Da(r,n)||Da(t,n)&&Da(r,e))||Oa(t,e,r)>0!=Oa(t,e,n)>0&&Oa(r,n,t)>0!=Oa(r,n,e)>0}function Ba(t,e){return Oa(t.prev,t,t.next)<0?Oa(t,e,t.next)>=0&&Oa(t,t.prev,e)>=0:Oa(t,e,t.prev)<0||Oa(t,t.next,e)<0}function Fa(t,e){var r=new Va(t.i,t.x,t.y),n=new Va(e.i,e.x,e.y),a=t.next,i=e.prev;return t.next=e,e.prev=t,r.next=a,a.prev=r,n.next=r,r.prev=n,i.next=n,n.prev=i,n}function Na(t,e,r,n){var a=new Va(t,e,r);return n?(a.next=n.next,a.prev=n,n.next.prev=a,n.next=a):(a.prev=a,a.next=a),a}function ja(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Va(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ua(t,e,r,n){for(var a=0,i=e,o=r-n;i0&&(n+=t[a-1].length,r.holes.push(n))}return r},ya.default=xa;var qa=Ga,Ha=Ga;function Ga(t,e,r,n,a){!function t(e,r,n,a,i){for(;a>n;){if(a-n>600){var o=a-n+1,s=r-n+1,l=Math.log(o),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(o-u)/o)*(s-o/2<0?-1:1),f=Math.max(n,Math.floor(r-s*u/o+c)),h=Math.min(a,Math.floor(r+(o-s)*u/o+c));t(e,r,f,h,i)}var p=e[r],d=n,v=a;for(Wa(e,n,r),i(e[a],p)>0&&Wa(e,n,a);d0;)v--}0===i(e[n],p)?Wa(e,n,v):Wa(e,++v,a),v<=r&&(n=v+1),r<=v&&(a=v-1)}}(t,e,r||0,n||t.length-1,a||Ya)}function Wa(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Ya(t,e){return te?1:0}function Xa(t,e){var r=t.length;if(r<=1)return[t];for(var n,a,i=[],o=0;o1)for(var l=0;lDn)||t.y===e.y&&(t.y<0||t.y>Dn)}function ai(t){return t.every(function(t){return t.x<0})||t.every(function(t){return t.x>Dn})||t.every(function(t){return t.y<0})||t.every(function(t){return t.y>Dn})}ri.prototype.populate=function(t,e){for(var r=0,n=t;r=1){var v=f[p-1];if(!ni(d,v)){l.vertexLength+4>Tn.MAX_VERTEX_ARRAY_LENGTH&&(l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var g=d.sub(v)._perp()._unit(),m=v.dist(d);h+m>32768&&(h=0),ei(this.layoutVertexArray,d.x,d.y,g.x,g.y,0,0,h),ei(this.layoutVertexArray,d.x,d.y,g.x,g.y,0,1,h),h+=m,ei(this.layoutVertexArray,v.x,v.y,g.x,g.y,0,0,h),ei(this.layoutVertexArray,v.x,v.y,g.x,g.y,0,1,h);var y=l.vertexLength;this.indexArray.emplaceBack(y,y+1,y+2),this.indexArray.emplaceBack(y+1,y+2,y+3),l.vertexLength+=4,l.primitiveLength+=2}}}}l.vertexLength+i>Tn.MAX_VERTEX_ARRAY_LENGTH&&(l=this.segments.prepareSegment(i,this.layoutVertexArray,this.indexArray));for(var x=[],b=[],_=l.vertexLength,w=0,k=a;w>3}if(a--,1===n||2===n)i+=t.readSVarint(),o+=t.readSVarint(),1===n&&(e&&s.push(e),e=[]),e.push(new l(i,o));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&s.push(e),s},ui.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,a=0,i=0,o=1/0,s=-1/0,l=1/0,u=-1/0;t.pos>3}if(n--,1===r||2===r)(a+=t.readSVarint())s&&(s=a),(i+=t.readSVarint())u&&(u=i);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,u]},ui.prototype.toGeoJSON=function(t,e,r){var n,a,i=this.extent*Math.pow(2,r),o=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=ui.types[this.type];function c(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function vi(t,e,r){if(3===t){var n=new hi(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}pi.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new li(this._pbf,e,this.extent,this._keys,this._values)};var gi={VectorTile:function(t,e){this.layers=t.readFields(vi,{},e)},VectorTileFeature:li,VectorTileLayer:hi},mi=gi.VectorTileFeature.types,yi=63,xi=Math.cos(Math.PI/180*37.5),bi=.5,_i=Math.pow(2,14)/bi;function wi(t,e,r,n,a,i,o){t.emplaceBack(e.x,e.y,n?1:0,a?1:-1,Math.round(yi*r.x)+128,Math.round(yi*r.y)+128,1+(0===i?0:i<0?-1:1)|(o*bi&63)<<2,o*bi>>6)}var ki=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new Qr,this.indexArray=new fn,this.programConfigurations=new Pn(si,t.layers,t.zoom),this.segments=new Tn};function Mi(t,e){return(t/e.tileTotal*(e.end-e.start)+e.start)*(_i-1)}ki.prototype.populate=function(t,e){for(var r=0,n=t;r=2&&t[l-1].equals(t[l-2]);)l--;for(var u=0;uu){var E=p.dist(x);if(E>2*c){var C=p.sub(p.sub(x)._mult(c/E)._round());this.distance+=C.dist(x),this.addCurrentVertex(C,this.distance,_.mult(1),0,0,!1,h,o),x=C}}var L=x&&b,I=L?r:b?g:m;if(L&&"round"===I&&(Ta&&(I="bevel"),"bevel"===I&&(T>2&&(I="flipbevel"),T100)M=w.clone().mult(-1);else{var z=_.x*w.y-_.y*w.x>0?-1:1,P=T*_.add(w).mag()/_.sub(w).mag();M._perp()._mult(P*z)}this.addCurrentVertex(p,this.distance,M,0,0,!1,h,o),this.addCurrentVertex(p,this.distance,M.mult(-1),0,0,!1,h,o)}else if("bevel"===I||"fakeround"===I){var O=_.x*w.y-_.y*w.x>0,D=-Math.sqrt(T*T-1);if(O?(v=0,d=D):(d=0,v=D),y||this.addCurrentVertex(p,this.distance,_,d,v,!1,h,o),"fakeround"===I){for(var R=Math.floor(8*(.5-(A-.5))),B=void 0,F=0;F=0;N--)B=_.mult((N+1)/(R+1))._add(w)._unit(),this.addPieSliceVertex(p,this.distance,B,O,h,o)}b&&this.addCurrentVertex(p,this.distance,w,-d,-v,!1,h,o)}else"butt"===I?(y||this.addCurrentVertex(p,this.distance,_,0,0,!1,h,o),b&&this.addCurrentVertex(p,this.distance,w,0,0,!1,h,o)):"square"===I?(y||(this.addCurrentVertex(p,this.distance,_,1,1,!1,h,o),this.e1=this.e2=-1),b&&this.addCurrentVertex(p,this.distance,w,-1,-1,!1,h,o)):"round"===I&&(y||(this.addCurrentVertex(p,this.distance,_,0,0,!1,h,o),this.addCurrentVertex(p,this.distance,_,1,1,!0,h,o),this.e1=this.e2=-1),b&&(this.addCurrentVertex(p,this.distance,w,-1,-1,!0,h,o),this.addCurrentVertex(p,this.distance,w,0,0,!1,h,o)));if(S&&k2*c){var V=p.add(b.sub(p)._mult(c/j)._round());this.distance+=V.dist(p),this.addCurrentVertex(V,this.distance,w.mult(1),0,0,!1,h,o),p=V}}y=!1}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e)}},ki.prototype.addCurrentVertex=function(t,e,r,n,a,i,o,s){var l,u=this.layoutVertexArray,c=this.indexArray;s&&(e=Mi(e,s)),l=r.clone(),n&&l._sub(r.perp()._mult(n)),wi(u,t,l,i,!1,n,e),this.e3=o.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),o.primitiveLength++),this.e1=this.e2,this.e2=this.e3,l=r.mult(-1),a&&l._sub(r.perp()._mult(a)),wi(u,t,l,i,!0,-a,e),this.e3=o.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),o.primitiveLength++),this.e1=this.e2,this.e2=this.e3,e>_i/2&&!s&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,a,i,o))},ki.prototype.addPieSliceVertex=function(t,e,r,n,a,i){r=r.mult(n?-1:1);var o=this.layoutVertexArray,s=this.indexArray;i&&(e=Mi(e,i)),wi(o,t,r,!1,n,0,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(s.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),n?this.e2=this.e3:this.e1=this.e3},pr("LineBucket",ki,{omit:["layers"]});var Ai=new qr({"line-cap":new Nr(P.layout_line["line-cap"]),"line-join":new jr(P.layout_line["line-join"]),"line-miter-limit":new Nr(P.layout_line["line-miter-limit"]),"line-round-limit":new Nr(P.layout_line["line-round-limit"])}),Ti={paint:new qr({"line-opacity":new jr(P.paint_line["line-opacity"]),"line-color":new jr(P.paint_line["line-color"]),"line-translate":new Nr(P.paint_line["line-translate"]),"line-translate-anchor":new Nr(P.paint_line["line-translate-anchor"]),"line-width":new jr(P.paint_line["line-width"]),"line-gap-width":new jr(P.paint_line["line-gap-width"]),"line-offset":new jr(P.paint_line["line-offset"]),"line-blur":new jr(P.paint_line["line-blur"]),"line-dasharray":new Vr(P.paint_line["line-dasharray"]),"line-pattern":new Vr(P.paint_line["line-pattern"]),"line-gradient":new Ur(P.paint_line["line-gradient"])}),layout:Ai},Si=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new Lr(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n){return r=p({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n)},e}(jr))(Ti.paint.properties["line-width"].specification);Si.useIntegerZoom=!0;var Ei=function(t){function e(e){t.call(this,e,Ti)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setPaintProperty=function(e,r,n){t.prototype.setPaintProperty.call(this,e,r,n),"line-gradient"===e&&this._updateGradient()},e.prototype._updateGradient=function(){var t=this._transitionablePaint._values["line-gradient"].value.expression;this.gradient=pa(t,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e){t.prototype.recalculate.call(this,e),this.paint._values["line-floorwidth"]=Si.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new ki(t)},e.prototype.queryRadius=function(t){var e=t,r=Ci(Jn("line-width",this,e),Jn("line-gap-width",this,e)),n=Jn("line-offset",this,e);return r/2+Math.abs(n)+Kn(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,a,i){var o=Qn(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,i),s=i/2*Ci(this.paint.get("line-width").evaluate(e),this.paint.get("line-gap-width").evaluate(e)),u=this.paint.get("line-offset").evaluate(e);return u&&(r=function(t,e){for(var r=[],n=new l(0,0),a=0;a0?e+2*t:t}var Li=Xr([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}]),Ii=Xr([{name:"a_projected_pos",components:3,type:"Float32"}],4),zi=(Xr([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Xr([{name:"a_placed",components:2,type:"Uint8"}],4)),Pi=(Xr([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"radius"},{type:"Int16",name:"signedDistanceFromAnchor"}]),Xr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Oi=Xr([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);Xr([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"hidden"}]),Xr([{type:"Float32",name:"offsetX"}]),Xr([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);function Di(t,e,r){var n=e.layout.get("text-transform").evaluate(r);return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Cr.applyArabicShaping&&(t=Cr.applyArabicShaping(t)),t}var Ri={"!":"\ufe15","#":"\uff03",$:"\uff04","%":"\uff05","&":"\uff06","(":"\ufe35",")":"\ufe36","*":"\uff0a","+":"\uff0b",",":"\ufe10","-":"\ufe32",".":"\u30fb","/":"\uff0f",":":"\ufe13",";":"\ufe14","<":"\ufe3f","=":"\uff1d",">":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"};var Bi=function(t){function e(e,r,n,a){t.call(this,e,r),this.angle=n,void 0!==a&&(this.segment=a)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(l);function Fi(t,e){var r=e.expression;if("constant"===r.kind)return{functionType:"constant",layoutSize:r.evaluate(new Lr(t+1))};if("source"===r.kind)return{functionType:"source"};for(var n=r.zoomStops,a=0;a0)&&("constant"!==a.value.kind||a.value.value.length>0),l="constant"!==o.value.kind||o.value.value&&o.value.value.length>0;if(this.features=[],s||l){for(var u=e.iconDependencies,c=e.glyphDependencies,f=new Lr(this.zoom),h=0,p=t;h=0;s--)i[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:a},s>0&&(a+=e[s-1].dist(e[s]));for(var l=0;l0;this.addCollisionDebugVertices(s,l,u,c,f?this.collisionCircle:this.collisionBox,o.anchorPoint,r,f)}}}},Gi.prototype.deserializeCollisionBoxes=function(t,e,r,n,a){for(var i={},o=e;o0},Gi.prototype.hasIconData=function(){return this.icon.segments.get().length>0},Gi.prototype.hasCollisionBoxData=function(){return this.collisionBox.segments.get().length>0},Gi.prototype.hasCollisionCircleData=function(){return this.collisionCircle.segments.get().length>0},Gi.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&(this.sortedAngle=t,!(this.text.segments.get().length>1||this.icon.segments.get().length>1))){for(var r=[],n=0;na.maxh||t>a.maxw||r<=a.maxh&&t<=a.maxw&&(o=a.maxw*a.maxh-t*r)i.free)){if(r===i.h)return this.allocShelf(s,t,r,n);r>i.h||rc)&&(f=2*Math.max(t,c)),(ll)&&(u=2*Math.max(r,l)),this.resize(f,u),this.packOne(t,r,n)):null},t.prototype.allocFreebin=function(t,e,r,n){var a=this.freebins.splice(t,1)[0];return a.id=n,a.w=e,a.h=r,a.refcount=0,this.bins[n]=a,this.ref(a),a},t.prototype.allocShelf=function(t,e,r,n){var a=this.shelves[t].alloc(e,r,n);return this.bins[n]=a,this.ref(a),a},t.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,e=0,r=0;rthis.free||e>this.h)return null;var n=this.x;return this.x+=t,this.free-=t,new function(t,e,r,n,a,i,o){this.id=t,this.x=e,this.y=r,this.w=n,this.h=a,this.maxw=i||n,this.maxh=o||a,this.refcount=0}(r,n,this.y,t,e,t,this.h)},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t}()}),to=function(t,e){var r=e.pixelRatio;this.paddedRect=t,this.pixelRatio=r},eo={tl:{configurable:!0},br:{configurable:!0},displaySize:{configurable:!0}};eo.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},eo.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},eo.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(to.prototype,eo);var ro=function(t){var e=new fa({width:0,height:0}),r={},n=new Qi(0,0,{autoResize:!0});for(var a in t){var i=t[a],o=n.packOne(i.data.width+2,i.data.height+2);e.resize({width:n.w,height:n.h}),fa.copy(i.data,e,{x:0,y:0},{x:o.x+1,y:o.y+1},i.data),r[a]=new to(o,i)}n.shrink(),e.resize({width:n.w,height:n.h}),this.image=e,this.positions=r};pr("ImagePosition",to),pr("ImageAtlas",ro);var no=function(t,e,r,n,a){var i,o,s=8*a-n-1,l=(1<>1,c=-7,f=r?a-1:0,h=r?-1:1,p=t[e+f];for(f+=h,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=256*i+t[e+f],f+=h,c-=8);for(o=i&(1<<-c)-1,i>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=h,c-=8);if(0===i)i=1-u;else{if(i===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),i-=u}return(p?-1:1)*o*Math.pow(2,i-n)},ao=function(t,e,r,n,a,i){var o,s,l,u=8*i-a-1,c=(1<>1,h=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,v=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+f>=1?h/l:h*Math.pow(2,1-f))*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(e*l-1)*Math.pow(2,a),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;t[r+p]=255&s,p+=d,s/=256,a-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,u-=8);t[r+p-d]|=128*v},io=oo;function oo(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}oo.Varint=0,oo.Fixed64=1,oo.Bytes=2,oo.Fixed32=5;function so(t){return t.type===oo.Bytes?t.readVarint()+t.pos:t.pos+1}function lo(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function uo(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var a=r.pos-1;a>=t;a--)r.buf[a+n]=r.buf[a]}function co(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function wo(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}oo.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,i=this.pos;this.type=7&n,t(a,e,this),this.pos===i&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=bo(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=wo(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=bo(this.buf,this.pos)+4294967296*bo(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=bo(this.buf,this.pos)+4294967296*wo(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=no(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=no(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,a,i=r.buf;if(a=i[r.pos++],n=(112&a)>>4,a<128)return lo(t,n,e);if(a=i[r.pos++],n|=(127&a)<<3,a<128)return lo(t,n,e);if(a=i[r.pos++],n|=(127&a)<<10,a<128)return lo(t,n,e);if(a=i[r.pos++],n|=(127&a)<<17,a<128)return lo(t,n,e);if(a=i[r.pos++],n|=(127&a)<<24,a<128)return lo(t,n,e);if(a=i[r.pos++],n|=(1&a)<<31,a<128)return lo(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,r){var n="",a=e;for(;a239?4:l>223?3:l>191?2:1;if(a+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(i=t[a+1]))&&(u=(31&l)<<6|63&i)<=127&&(u=null):3===c?(i=t[a+1],o=t[a+2],128==(192&i)&&128==(192&o)&&((u=(15&l)<<12|(63&i)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(i=t[a+1],o=t[a+2],s=t[a+3],128==(192&i)&&128==(192&o)&&128==(192&s)&&((u=(15&l)<<18|(63&i)<<12|(63&o)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),a+=c}return n}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var r=so(this);for(t=t||[];this.pos127;);else if(e===oo.Bytes)this.pos=this.readVarint()+this.pos;else if(e===oo.Fixed32)this.pos+=4;else{if(e!==oo.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;if(e.buf[e.pos++]|=r|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;e.buf[e.pos++]=127&t}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,a,i=0;i55295&&n<57344){if(!a){n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else a&&(t[r++]=239,t[r++]=191,t[r++]=189,a=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&uo(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),ao(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),ao(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&uo(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,oo.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,co,e)},writePackedSVarint:function(t,e){this.writeMessage(t,fo,e)},writePackedBoolean:function(t,e){this.writeMessage(t,vo,e)},writePackedFloat:function(t,e){this.writeMessage(t,ho,e)},writePackedDouble:function(t,e){this.writeMessage(t,po,e)},writePackedFixed32:function(t,e){this.writeMessage(t,go,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,mo,e)},writePackedFixed64:function(t,e){this.writeMessage(t,yo,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,xo,e)},writeBytesField:function(t,e){this.writeTag(t,oo.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,oo.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,oo.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,oo.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,oo.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,oo.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,oo.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,oo.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,oo.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,oo.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var ko=3;function Mo(t,e,r){1===t&&r.readMessage(Ao,e)}function Ao(t,e,r){if(3===t){var n=r.readMessage(To,{}),a=n.id,i=n.bitmap,o=n.width,s=n.height,l=n.left,u=n.top,c=n.advance;e.push({id:a,bitmap:new ca({width:o+2*ko,height:s+2*ko},i),metrics:{width:o,height:s,left:l,top:u,advance:c}})}}function To(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}var So=ko,Eo=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.callbackID=0,v(["receive"],this),this.target.addEventListener("message",this.receive,!1)};Eo.prototype.send=function(t,e,r,n){var a=r?this.mapId+":"+this.callbackID++:null;r&&(this.callbacks[a]=r);var i=[];this.target.postMessage({targetMapId:n,sourceMapId:this.mapId,type:t,id:String(a),data:vr(e,i)},i)},Eo.prototype.receive=function(t){var e,r=this,n=t.data,a=n.id;if(!n.targetMapId||this.mapId===n.targetMapId){var i=function(t,e){var n=[];r.target.postMessage({sourceMapId:r.mapId,type:"",id:String(a),error:t?vr(t):null,data:vr(e,n)},n)};if(""===n.type)e=this.callbacks[n.id],delete this.callbacks[n.id],e&&n.error?e(gr(n.error)):e&&e(null,gr(n.data));else if(void 0!==n.id&&this.parent[n.type])this.parent[n.type](n.sourceMapId,gr(n.data),i);else if(void 0!==n.id&&this.parent.getWorkerSource){var o=n.type.split(".");this.parent.getWorkerSource(n.sourceMapId,o[0],o[1])[o[2]](gr(n.data),i)}else this.parent[n.type](gr(n.data))}},Eo.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)};var Co=n(a(function(t,e){!function(t){function e(t,e,n){e=Math.pow(2,n)-e-1;var a=r(256*t,256*e,n),i=r(256*(t+1),256*(e+1),n);return a[0]+","+a[1]+","+i[0]+","+i[1]}function r(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),a=t*n-2*Math.PI*6378137/2,i=e*n-2*Math.PI*6378137/2;return[a,i]}t.getURL=function(t,r,n,a,i,o){return o=o||{},t+"?"+["bbox="+e(n,a,i),"format="+(o.format||"image/png"),"service="+(o.service||"WMS"),"version="+(o.version||"1.1.1"),"request="+(o.request||"GetMap"),"srs="+(o.srs||"EPSG:3857"),"width="+(o.width||256),"height="+(o.height||256),"layers="+r].join("&")},t.getTileBBox=e,t.getMercCoords=r,Object.defineProperty(t,"__esModule",{value:!0})}(e)})),Lo=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=Po(0,t,e,r)};Lo.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Lo.prototype.url=function(t,e){var r=Co.getTileBBox(this.x,this.y,this.z),n=function(t,e,r){for(var n,a="",i=t;i>0;i--)a+=(e&(n=1<this.canonical.z?new zo(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new zo(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},zo.prototype.isChildOf=function(t){var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},zo.prototype.children=function(t){if(this.overscaledZ>=t)return[new zo(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new zo(e,this.wrap,e,r,n),new zo(e,this.wrap,e,r+1,n),new zo(e,this.wrap,e,r,n+1),new zo(e,this.wrap,e,r+1,n+1)]},zo.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+this.border||e<-this.border||e>=this.dim+this.border)throw new RangeError("out of range source coordinates for DEM data");return(e+this.border)*this.stride+(t+this.border)},pr("Level",Oo);var Do=function(t,e,r){this.uid=t,this.scale=e||1,this.level=r||new Oo(256,512),this.loaded=!!r};Do.prototype.loadFromImage=function(t,e){if(t.height!==t.width)throw new RangeError("DEM tiles must be square");if(e&&"mapbox"!==e&&"terrarium"!==e)return _('"'+e+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');var r=this.level=new Oo(t.width,t.width/2),n=t.data;this._unpackData(r,n,e||"mapbox");for(var a=0;a=0&&l[3]>=0&&this.grid.insert(i,l[0],l[1],l[2],l[3])}},No.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new gi.VectorTile(new io(this.rawTileData)).layers,this.sourceLayerCoder=new Ro(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},No.prototype.query=function(t,e){var r=this;this.loadVTLayers();for(var n=t.params||{},a=Dn/t.tileSize/t.scale,i=Re(n.filter),o=t.queryGeometry,s=t.queryPadding*a,l=1/0,u=1/0,c=-1/0,f=-1/0,h=0;h=0)return!0;return!1}(i,l)){var u=this.sourceLayerCoder.decode(r),c=this.vtLayers[u].feature(n);if(a(new Lr(this.tileID.overscaledZ),c))for(var f=0;f=200&&r.status<300&&r.response){var n;try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n)}else 401===r.status&&t.url.match(/mapbox.com/)?e(new A(r.statusText+": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens",r.status,t.url)):e(new A(r.statusText,r.status,t.url))},r.send(),r},t.getImage=function(t,e){return S(t,function(t,r){if(t)e(t);else if(r){var n=new self.Image,a=self.URL||self.webkitURL;n.onload=function(){e(null,n),a.revokeObjectURL(n.src)};var i=new self.Blob([new Uint8Array(r.data)],{type:"image/png"});n.cacheControl=r.cacheControl,n.expires=r.expires,n.src=r.data.byteLength?a.createObjectURL(i):"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="}})},t.ResourceType=M,t.RGBAImage=fa,t.default$2=Qi,t.ImagePosition=to,t.getArrayBuffer=S,t.default$3=function(t){return new io(t).readFields(Mo,[])},t.default$4=yr,t.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,a=new Array(t.length),i=null;t.forEach(function(t,o){e(t,function(t,e){t&&(i=t),a[o]=e,0==--n&&r(i,a)})})},t.AlphaImage=ca,t.default$5=P,t.endsWith=g,t.extend=p,t.sphericalToCartesian=function(t){var e=t[0],r=t[1],n=t[2];return r+=90,r*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n)}},t.Evented=z,t.validateStyle=nr,t.validateLight=ar,t.emitValidationErrors=sr,t.default$6=tt,t.number=wt,t.Properties=qr,t.Transitionable=Pr,t.Transitioning=Dr,t.PossiblyEvaluated=Fr,t.DataConstantProperty=Nr,t.warnOnce=_,t.uniqueId=function(){return d++},t.default$7=Eo,t.pick=function(t,e){for(var r={},n=0;n@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(t,r,n,a){var i=n||a;return e[r]=!i||i.toLowerCase(),""}),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e},t.default$11=No,t.default$12=Bo,t.default$13=Re,t.default$14=Gi,t.CollisionBoxArray=gn,t.default$15=Tn,t.TriangleIndexArray=fn,t.default$16=Lr,t.default$17=s,t.keysDifference=function(t,e){var r=[];for(var n in t)n in e||r.push(n);return r},t.default$18=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.mat4=na,t.vec4=ra,t.getSizeData=Fi,t.evaluateSizeForFeature=function(t,e,r){var n=e;return"source"===t.functionType?r.lowerSize/10:"composite"===t.functionType?wt(r.lowerSize/10,r.upperSize/10,n.uSizeT):n.uSize},t.evaluateSizeForZoom=function(t,e,r){if("constant"===t.functionType)return{uSizeT:0,uSize:t.layoutSize};if("source"===t.functionType)return{uSizeT:0,uSize:0};if("camera"===t.functionType){var n=t.propertyValue,a=t.zoomRange,i=t.sizeRange,o=h(Se(n,r.specification).interpolationFactor(e,a.min,a.max),0,1);return{uSizeT:0,uSize:i.min+o*(i.max-i.min)}}var s=t.propertyValue,l=t.zoomRange;return{uSizeT:h(Se(s,r.specification).interpolationFactor(e,l.min,l.max),0,1),uSize:0}},t.addDynamicAttributes=Ui,t.default$19=Yi,t.WritingMode=Vo,t.multiPolygonIntersectsBufferedPoint=Vn,t.multiPolygonIntersectsMultiPolygon=Un,t.multiPolygonIntersectsBufferedMultiLine=qn,t.polygonIntersectsPolygon=function(t,e){for(var r=0;r-r/2;){if(--o<0)return!1;s-=t[o].dist(i),i=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],u=0;sn;)u-=l.shift().angleDelta;if(u>a)return!1;o++,s+=f.dist(h)}return!0}function i(e,r,n,i,o,s,l,u,c){var f=i?.6*s*l:0,h=Math.max(i?i.right-i.left:0,o?o.right-o.left:0),p=0===e[0].x||e[0].x===c||0===e[0].y||e[0].y===c;return r-h*l=0&&M=0&&A=0&&g+h<=p){var T=new t.default$25(M,A,w,y);T._round(),o&&!a(r,T,l,o,s)||m.push(T)}}v+=_}c||m.length||u||(m=e(r,v/2,i,o,s,l,u,!0,f));return m}(e,p?r/2*u%r:(h/2+2*s)*l*u%r,r,f,n,h*l,p,!1,c)}n.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},n.prototype.update=function(e,n){for(var a=this,i=0,o=e;i0&&(v=Math.max(10*s,v),this._addLineCollisionCircles(t,e,r,r.segment,g,v,n,a,i,c))}else t.emplaceBack(r.x,r.y,p,f,d,h,n,a,i,0,0);this.boxEndIndex=t.length};s.prototype._addLineCollisionCircles=function(t,e,r,n,a,i,o,s,l,u){var c=i/2,f=Math.floor(a/c),h=1+.4*Math.log(u)/Math.LN2,p=Math.floor(f*h/2),d=-i/2,v=r,g=n+1,m=d,y=-a/2,x=y-a/4;do{if(--g<0){if(m>y)return;g=0;break}m-=e[g].dist(v),v=e[g]}while(m>x);for(var b=e[g].dist(e[g+1]),_=-p;_a&&(k+=w-a),!(k=e.length)return;b=e[g].dist(e[g+1])}var M=k-m,A=e[g],T=e[g+1].sub(A)._unit()._mult(M)._add(A)._round(),S=Math.abs(k-d)0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)}function f(t,e){return te?1:0}function h(e,r,n){void 0===r&&(r=1),void 0===n&&(n=!1);for(var a=1/0,i=1/0,o=-1/0,s=-1/0,u=e[0],c=0;co)&&(o=f.x),(!c||f.y>s)&&(s=f.y)}var h=o-a,v=s-i,g=Math.min(h,v),m=g/2,y=new l(null,p);if(0===g)return new t.default$1(a,i);for(var x=a;x_.d||!_.d)&&(_=k,n&&console.log("found best %d after %d probes",Math.round(1e4*k.d)/1e4,w)),k.max-_.d<=r||(m=k.h/2,y.push(new d(k.p.x-m,k.p.y-m,m,e)),y.push(new d(k.p.x+m,k.p.y-m,m,e)),y.push(new d(k.p.x-m,k.p.y+m,m,e)),y.push(new d(k.p.x+m,k.p.y+m,m,e)),w+=4)}return n&&(console.log("num probes: "+w),console.log("best distance: "+_.d)),_.p}function p(t,e){return e.max-t.max}function d(e,r,n,a){this.p=new t.default$1(e,r),this.h=n,this.d=function(e,r){for(var n=!1,a=1/0,i=0;ie.y!=f.y>e.y&&e.x<(f.x-c.x)*(e.y-c.y)/(f.y-c.y)+c.x&&(n=!n),a=Math.min(a,t.distToSegmentSquared(e,c,f))}return(n?1:-1)*Math.sqrt(a)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}function v(e,r,n,a,i,o){e.createArrays(),e.symbolInstances=[];var s=512*e.overscaling;e.tilePixelRatio=t.default$8/s,e.compareText={},e.iconsNeedLinear=!1;var l=e.layers[0].layout,u=e.layers[0]._unevaluatedLayout._values,c={};if("composite"===e.textSizeData.functionType){var f=e.textSizeData.zoomRange,h=f.min,p=f.max;c.compositeTextSizes=[u["text-size"].possiblyEvaluate(new t.default$16(h)),u["text-size"].possiblyEvaluate(new t.default$16(p))]}if("composite"===e.iconSizeData.functionType){var d=e.iconSizeData.zoomRange,v=d.min,m=d.max;c.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new t.default$16(v)),u["icon-size"].possiblyEvaluate(new t.default$16(m))]}c.layoutTextSize=u["text-size"].possiblyEvaluate(new t.default$16(e.zoom+1)),c.layoutIconSize=u["icon-size"].possiblyEvaluate(new t.default$16(e.zoom+1)),c.textMaxSize=u["text-size"].possiblyEvaluate(new t.default$16(18));for(var y=24*l.get("text-line-height"),x="map"===l.get("text-rotation-alignment")&&"line"===l.get("symbol-placement"),b=l.get("text-keep-upright"),_=0,w=e.features;_=t.default$8||c.y<0||c.y>=t.default$8||e.symbolInstances.push(function(e,r,n,a,i,l,u,c,f,h,p,d,v,g,y,x,b,_,w,k,M){var A,T,S=e.addToLineVertexArray(r,n),E=0,C=0,L=0,I=a.horizontal?a.horizontal.text:"",z=[];a.horizontal&&(A=new s(u,n,r,c,f,h,a.horizontal,p,d,v,e.overscaling),C+=m(e,r,a.horizontal,l,v,w,g,S,a.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,z,k,M),a.vertical&&(L+=m(e,r,a.vertical,l,v,w,g,S,t.WritingMode.vertical,z,k,M)));var P=A?A.boxStartIndex:e.collisionBoxArray.length,O=A?A.boxEndIndex:e.collisionBoxArray.length;if(i){var D=function(e,r,n,a,i,o){var s,l,u,c,f=r.image,h=n.layout,p=r.top-1/f.pixelRatio,d=r.left-1/f.pixelRatio,v=r.bottom+1/f.pixelRatio,g=r.right+1/f.pixelRatio;if("none"!==h.get("icon-text-fit")&&i){var m=g-d,y=v-p,x=h.get("text-size").evaluate(o)/24,b=i.left*x,_=i.right*x,w=i.top*x,k=_-b,M=i.bottom*x-w,A=h.get("icon-text-fit-padding")[0],T=h.get("icon-text-fit-padding")[1],S=h.get("icon-text-fit-padding")[2],E=h.get("icon-text-fit-padding")[3],C="width"===h.get("icon-text-fit")?.5*(M-y):0,L="height"===h.get("icon-text-fit")?.5*(k-m):0,I="width"===h.get("icon-text-fit")||"both"===h.get("icon-text-fit")?k:m,z="height"===h.get("icon-text-fit")||"both"===h.get("icon-text-fit")?M:y;s=new t.default$1(b+L-E,w+C-A),l=new t.default$1(b+L+T+I,w+C-A),u=new t.default$1(b+L+T+I,w+C+S+z),c=new t.default$1(b+L-E,w+C+S+z)}else s=new t.default$1(d,p),l=new t.default$1(g,p),u=new t.default$1(g,v),c=new t.default$1(d,v);var P=n.layout.get("icon-rotate").evaluate(o)*Math.PI/180;if(P){var O=Math.sin(P),D=Math.cos(P),R=[D,-O,O,D];s._matMult(R),l._matMult(R),c._matMult(R),u._matMult(R)}return[{tl:s,tr:l,bl:c,br:u,tex:f.paddedRect,writingMode:void 0,glyphOffset:[0,0]}]}(0,i,l,0,a.horizontal,w);T=new s(u,n,r,c,f,h,i,y,x,!1,e.overscaling),E=4*D.length;var R=e.iconSizeData,B=null;"source"===R.functionType?B=[10*l.layout.get("icon-size").evaluate(w)]:"composite"===R.functionType&&(B=[10*M.compositeIconSizes[0].evaluate(w),10*M.compositeIconSizes[1].evaluate(w)]),e.addSymbols(e.icon,D,B,_,b,w,!1,r,S.lineStartIndex,S.lineLength)}var F=T?T.boxStartIndex:e.collisionBoxArray.length,N=T?T.boxEndIndex:e.collisionBoxArray.length;e.glyphOffsetArray.length>=t.default$14.MAX_GLYPHS&&t.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907");var j=new o,V=new o;return{key:I,textBoxStartIndex:P,textBoxEndIndex:O,iconBoxStartIndex:F,iconBoxEndIndex:N,textOffset:g,iconOffset:_,anchor:r,line:n,featureIndex:c,feature:w,numGlyphVertices:C,numVerticalGlyphVertices:L,numIconVertices:E,textOpacityState:j,iconOpacityState:V,isDuplicate:!1,placedTextSymbolIndices:z,crossTileID:0}}(e,c,i,n,a,e.layers[0],e.collisionBoxArray,r.index,r.sourceLayerIndex,e.index,b,M,S,v,w,A,E,g,r,l,u))};if("line"===d.get("symbol-placement"))for(var I=0,z=function(e,r,n,a,i){for(var o=[],s=0;s=a&&h.x>=a||(f.x>=a?f=new t.default$1(a,f.y+(h.y-f.y)*((a-f.x)/(h.x-f.x)))._round():h.x>=a&&(h=new t.default$1(a,f.y+(h.y-f.y)*((a-f.x)/(h.x-f.x)))._round()),f.y>=i&&h.y>=i||(f.y>=i?f=new t.default$1(f.x+(h.x-f.x)*((i-f.y)/(h.y-f.y)),i)._round():h.y>=i&&(h=new t.default$1(f.x+(h.x-f.x)*((i-f.y)/(h.y-f.y)),i)._round()),u&&f.equals(u[u.length-1])||(u=[f],o.push(u)),u.push(h)))))}return o}(r.geometry,0,0,t.default$8,t.default$8);I=0;o--)if(n.dist(i[o])0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var a=t-1>>1,i=e[a];if(r(n,i)>=0)break;e[t]=i,t=a}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length>>1,a=e[t];t=0)break;e[t]=s,t=i}e[t]=a}},l.default=u;var x=function(e){var r=new t.AlphaImage({width:0,height:0}),n={},a=new t.default$2(0,0,{autoResize:!0});for(var i in e){var o=e[i],s=n[i]={};for(var l in o){var u=o[+l];if(u&&0!==u.bitmap.width&&0!==u.bitmap.height){var c=a.packOne(u.bitmap.width+2,u.bitmap.height+2);r.resize({width:a.w,height:a.h}),t.AlphaImage.copy(u.bitmap,r,{x:0,y:0},{x:c.x+1,y:c.y+1},u.bitmap),s[l]={rect:c,metrics:u.metrics}}}}a.shrink(),r.resize({width:a.w,height:a.h}),this.image=r,this.positions=n};t.register("GlyphAtlas",x);var b=function(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming};function _(e,r){for(var n=new t.default$16(r),a=0,i=e;a=T.maxzoom))if("none"!==T.visibility)_(A,i.zoom),(f[T.id]=T.createBucket({index:s.bucketLayerIDs.length,layers:A,zoom:i.zoom,pixelRatio:i.pixelRatio,overscaling:i.overscaling,collisionBoxArray:i.collisionBoxArray,sourceLayerIndex:m})).populate(y,h),s.bucketLayerIDs.push(A.map(function(t){return t.id}))}}}var S=t.mapObject(h.glyphDependencies,function(t){return Object.keys(t).map(Number)});Object.keys(S).length?n.send("getGlyphs",{uid:this.uid,stacks:S},function(t,e){l||(l=t,u=e,C.call(i))}):u={};var E=Object.keys(h.iconDependencies);function C(){if(l)return a(l);if(u&&c){var e=new x(u),r=new t.default$28(c);for(var n in f){var i=f[n];i instanceof t.default$14&&(_(i.layers,this.zoom),v(i,u,e.positions,c,r.positions,this.showCollisionBoxes))}this.status="done",a(null,{buckets:t.values(f).filter(function(t){return!t.isEmpty()}),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,iconAtlasImage:r.image})}}E.length?n.send("getImages",{icons:E},function(t,e){l||(l=t,c=e,C.call(i))}):c={},C.call(this)};var w=function(t){return!(!performance||!performance.getEntriesByName)&&performance.getEntriesByName(t)};function k(e,r){var n=t.getArrayBuffer(e.request,function(e,n){e?r(e):n&&r(null,{vectorTile:new t.default$29.VectorTile(new t.default$30(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires})});return function(){n.abort(),r()}}var M=function(t,e,r){this.actor=t,this.layerIndex=e,this.loadVectorData=r||k,this.loading={},this.loaded={}};M.prototype.loadTile=function(e,r){var n=this,a=e.uid;this.loading||(this.loading={});var i=this.loading[a]=new b(e);i.abort=this.loadVectorData(e,function(o,s){if(delete n.loading[a],o||!s)return r(o);var l=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl);var c={};if(e.request&&e.request.collectResourceTiming){var f=w(e.request.url);f&&(c.resourceTiming=JSON.parse(JSON.stringify(f)))}i.vectorTile=s.vectorTile,i.parse(s.vectorTile,n.layerIndex,n.actor,function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:l.slice(0)},n,u,c))}),n.loaded=n.loaded||{},n.loaded[a]=i})},M.prototype.reloadTile=function(t,e){var r=this.loaded,n=t.uid,a=this;if(r&&r[n]){var i=r[n];i.showCollisionBoxes=t.showCollisionBoxes;var o=function(t,r){var n=i.reloadCallback;n&&(delete i.reloadCallback,i.parse(i.vectorTile,a.layerIndex,a.actor,n)),e(t,r)};"parsing"===i.status?i.reloadCallback=o:"done"===i.status&&i.parse(i.vectorTile,this.layerIndex,this.actor,o)}},M.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},M.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var A=function(){this.loading={},this.loaded={}};A.prototype.loadTile=function(e,r){var n=e.uid,a=e.encoding,i=new t.default$31(n);this.loading[n]=i,i.loadFromImage(e.rawImageData,a),delete this.loading[n],this.loaded=this.loaded||{},this.loaded[n]=i,r(null,i)},A.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var T={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142};function S(t){var e=0;if(t&&t.length>0){e+=Math.abs(E(t[0]));for(var r=1;r2){for(o=0;o=0}(t)===e?t:t.reverse()}var D=t.default$29.VectorTileFeature.prototype.toGeoJSON,R=function(e){this._feature=e,this.extent=t.default$8,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};R.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r>31}function K(t,e){for(var r=t.loadGeometry(),n=t.type,a=0,i=0,o=r.length,s=0;sa;){if(i-a>600){var s=i-a+1,l=n-a+1,u=Math.log(s),c=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1),h=Math.max(a,Math.floor(n-l*c/s+f)),p=Math.min(i,Math.floor(n+(s-l)*c/s+f));t(e,r,n,h,p,o)}var d=r[2*n+o],v=a,g=i;for(et(e,r,a,n),r[2*i+o]>d&&et(e,r,a,i);vd;)g--}r[2*a+o]===d?et(e,r,a,g):et(e,r,++g,i),g<=n&&(a=g+1),n<=g&&(i=g-1)}}(e,r,s,a,i,o%2);t(e,r,n,a,s-1,o+1);t(e,r,n,s+1,i,o+1)};function et(t,e,r,n){rt(t,r,n),rt(e,2*r,2*n),rt(e,2*r+1,2*n+1)}function rt(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}var nt=function(t,e,r,n,a,i,o){var s,l,u=[0,t.length-1,0],c=[];for(;u.length;){var f=u.pop(),h=u.pop(),p=u.pop();if(h-p<=o)for(var d=p;d<=h;d++)s=e[2*d],l=e[2*d+1],s>=r&&s<=a&&l>=n&&l<=i&&c.push(t[d]);else{var v=Math.floor((p+h)/2);s=e[2*v],l=e[2*v+1],s>=r&&s<=a&&l>=n&&l<=i&&c.push(t[v]);var g=(f+1)%2;(0===f?r<=s:n<=l)&&(u.push(p),u.push(v-1),u.push(g)),(0===f?a>=s:i>=l)&&(u.push(v+1),u.push(h),u.push(g))}}return c};var at=function(t,e,r,n,a,i){var o=[0,t.length-1,0],s=[],l=a*a;for(;o.length;){var u=o.pop(),c=o.pop(),f=o.pop();if(c-f<=i)for(var h=f;h<=c;h++)it(e[2*h],e[2*h+1],r,n)<=l&&s.push(t[h]);else{var p=Math.floor((f+c)/2),d=e[2*p],v=e[2*p+1];it(d,v,r,n)<=l&&s.push(t[p]);var g=(u+1)%2;(0===u?r-a<=d:n-a<=v)&&(o.push(f),o.push(p-1),o.push(g)),(0===u?r+a>=d:n+a>=v)&&(o.push(p+1),o.push(c),o.push(g))}}return s};function it(t,e,r,n){var a=t-r,i=e-n;return a*a+i*i}var ot=function(t,e,r,n,a){return new st(t,e,r,n,a)};function st(t,e,r,n,a){e=e||lt,r=r||ut,a=a||Array,this.nodeSize=n||64,this.points=t,this.ids=new a(t.length),this.coords=new a(2*t.length);for(var i=0;i=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return yt(yt({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function gt(t){return t/360+.5}function mt(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function yt(t,e){for(var r in e)t[r]=e[r];return t}function xt(t){return t.x}function bt(t){return t.y}function _t(t,e,r,n,a,i){var o=a-r,s=i-n;if(0!==o||0!==s){var l=((t-r)*o+(e-n)*s)/(o*o+s*s);l>1?(r=a,n=i):l>0&&(r+=o*l,n+=s*l)}return(o=t-r)*o+(s=e-n)*s}function wt(t,e,r,n){var a={id:t||null,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)kt(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n0&&(o+=n?(a*u-l*i)/2:Math.sqrt(Math.pow(l-a,2)+Math.pow(u-i,2))),a=l,i=u}var c=e.length-3;e[2]=1,function t(e,r,n,a){for(var i,o=a,s=e[r],l=e[r+1],u=e[n],c=e[n+1],f=r+3;fo&&(i=f,o=h)}o>a&&(i-r>3&&t(e,r,i,a),e[i+2]=o,n-i>3&&t(e,i,n,a))}(e,0,c,r),e[c+2]=1,e.size=Math.abs(o),e.start=0,e.end=e.size}function St(t,e,r,n){for(var a=0;a1?1:r}function Lt(t,e,r,n,a,i,o,s){if(n/=e,i>=(r/=e)&&o<=n)return t;if(i>n||o=r&&d<=n)l.push(c);else if(!(p>n||d=r&&o<=n&&(e.push(t[i]),e.push(t[i+1]),e.push(t[i+2]))}}function zt(t,e,r,n,a,i,o){for(var s,l,u=Pt(t),c=0===a?Rt:Bt,f=t.start,h=0;h=r&&(l=c(u,p,d,g,m,r),o&&(u.start=f+s*l)):y>n?x<=n&&(l=c(u,p,d,g,m,n),o&&(u.start=f+s*l)):Dt(u,p,d,v),x=r&&(l=c(u,p,d,g,m,r),b=!0),x>n&&y<=n&&(l=c(u,p,d,g,m,n),b=!0),!i&&b&&(o&&(u.end=f+s*l),e.push(u),u=Pt(t)),o&&(f+=s)}var _=t.length-3;p=t[_],d=t[_+1],v=t[_+2],(y=0===a?p:d)>=r&&y<=n&&Dt(u,p,d,v),_=u.length-3,i&&_>=3&&(u[_]!==u[0]||u[_+1]!==u[1])&&Dt(u,u[0],u[1],u[2]),u.length&&e.push(u)}function Pt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Ot(t,e,r,n,a,i){for(var o=0;oo.maxX&&(o.maxX=c),f>o.maxY&&(o.maxY=f)}return o}function qt(t,e,r,n){var a=e.geometry,i=e.type,o=[];if("Point"===i||"MultiPoint"===i)for(var s=0;s0&&e.size<(a?o:n))r.numPoints+=e.length/3;else{for(var s=[],l=0;lo)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;a&&function(t,e){for(var r=0,n=0,a=t.length,i=a-2;n0===e)for(n=0,a=t.length;n24)throw new Error("maxZoom should be in the 0-24 range");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n=this.options.minZoom;a--){var i=+Date.now();this.trees[a+1]=ot(n,xt,bt,this.options.nodeSize,Float32Array),n=this._cluster(n,a),e&&console.log("z%d: %d clusters in %dms",a,n.length,+Date.now()-i)}return this.trees[this.options.minZoom]=ot(n,xt,bt,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(gt(t[0]),mt(t[3]),gt(t[2]),mt(t[1])),a=[],i=0;i1&&console.time("creation"),h=this.tiles[f]=Ut(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var p="z"+e;this.stats[p]=(this.stats[p]||0)+1,this.total++}if(h.source=t,a){if(e===l.maxZoom||e===a)continue;var d=1<1&&console.time("clipping");var v,g,m,y,x,b,_=.5*l.buffer/l.extent,w=.5-_,k=.5+_,M=1+_;v=g=m=y=null,x=Lt(t,c,r-_,r+k,0,h.minX,h.maxX,l),b=Lt(t,c,r+w,r+M,0,h.minX,h.maxX,l),t=null,x&&(v=Lt(x,c,n-_,n+k,1,h.minY,h.maxY,l),g=Lt(x,c,n+w,n+M,1,h.minY,h.maxY,l),x=null),b&&(m=Lt(b,c,n-_,n+k,1,h.minY,h.maxY,l),y=Lt(b,c,n+w,n+M,1,h.minY,h.maxY,l),b=null),u>1&&console.timeEnd("clipping"),s.push(v||[],e+1,2*r,2*n),s.push(g||[],e+1,2*r,2*n+1),s.push(m||[],e+1,2*r+1,2*n),s.push(y||[],e+1,2*r+1,2*n+1)}}},Gt.prototype.getTile=function(t,e,r){var n=this.options,a=n.extent,i=n.debug;if(t<0||t>24)return null;var o=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l,u=t,c=e,f=r;!l&&u>0;)u--,c=Math.floor(c/2),f=Math.floor(f/2),l=this.tiles[Wt(u,c,f)];return l&&l.source?(i>1&&console.log("found parent tile z%d-%d-%d",u,c,f),i>1&&console.time("drilling down"),this.splitTile(l.source,u,c,f,t,e,r),i>1&&console.timeEnd("drilling down"),this.tiles[s]?jt(this.tiles[s],a):null):null};var Xt=function(e){function r(t,r,n){e.call(this,t,r,Yt),n&&(this.loadGeoJSON=n)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var t=this;if(this._pendingCallback&&this._pendingLoadDataParams){var e=this._pendingCallback,r=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams,this.loadGeoJSON(r,function(n,a){if(n||!a)return e(n);if("object"!=typeof a)return e(new Error("Input data is not a valid GeoJSON object."));I(a,!0);try{t._geoJSONIndex=r.cluster?ct(r.superclusterOptions).load(a.features):function(t,e){return new Gt(t,e)}(a,r.geojsonVtOptions)}catch(n){return e(n)}t.loaded={};var i={};if(r.request&&r.request.collectResourceTiming){var o=w(r.request.url);o&&(i.resourceTiming={},i.resourceTiming[r.source]=JSON.parse(JSON.stringify(o)))}e(null,i)})}},r.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())},r.prototype.reloadTile=function(t,r){var n=this.loaded,a=t.uid;return n&&n[a]?e.prototype.reloadTile.call(this,t,r):this.loadTile(t,r)},r.prototype.loadGeoJSON=function(e,r){if(e.request)t.getJSON(e.request,r);else{if("string"!=typeof e.data)return r(new Error("Input data is not a valid GeoJSON object."));try{return r(null,JSON.parse(e.data))}catch(t){return r(new Error("Input data is not a valid GeoJSON object."))}}},r.prototype.removeSource=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()},r}(M),Zt=function(e){var r=this;this.self=e,this.actor=new t.default$7(e,this),this.layerIndexes={},this.workerSourceTypes={vector:M,geojson:Xt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(t,e){if(r.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');r.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=function(e){if(t.plugin.isLoaded())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText}};return Zt.prototype.setLayers=function(t,e,r){this.getLayerIndex(t).replace(e),r()},Zt.prototype.updateLayers=function(t,e,r){this.getLayerIndex(t).update(e.layers,e.removedIds),r()},Zt.prototype.loadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).loadTile(e,r)},Zt.prototype.loadDEMTile=function(t,e,r){this.getDEMWorkerSource(t,e.source).loadTile(e,r)},Zt.prototype.reloadTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).reloadTile(e,r)},Zt.prototype.abortTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).abortTile(e,r)},Zt.prototype.removeTile=function(t,e,r){this.getWorkerSource(t,e.type,e.source).removeTile(e,r)},Zt.prototype.removeDEMTile=function(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)},Zt.prototype.removeSource=function(t,e,r){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var n=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==n.removeSource?n.removeSource(e,r):r()}},Zt.prototype.loadWorkerSource=function(t,e,r){try{this.self.importScripts(e.url),r()}catch(t){r(t.toString())}},Zt.prototype.loadRTLTextPlugin=function(e,r,n){try{t.plugin.isLoaded()||(this.self.importScripts(r),n(t.plugin.isLoaded()?null:new Error("RTL Text Plugin failed to import scripts from "+r)))}catch(t){n(t.toString())}},Zt.prototype.getLayerIndex=function(t){var e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new n),e},Zt.prototype.getWorkerSource=function(t,e,r){var n=this;if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][r]){var a={send:function(e,r,a){n.actor.send(e,r,a,t)}};this.workerSources[t][e][r]=new this.workerSourceTypes[e](a,this.getLayerIndex(t))}return this.workerSources[t][e][r]},Zt.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new A),this.demWorkerSources[t][e]},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&new Zt(self),Zt});a(["./chunk1.js"],function(t){"use strict";var e=t.createCommonjsModule(function(t){function e(t){return!!("undefined"!=typeof window&&"undefined"!=typeof document&&Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray&&Function.prototype&&Function.prototype.bind&&Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions&&"JSON"in window&&"parse"in JSON&&"stringify"in JSON&&function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,r=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(r);try{e=new Worker(n),t=!0}catch(e){t=!1}e&&e.terminate();return URL.revokeObjectURL(n),t}()&&"Uint8ClampedArray"in window&&function(t){void 0===r[t]&&(r[t]=function(t){var r=document.createElement("canvas"),n=Object.create(e.webGLContextAttributes);return n.failIfMajorPerformanceCaveat=t,r.probablySupportsContext?r.probablySupportsContext("webgl",n)||r.probablySupportsContext("experimental-webgl",n):r.supportsContext?r.supportsContext("webgl",n)||r.supportsContext("experimental-webgl",n):r.getContext("webgl",n)||r.getContext("experimental-webgl",n)}(t));return r[t]}(t&&t.failIfMajorPerformanceCaveat))}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e);var r={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}}),r=t.default.performance&&t.default.performance.now?t.default.performance.now.bind(t.default.performance):Date.now.bind(Date),n=t.default.requestAnimationFrame||t.default.mozRequestAnimationFrame||t.default.webkitRequestAnimationFrame||t.default.msRequestAnimationFrame,a=t.default.cancelAnimationFrame||t.default.mozCancelAnimationFrame||t.default.webkitCancelAnimationFrame||t.default.msCancelAnimationFrame,i={now:r,frame:function(t){return n(t)},cancelFrame:function(t){return a(t)},getImageData:function(e){var r=t.default.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=e.width,r.height=e.height,n.drawImage(e,0,0,e.width,e.height),n.getImageData(0,0,e.width,e.height)},hardwareConcurrency:t.default.navigator.hardwareConcurrency||4,get devicePixelRatio(){return t.default.devicePixelRatio},supportsWebp:!1};if(t.default.document){var o=t.default.document.createElement("img");o.onload=function(){i.supportsWebp=!0},o.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="}var s={create:function(e,r,n){var a=t.default.document.createElement(e);return r&&(a.className=r),n&&n.appendChild(a),a},createNS:function(e,r){return t.default.document.createElementNS(e,r)}},l=t.default.document?t.default.document.documentElement.style:null;function u(t){if(!l)return null;for(var e=0;e=0?0:e.button},s.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var g={API_URL:"https://api.mapbox.com",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null},m="See https://www.mapbox.com/api-documentation/#access-tokens";function y(t,e){var r=T(g.API_URL);if(t.protocol=r.protocol,t.authority=r.authority,"/"!==r.path&&(t.path=""+r.path+t.path),!g.REQUIRE_ACCESS_TOKEN)return S(t);if(!(e=e||g.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+m);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+m);return t.params.push("access_token="+e),S(t)}function x(t){return 0===t.indexOf("mapbox:")}var b=function(t,e){if(!x(t))return t;var r=T(t);return r.path="/fonts/v1"+r.path,y(r,e)},_=function(t,e){if(!x(t))return t;var r=T(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),y(r,e)},w=function(t,e,r,n){var a=T(t);return x(t)?(a.path="/styles/v1"+a.path+"/sprite"+e+r,y(a,n)):(a.path+=""+e+r,S(a))},k=/(\.(png|jpg)\d*)(?=$)/,M=function(t,e,r){if(!e||!x(e))return t;var n=T(t),a=i.devicePixelRatio>=2||512===r?"@2x":"",o=i.supportsWebp?".webp":"$1";return n.path=n.path.replace(k,""+a+o),function(t){for(var e=0;e=0?1.2:1))}function B(t,e,r,n,a,i,o){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else{var l=i.requests[s];l||(l=i.requests[s]=[],N.loadGlyphRange(r,s,n.url,n.requestTransform,function(t,e){if(e)for(var r in e)i.glyphs[+r]=e[+r];for(var n=0,a=l;nthis.height)return t.warnOnce("LineAtlas out of space"),null;for(var i=0,o=0;o90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};W.prototype.wrap=function(){return new W(t.wrap(this.lng,-180,180),this.lat)},W.prototype.toArray=function(){return[this.lng,this.lat]},W.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},W.prototype.toBounds=function(t){var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Y(new W(this.lng-r,this.lat-e),new W(this.lng+r,this.lat+e))},W.convert=function(t){if(t instanceof W)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new W(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new W(Number(t.lng),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, or an array of [, ]")};var Y=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};Y.prototype.setNorthEast=function(t){return this._ne=t instanceof W?new W(t.lng,t.lat):W.convert(t),this},Y.prototype.setSouthWest=function(t){return this._sw=t instanceof W?new W(t.lng,t.lat):W.convert(t),this},Y.prototype.extend=function(t){var e,r,n=this._sw,a=this._ne;if(t instanceof W)e=t,r=t;else{if(!(t instanceof Y))return Array.isArray(t)?t.every(Array.isArray)?this.extend(Y.convert(t)):this.extend(W.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return n||a?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),a.lng=Math.max(r.lng,a.lng),a.lat=Math.max(r.lat,a.lat)):(this._sw=new W(e.lng,e.lat),this._ne=new W(r.lng,r.lat)),this},Y.prototype.getCenter=function(){return new W((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Y.prototype.getSouthWest=function(){return this._sw},Y.prototype.getNorthEast=function(){return this._ne},Y.prototype.getNorthWest=function(){return new W(this.getWest(),this.getNorth())},Y.prototype.getSouthEast=function(){return new W(this.getEast(),this.getSouth())},Y.prototype.getWest=function(){return this._sw.lng},Y.prototype.getSouth=function(){return this._sw.lat},Y.prototype.getEast=function(){return this._ne.lng},Y.prototype.getNorth=function(){return this._ne.lat},Y.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Y.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Y.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Y.convert=function(t){return!t||t instanceof Y?t:new Y(t)};var X=function(t,e,r){this.bounds=Y.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=r||24};X.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},X.prototype.contains=function(t){var e=Math.floor(this.lngX(this.bounds.getWest(),t.z)),r=Math.floor(this.latY(this.bounds.getNorth(),t.z)),n=Math.ceil(this.lngX(this.bounds.getEast(),t.z)),a=Math.ceil(this.latY(this.bounds.getSouth(),t.z));return t.x>=e&&t.x=r&&t.y0&&(l[new t.OverscaledTileID(e.overscaledZ,i,r.z,a,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,r.z,o,r.y-1).key]={backfilled:!1}),r.y+10&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}})},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(e){if(e)return r.fire(new t.ErrorEvent(e));var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}),this},r.prototype._updateWorkerData=function(e){var r,n,a=this,i=t.extend({},this.workerOptions),o=this._data;"string"==typeof o?(i.request=this.map._transformRequest((r=o,(n=t.default.document.createElement("a")).href=r,n.href),t.ResourceType.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(o),this.workerID=this.dispatcher.send(this.type+"."+i.source+".loadData",i,function(t,r){a._removed||r&&r.abandoned||(a._loaded=!0,r&&r.resourceTiming&&r.resourceTiming[a.id]&&(a._resourceTiming=r.resourceTiming[a.id].slice(0)),a.dispatcher.send(a.type+"."+i.source+".coalesce",null,null,a.workerID),e(t))},this.workerID)},r.prototype.loadTile=function(t,e){var r=this,n=void 0===t.workerID?"loadTile":"reloadTile",a={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:i.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send(n,a,function(a,i){return t.unloadVectorData(),t.aborted?e(null):a?e(a):(t.loadVectorData(i,r.map.painter,"reloadTile"===n),e(null))},this.workerID)},r.prototype.abortTile=function(t){t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.dispatcher.send("removeTile",{uid:t.uid,type:this.type,source:this.id},null,t.workerID)},r.prototype.onRemove=function(){this._removed=!0,this.dispatcher.send("removeSource",{type:this.type,source:this.id},null,this.workerID)},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented);var Q=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),tt=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};tt.prototype.bind=function(t,e,r,n,a,i,o,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==n.length,u=0;!l&&u>s.z,u=new t.default$1(s.x*l,s.y*l),c=new t.default$1(u.x+l,u.y+l),f=this.segments.prepareSegment(4,n,a);n.emplaceBack(u.x,u.y,u.x,u.y),n.emplaceBack(c.x,u.y,c.x,u.y),n.emplaceBack(u.x,c.y,u.x,c.y),n.emplaceBack(c.x,c.y,c.x,c.y);var h=f.vertexLength;a.emplaceBack(h,h+1,h+2),a.emplaceBack(h+1,h+2,h+3),f.vertexLength+=4,f.primitiveLength+=2}this.maskedBoundsBuffer=r.createVertexBuffer(n,Q.members),this.maskedIndexBuffer=r.createIndexBuffer(a)}},lt.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},lt.prototype.setExpiryData=function(e){var r=this.expirationTime;if(e.cacheControl){var n=t.parseCacheControl(e.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+1e3*n["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){var a=Date.now(),i=!1;if(this.expirationTime>a)i=!1;else if(r)if(this.expirationTimethis.max){var o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this},ut.prototype.has=function(t){return t.wrapped().key in this.data},ut.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},ut.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},ut.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},ut.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),a=this.data[r][n];return this.data[r].splice(n,1),a.timeout&&clearTimeout(a.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(a.value),this.order.splice(this.order.indexOf(r),1),this},ut.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this};var ct=function(t,e,r){this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};ct.prototype.unbindVAO=function(){this.context.extVertexArrayObject&&this.context.bindVertexArrayOES.set(null)},ct.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},ct.prototype.updateData=function(t){var e=this.context.gl;this.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},ct.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)};var ft={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},ht=function(t,e,r,n){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;var a=t.gl;this.buffer=a.createBuffer(),t.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};ht.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},ht.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},ht.prototype.enableAttributes=function(t,e){for(var r=0;r1||(Math.abs(r)>1&&(1===Math.abs(r+a)?r+=a:1===Math.abs(r-a)&&(r-=a)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[i]&&(t.neighboringTiles[i].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype.getZoom=function(t){return t.zoom+t.scaleZoom(t.tileSize/this._source.tileSize)},r.prototype._findLoadedChildren=function(t,e,r){var n=!1;for(var a in this._tiles){var i=this._tiles[a];if(!(r[a]||!i.hasData()||i.tileID.overscaledZ<=t.overscaledZ||i.tileID.overscaledZ>e)){var o=Math.pow(2,i.tileID.canonical.z-t.canonical.z);if(Math.floor(i.tileID.canonical.x/o)===t.canonical.x&&Math.floor(i.tileID.canonical.y/o)===t.canonical.y)for(r[a]=i.tileID,n=!0;i&&i.tileID.overscaledZ-1>t.overscaledZ;){var s=i.tileID.scaledTo(i.tileID.overscaledZ-1);if(!s)break;(i=this._tiles[s.key])&&i.hasData()&&(delete r[a],r[s.key]=s)}}}return n},r.prototype.findLoadedParent=function(t,e,r){for(var n=t.overscaledZ-1;n>=e;n--){var a=t.scaledTo(n);if(!a)return;var i=String(a.key),o=this._tiles[i];if(o&&o.hasData())return r[i]=a,o;if(this._cache.has(a))return r[i]=a,this._cache.get(a)}},r.prototype.updateCacheSize=function(t){var e=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),r=Math.floor(5*e),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(n)},r.prototype.handleWrapJump=function(t){var e=(t-(void 0===this._prevLng?t:this._prevLng))/360,r=Math.round(e);if(this._prevLng=t,r){var n={};for(var a in this._tiles){var i=this._tiles[a];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+r),n[i.tileID.key]=i}for(var o in this._tiles=n,this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(var s in this._tiles){var l=this._tiles[s];this._setTileReloadTimer(s,l)}}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var a;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?a=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)}):(a=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(a=a.filter(function(t){return n._source.hasTile(t)}))):a=[];var o,s=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(e)),l=Math.max(s-r.maxOverzooming,this._source.minzoom),u=Math.max(s+r.maxUnderzooming,this._source.minzoom),c=this._updateRetainedTiles(a,s),f={};if($t(this._source.type))for(var h=Object.keys(c),p=0;p=i.now())){n._findLoadedChildren(v,u,c)&&(c[d]=v);var m=n.findLoadedParent(v,l,f);m&&n._addTile(m.tileID)}}for(o in f)c[o]||(n._coveredTiles[o]=!0);for(o in f)c[o]=f[o];for(var y=t.keysDifference(this._tiles,c),x=0;xthis._source.maxzoom){var h=l.children(this._source.maxzoom)[0],p=this.getTile(h);p&&p.hasData()?n[h.key]=h:f=!1}else{this._findLoadedChildren(l,o,n);for(var d=l.children(this._source.maxzoom),v=0;v=i;--g){var m=l.scaledTo(g);if(a[m.key])break;if(a[m.key]=!0,!(u=this.getTile(m))&&c&&(u=this._addTile(m)),u&&(n[m.key]=m,c=u.wasRequested(),u.hasData()))break}}}return n},r.prototype._addTile=function(e){var r=this._tiles[e.key];if(r)return r;(r=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,r),r.tileID=e);var n=Boolean(r);return n||(r=new lt(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))),r?(r.uses++,this._tiles[e.key]=r,n||this._source.fire(new t.Event("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r):null},r.prototype._setTileReloadTimer=function(t,e){var r=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout(function(){r._reloadTile(t,"expired"),delete r._timers[t]},n))},r.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r){for(var n=[],a=this.getIds(),i=1/0,o=1/0,s=-1/0,l=-1/0,u=e[0].zoom,c=0;c=0&&m[1].y+g>=0){for(var y=[],x=0;x=i.now())return!0}return!1},r}(t.Evented);function Zt(e,r){var n=r.zoomTo(e.canonical.z);return new t.default$1((n.column-(e.canonical.x+e.wrap*Math.pow(2,e.canonical.z)))*t.default$8,(n.row-e.canonical.y)*t.default$8)}function $t(t){return"raster"===t||"image"===t||"video"===t}function Jt(){return new t.default.Worker(Ln.workerUrl)}Xt.maxOverzooming=10,Xt.maxUnderzooming=3;var Kt,Qt=function(){this.active={}};function te(e,r){var n={};for(var a in e)"ref"!==a&&(n[a]=e[a]);return t.default$18.forEach(function(t){t in r&&(n[t]=r[t])}),n}function ee(t){t=t.slice();for(var e=Object.create(null),r=0;rthis.width||n<0||e>this.height)return!a&&[];var i=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(a)return!0;for(var o=0;o0:i},fe.prototype._queryCircle=function(t,e,r,n){var a=t-r,i=t+r,o=e-r,s=e+r;if(i<0||a>this.width||s<0||o>this.height)return!n&&[];var l=[],u={hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(a,o,i,s,this._queryCellCircle,l,u),n?l.length>0:l},fe.prototype.query=function(t,e,r,n){return this._query(t,e,r,n,!1)},fe.prototype.hitTest=function(t,e,r,n){return this._query(t,e,r,n,!0)},fe.prototype.hitTestCircle=function(t,e,r){return this._queryCircle(t,e,r,!0)},fe.prototype._queryCell=function(t,e,r,n,a,i,o){var s=o.seenUids,l=this.boxCells[a];if(null!==l)for(var u=this.bboxes,c=0,f=l;c=u[p+0]&&n>=u[p+1]){if(o.hitTest)return i.push(!0),!0;i.push({key:this.boxKeys[h],x1:u[p],y1:u[p+1],x2:u[p+2],y2:u[p+3]})}}}var d=this.circleCells[a];if(null!==d)for(var v=this.circles,g=0,m=d;go*o+s*s},fe.prototype._circleAndRectCollide=function(t,e,r,n,a,i,o){var s=(i-n)/2,l=Math.abs(t-(n+s));if(l>s+r)return!1;var u=(o-a)/2,c=Math.abs(e-(a+u));if(c>u+r)return!1;if(l<=s||c<=u)return!0;var f=l-s,h=c-u;return f*f+h*h<=r*r};var he=t.default$19.layout;function pe(e,r,n,a,i){var o=t.mat4.identity(new Float32Array(16));return r?(t.mat4.identity(o),t.mat4.scale(o,o,[1/i,1/i,1]),n||t.mat4.rotateZ(o,o,a.angle)):(t.mat4.scale(o,o,[a.width/2,-a.height/2,1]),t.mat4.translate(o,o,[1,-1,0]),t.mat4.multiply(o,o,e)),o}function de(e,r,n,a,i){var o=t.mat4.identity(new Float32Array(16));return r?(t.mat4.multiply(o,o,e),t.mat4.scale(o,o,[i,i,1]),n||t.mat4.rotateZ(o,o,-a.angle)):(t.mat4.scale(o,o,[1,-1,1]),t.mat4.translate(o,o,[-1,-1,0]),t.mat4.scale(o,o,[2/a.width,2/a.height,1])),o}function ve(e,r){var n=[e.x,e.y,0,1];Ae(n,n,r);var a=n[3];return{point:new t.default$1(n[0]/a,n[1]/a),signedDistanceFromCamera:a}}function ge(t,e){var r=t[0]/t[3],n=t[1]/t[3];return r>=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function me(e,r,n,a,i,o,s,l){var u=a?e.textSizeData:e.iconSizeData,c=t.evaluateSizeForZoom(u,n.transform.zoom,he.properties[a?"text-size":"icon-size"]),f=[256/n.width*2+1,256/n.height*2+1],h=a?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;h.clear();for(var p=e.lineVertexArray,d=a?e.text.placedSymbolArray:e.icon.placedSymbolArray,v=n.transform.width/n.transform.height,g=!1,m=0;mMath.abs(n.x-r.x)*a)return{useVertical:!0};return(e===t.WritingMode.vertical?r.yn.x)?{needsFlipping:!0}:null}function be(e,r,n,a,i,o,s,l,u,c,f,h,p,d){var v,g=r/24,m=e.lineOffsetX*r,y=e.lineOffsetY*r;if(e.numGlyphs>1){var x=e.glyphStartIndex+e.numGlyphs,b=e.lineStartIndex,_=e.lineStartIndex+e.lineLength,w=ye(g,l,m,y,n,f,h,e,u,o,p,!1);if(!w)return{notEnoughRoom:!0};var k=ve(w.first.point,s).point,M=ve(w.last.point,s).point;if(a&&!n){var A=xe(e.writingMode,k,M,d);if(A)return A}v=[w.first];for(var T=e.glyphStartIndex+1;T0?L.point:_e(h,C,S,1,i),z=xe(e.writingMode,S,I,d);if(z)return z}var P=we(g*l.getoffsetX(e.glyphStartIndex),m,y,n,f,h,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,o,p,!1);if(!P)return{notEnoughRoom:!0};v=[P]}for(var O=0,D=v;O0?1:-1,g=0;a&&(v*=-1,g=Math.PI),v<0&&(g+=Math.PI);for(var m=v>0?l+s:l+s+1,y=m,x=i,b=i,_=0,w=0,k=Math.abs(d);_+w<=k;){if((m+=v)=u)return null;if(b=x,void 0===(x=h[m])){var M=new t.default$1(c.getx(m),c.gety(m)),A=ve(M,f);if(A.signedDistanceFromCamera>0)x=h[m]=A.point;else{var T=m-v;x=_e(0===_?o:new t.default$1(c.getx(T),c.gety(T)),M,b,k-_+1,f)}}_+=w,w=b.dist(x)}var S=(k-_)/w,E=x.sub(b),C=E.mult(S)._add(b);return C._add(E._unit()._perp()._mult(n*v)),{point:C,angle:g+Math.atan2(x.y-b.y,x.x-b.x),tileDistance:p?{prevTileDistance:m-v===y?0:c.gettileUnitDistanceFromAnchor(m-v),lastSegmentViewportDistance:k-_}:null}}var ke=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Me(t,e){for(var r=0;rT)Se(e,S,!1);else{var z=this.projectPoint(c,E,C),P=L*k;if(d.length>0){var O=z.x-d[d.length-4],D=z.y-d[d.length-3];if(P*P*2>O*O+D*D)if(S+8-A&&R=this.screenRightBoundary||n<100||e>this.screenBottomBoundary};var Ce=t.default$19.layout,Le=function(t,e,r,n){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):n&&r?1:0,this.placed=r};Le.prototype.isHidden=function(){return 0===this.opacity&&!this.placed};var Ie=function(t,e,r,n,a){this.text=new Le(t?t.text:null,e,r,a),this.icon=new Le(t?t.icon:null,e,n,a)};Ie.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var ze=function(t,e,r){this.text=t,this.icon=e,this.skipFade=r},Pe=function(t,e){this.transform=t.clone(),this.collisionIndex=new Te(this.transform),this.placements={},this.opacities={},this.stale=!1,this.fadeDuration=e,this.retainedQueryData={}};function Oe(t,e,r){t.emplaceBack(e?1:0,r?1:0),t.emplaceBack(e?1:0,r?1:0),t.emplaceBack(e?1:0,r?1:0),t.emplaceBack(e?1:0,r?1:0)}Pe.prototype.placeLayerTile=function(e,r,n,a){var i=r.getBucket(e),o=r.latestFeatureIndex;if(i&&o&&e.id===i.layerIds[0]){var s=r.collisionBoxArray,l=i.layers[0].layout,u=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),c=r.tileSize/t.default$8,f=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),h=pe(f,"map"===l.get("text-pitch-alignment"),"map"===l.get("text-rotation-alignment"),this.transform,Ee(r,1,this.transform.zoom)),p=pe(f,"map"===l.get("icon-pitch-alignment"),"map"===l.get("icon-rotation-alignment"),this.transform,Ee(r,1,this.transform.zoom));this.retainedQueryData[i.bucketInstanceId]=new function(t,e,r,n,a){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=r,this.bucketIndex=n,this.tileID=a}(i.bucketInstanceId,o,i.sourceLayerIndex,i.index,r.tileID),this.placeLayerBucket(i,f,h,p,u,c,n,a,s)}},Pe.prototype.placeLayerBucket=function(e,r,n,a,i,o,s,l,u){for(var c=e.layers[0].layout,f=t.evaluateSizeForZoom(e.textSizeData,this.transform.zoom,Ce.properties["text-size"]),h=!e.hasTextData()||c.get("text-optional"),p=!e.hasIconData()||c.get("icon-optional"),d=0,v=e.symbolInstances;d0,x=x&&b.offscreen);var A=g.collisionArrays.textCircles;if(A){var T=e.text.placedSymbolArray.get(g.placedTextSymbolIndices[0]),S=t.evaluateSizeForFeature(e.textSizeData,f,T);_=this.collisionIndex.placeCollisionCircles(A,c.get("text-allow-overlap"),i,o,g.key,T,e.lineVertexArray,e.glyphOffsetArray,S,r,n,s,"map"===c.get("text-pitch-alignment")),m=c.get("text-allow-overlap")||_.circles.length>0,x=x&&_.offscreen}g.collisionArrays.iconFeatureIndex&&(M=g.collisionArrays.iconFeatureIndex),g.collisionArrays.iconBox&&(y=(w=this.collisionIndex.placeCollisionBox(g.collisionArrays.iconBox,c.get("icon-allow-overlap"),o,r)).box.length>0,x=x&&w.offscreen),h||p?p?h||(y=y&&m):m=y&&m:y=m=y&&m,m&&b&&this.collisionIndex.insertCollisionBox(b.box,c.get("text-ignore-placement"),e.bucketInstanceId,k),y&&w&&this.collisionIndex.insertCollisionBox(w.box,c.get("icon-ignore-placement"),e.bucketInstanceId,M),m&&_&&this.collisionIndex.insertCollisionCircles(_.circles,c.get("text-ignore-placement"),e.bucketInstanceId,k),this.placements[g.crossTileID]=new ze(m,y,x||e.justReloaded),l[g.crossTileID]=!0}}e.justReloaded=!1},Pe.prototype.commit=function(t,e){this.commitTime=e;var r=!1,n=t&&0!==this.fadeDuration?(this.commitTime-t.commitTime)/this.fadeDuration:1,a=t?t.opacities:{};for(var i in this.placements){var o=this.placements[i],s=a[i];s?(this.opacities[i]=new Ie(s,n,o.text,o.icon),r=r||o.text!==s.text.placed||o.icon!==s.icon.placed):(this.opacities[i]=new Ie(null,n,o.text,o.icon,o.skipFade),r=r||o.text||o.icon)}for(var l in a){var u=a[l];if(!this.opacities[l]){var c=new Ie(u,n,!1,!1);c.isHidden()||(this.opacities[l]=c,r=r||u.text.placed||u.icon.placed)}}r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)},Pe.prototype.updateLayerOpacities=function(t,e){for(var r={},n=0,a=e;n0||s.numVerticalGlyphVertices>0,f=s.numIconVertices>0;if(c){for(var h=Ue(u.text),p=(s.numGlyphVertices+s.numVerticalGlyphVertices)/4,d=0;dt},Pe.prototype.setStale=function(){this.stale=!0};var De=Math.pow(2,25),Re=Math.pow(2,24),Be=Math.pow(2,17),Fe=Math.pow(2,16),Ne=Math.pow(2,9),je=Math.pow(2,8),Ve=Math.pow(2,1);function Ue(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*De+e*Re+r*Be+e*Fe+r*Ne+e*je+r*Ve+e}var qe=function(){this._currentTileIndex=0,this._seenCrossTileIDs={}};qe.prototype.continuePlacement=function(t,e,r,n,a){for(;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=e[t[n._currentPlacementIndex]],l=n.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(n._inProgressLayer||(n._inProgressLayer=new qe),n._inProgressLayer.continuePlacement(r[s.source],n.placement,n._showCollisionBoxes,s,o))return;delete n._inProgressLayer}n._currentPlacementIndex--}this._done=!0},He.prototype.commit=function(t,e){return this.placement.commit(t,e),this.placement};var Ge=512/t.default$8/2,We=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0,a=e;nt.overscaledZ)for(var l in s){var u=s[l];u.tileID.isChildOf(t)&&u.findMatches(e.symbolInstances,t,i)}else{var c=s[t.scaledTo(Number(o)).key];c&&c.findMatches(e.symbolInstances,t,i)}}for(var f=0,h=e.symbolInstances;f1?"@2x":"";function u(){if(s)n(s);else if(a&&o){var e=i.getImageData(o),r={};for(var l in a){var u=a[l],c=u.width,f=u.height,h=u.x,p=u.y,d=u.sdf,v=u.pixelRatio,g=new t.RGBAImage({width:c,height:f});t.RGBAImage.copy(e,g,{x:h,y:p},{x:0,y:0},{width:c,height:f}),r[l]={data:g,pixelRatio:v,sdf:d}}n(null,r)}}t.getJSON(r(w(e,l,".json"),t.ResourceType.SpriteJSON),function(t,e){s||(s=t,a=e,u())}),t.getImage(r(w(e,l,".png"),t.ResourceType.SpriteImage),function(t,e){s||(s=t,o=e,u())})}(e.sprite,this.map._transformRequest,function(e,r){if(e)n.fire(new t.ErrorEvent(e));else if(r)for(var a in r)n.imageManager.addImage(a,r[a]);n.imageManager.setLoaded(!0),n.fire(new t.Event("data",{dataType:"style"}))}):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var o=ee(this.stylesheet.layers);this._order=o.map(function(t){return t.id}),this._layers={};for(var s=0,l=o;s0)throw new Error("Unimplemented: "+a.map(function(t){return t.command}).join(", ")+".");return n.forEach(function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)}),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.addSource=function(e,r,n){var a=this;if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0)||!this._validate(t.validateStyle.source,"sources."+e,r,null,n)){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var i=this.sourceCaches[e]=new Xt(e,r,this.dispatcher);i.style=this,i.setEventedParent(this,function(){return{isSourceLoaded:a.loaded(),source:i.serialize(),sourceId:e}}),i.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,n){this._checkLoaded();var a=e.id;if(this.getLayer(a))this.fire(new t.ErrorEvent(new Error('Layer with id "'+a+'" already exists on this map')));else if("object"==typeof e.source&&(this.addSource(a,e.source),e=t.clone(e),e=t.extend(e,{source:a})),!this._validate(t.validateStyle.layer,"layers."+a,e,{arrayIndex:-1},n)){var i=t.default$22(e);this._validateLayer(i),i.setEventedParent(this,{layer:{id:a}});var o=r?this._order.indexOf(r):this._order.length;if(r&&-1===o)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(o,0,a),this._layerOrderChanged=!0,this._layers[a]=i,this._removedLayers[a]&&i.source){var s=this._removedLayers[a];delete this._removedLayers[a],s.type!==i.type?this._updatedSources[i.source]="clear":(this._updatedSources[i.source]="reload",this.sourceCaches[i.source].pause())}this._updateLayer(i)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var n=this._order.indexOf(e);this._order.splice(n,1);var a=r?this._order.indexOf(r):this._order.length;r&&-1===a?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(a,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e]}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.setLayerZoomRange=function(e,r,n){this._checkLoaded();var a=this.getLayer(e);a?a.minzoom===r&&a.maxzoom===n||(null!=r&&(a.minzoom=r),null!=n&&(a.maxzoom=n),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r){this._checkLoaded();var n=this.getLayer(e);if(n){if(!t.default$10(n.filter,r))return null==r?(n.filter=void 0,void this._updateLayer(n)):void(this._validate(t.validateStyle.filter,"layers."+n.id+".filter",r)||(n.filter=t.clone(r),this._updateLayer(n)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,n){this._checkLoaded();var a=this.getLayer(e);a?t.default$10(a.getLayoutProperty(r),n)||(a.setLayoutProperty(r,n),this._updateLayer(a)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(t,e){return this.getLayer(t).getLayoutProperty(e)},r.prototype.setPaintProperty=function(e,r,n){this._checkLoaded();var a=this.getLayer(e);if(a){if(!t.default$10(a.getPaintProperty(r),n)){var i=a._transitionablePaint._values[r].value.isDataDriven();a.setPaintProperty(r,n),(a._transitionablePaint._values[r].value.isDataDriven()||i)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){var e=this;return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,function(t){return t.serialize()}),layers:this._order.map(function(t){return e._layers[t].serialize()})},function(t){return void 0!==t})},r.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},r.prototype._flattenRenderedFeatures=function(t){for(var e=[],r=this._order.length-1;r>=0;r--)for(var n=this._order[r],a=0,i=t;a 0.5) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n gl_FragColor *= .1;\n }\n}",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = clamp(\n 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),\n 0.0, // Prevents oversized near-field boxes in pitched/overzoomed tiles\n 4.0);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n gl_Position.xy += a_extrude * u_extrude_scale * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n}\n"},collisionCircle:{fragmentSource:"uniform float u_overscale_factor;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n float alpha = 0.5;\n\n // Red = collision, hide label\n vec4 color = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n\n // Blue = no collision, label is showing\n if (v_placed > 0.5) {\n color = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n color *= .2;\n }\n\n float extrude_scale_length = length(v_extrude_scale);\n float extrude_length = length(v_extrude) * extrude_scale_length;\n float stroke_width = 15.0 * extrude_scale_length / u_overscale_factor;\n float radius = v_radius * extrude_scale_length;\n\n float distance_to_edge = abs(extrude_length - radius);\n float opacity_t = smoothstep(-stroke_width, 0.0, -distance_to_edge);\n\n gl_FragColor = opacity_t * color;\n}\n",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\n\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = clamp(\n 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance),\n 0.0, // Prevents oversized near-field circles in pitched/overzoomed tiles\n 4.0);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n\n highp float padding_factor = 1.2; // Pad the vertices slightly to make room for anti-alias blur\n gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n v_radius = abs(a_extrude.y); // We don't pitch the circles, so both units of the extrusion vector are equal in magnitude to the radius\n\n v_extrude = a_extrude * padding_factor;\n v_extrude_scale = u_extrude_scale * u_camera_to_center_distance * collision_perspective_ratio;\n}\n"},debug:{fragmentSource:"uniform highp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fill:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fillOutline:{fragmentSource:"#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillOutlinePattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.0, dist);\n\n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n}\n"},fillExtrusion:{fragmentSource:"varying vec4 v_color;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n gl_FragColor = v_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec4 v_color;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n vec3 normal = a_normal_ed.xyz;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n\n gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? height : base, 1);\n\n // Relative luminance (how dark/bright is the surface color?)\n float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;\n\n v_color = vec4(0.0, 0.0, 0.0, 1.0);\n\n // Add slight ambient lighting so no extrusions are totally black\n vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0);\n color += ambientlight;\n\n // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray\n float directional = clamp(dot(normal / 16384.0, u_lightpos), 0.0, 1.0);\n\n // Adjust directional so that\n // the range of values for highlight/shading is narrower\n // with lower light intensity\n // and with lighter/brighter surface colors\n directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional);\n\n // Add gradient along z axis of side surfaces\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n // Assign final color based on surface + ambient light color, diffuse light directional, and light color\n // with lower bounds adjusted to hue of light\n // so that shading is tinted with the complementary (opposite) color to the light color\n v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0);\n v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0);\n v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0);\n}\n"},fillExtrusionPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 mixedColor = mix(color1, color2, u_mix);\n\n gl_FragColor = mixedColor * v_lighting;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\nuniform float u_height_factor;\n\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\nvarying float v_directional;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec3 normal = a_normal_ed.xyz;\n float edgedistance = a_normal_ed.w;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n float z = t > 0.0 ? height : base;\n\n gl_Position = u_matrix * vec4(a_pos, z, 1);\n\n vec2 pos = normal.x == 1.0 && normal.y == 0.0 && normal.z == 16384.0\n ? a_pos // extrusion top\n : vec2(edgedistance, z * u_height_factor); // extrusion side\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, pos);\n\n v_lighting = vec4(0.0, 0.0, 0.0, 1.0);\n float directional = clamp(dot(normal / 16383.0, u_lightpos), 0.0, 1.0);\n directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional);\n\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0));\n}\n"},extrusionTexture:{fragmentSource:"uniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(0.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);\n\n v_pos.x = a_pos.x;\n v_pos.y = 1.0 - a_pos.y;\n}\n"},hillshadePrepare:{fragmentSource:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nuniform vec2 u_dimension;\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture2D(u_image, coord) * 255.0;\n return (data.r + data.g * 256.0 + data.b * 256.0 * 256.0) / 4.0;\n}\n\nvoid main() {\n vec2 epsilon = 1.0 / u_dimension;\n\n // queried pixels:\n // +-----------+\n // | | | |\n // | a | b | c |\n // | | | |\n // +-----------+\n // | | | |\n // | d | e | f |\n // | | | |\n // +-----------+\n // | | | |\n // | g | h | i |\n // | | | |\n // +-----------+\n\n float a = getElevation(v_pos + vec2(-epsilon.x, -epsilon.y), 0.0);\n float b = getElevation(v_pos + vec2(0, -epsilon.y), 0.0);\n float c = getElevation(v_pos + vec2(epsilon.x, -epsilon.y), 0.0);\n float d = getElevation(v_pos + vec2(-epsilon.x, 0), 0.0);\n float e = getElevation(v_pos, 0.0);\n float f = getElevation(v_pos + vec2(epsilon.x, 0), 0.0);\n float g = getElevation(v_pos + vec2(-epsilon.x, epsilon.y), 0.0);\n float h = getElevation(v_pos + vec2(0, epsilon.y), 0.0);\n float i = getElevation(v_pos + vec2(epsilon.x, epsilon.y), 0.0);\n\n // here we divide the x and y slopes by 8 * pixel size\n // where pixel size (aka meters/pixel) is:\n // circumference of the world / (pixels per tile * number of tiles)\n // which is equivalent to: 8 * 40075016.6855785 / (512 * pow(2, u_zoom))\n // which can be reduced to: pow(2, 19.25619978527 - u_zoom)\n // we want to vertically exaggerate the hillshading though, because otherwise\n // it is barely noticeable at low zooms. to do this, we multiply this by some\n // scale factor pow(2, (u_zoom - u_maxzoom) * a) where a is an arbitrary value\n // Here we use a=0.3 which works out to the expression below. see \n // nickidlugash's awesome breakdown for more info\n // https://github.com/mapbox/mapbox-gl-js/pull/5286#discussion_r148419556\n float exaggeration = u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;\n\n vec2 deriv = vec2(\n (c + f + f + i) - (a + d + d + g),\n (g + h + h + i) - (a + b + b + c)\n ) / pow(2.0, (u_zoom - u_maxzoom) * exaggeration + 19.2562 - u_zoom);\n\n gl_FragColor = clamp(vec4(\n deriv.x / 2.0 + 0.5,\n deriv.y / 2.0 + 0.5,\n 1.0,\n 1.0), 0.0, 1.0);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (a_texture_pos / 8192.0) / 2.0 + 0.25;\n}\n"},hillshade:{fragmentSource:"uniform sampler2D u_image;\nvarying vec2 v_pos;\n\nuniform vec2 u_latrange;\nuniform vec2 u_light;\nuniform vec4 u_shadow;\nuniform vec4 u_highlight;\nuniform vec4 u_accent;\n\n#define PI 3.141592653589793\n\nvoid main() {\n vec4 pixel = texture2D(u_image, v_pos);\n\n vec2 deriv = ((pixel.rg * 2.0) - 1.0);\n\n // We divide the slope by a scale factor based on the cosin of the pixel's approximate latitude\n // to account for mercator projection distortion. see #4807 for details\n float scaleFactor = cos(radians((u_latrange[0] - u_latrange[1]) * (1.0 - v_pos.y) + u_latrange[1]));\n // We also multiply the slope by an arbitrary z-factor of 1.25\n float slope = atan(1.25 * length(deriv) / scaleFactor);\n float aspect = deriv.x != 0.0 ? atan(deriv.y, -deriv.x) : PI / 2.0 * (deriv.y > 0.0 ? 1.0 : -1.0);\n\n float intensity = u_light.x;\n // We add PI to make this property match the global light object, which adds PI/2 to the light's azimuthal\n // position property to account for 0deg corresponding to north/the top of the viewport in the style spec\n // and the original shader was written to accept (-illuminationDirection - 90) as the azimuthal.\n float azimuth = u_light.y + PI;\n\n // We scale the slope exponentially based on intensity, using a calculation similar to\n // the exponential interpolation function in the style spec:\n // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/expression/definitions/interpolate.js#L217-L228\n // so that higher intensity values create more opaque hillshading.\n float base = 1.875 - intensity * 1.75;\n float maxValue = 0.5 * PI;\n float scaledSlope = intensity != 0.5 ? ((pow(base, slope) - 1.0) / (pow(base, maxValue) - 1.0)) * maxValue : slope;\n\n // The accent color is calculated with the cosine of the slope while the shade color is calculated with the sine\n // so that the accent color's rate of change eases in while the shade color's eases out.\n float accent = cos(scaledSlope);\n // We multiply both the accent and shade color by a clamped intensity value\n // so that intensities >= 0.5 do not additionally affect the color values\n // while intensity values < 0.5 make the overall color more transparent.\n vec4 accent_color = (1.0 - accent) * u_accent * clamp(intensity * 2.0, 0.0, 1.0);\n float shade = abs(mod((aspect + azimuth) / PI + 0.5, 2.0) - 1.0);\n vec4 shade_color = mix(u_shadow, u_highlight, shade) * sin(scaledSlope) * clamp(intensity * 2.0, 0.0, 1.0);\n gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_texture_pos / 8192.0;\n}\n"},line:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\nvarying highp float v_linesofar;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n v_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},lineGradient:{fragmentSource:"\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nuniform sampler2D u_image;\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\nvarying highp float v_lineprogress;\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n // For gradient lines, v_lineprogress is the ratio along the entire line,\n // scaled to [0, 2^15), and the gradient ramp is stored in a texture.\n vec4 color = texture2D(u_image, vec2(v_lineprogress, 0.5));\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n// the attribute conveying progress along a line is scaled to [0, 2^15)\n#define MAX_LINE_DISTANCE 32767.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\nvarying highp float v_lineprogress;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n v_lineprogress = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0 / MAX_LINE_DISTANCE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},linePattern:{fragmentSource:"uniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_fade;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n\n // v_normal.y is 0 at the midpoint of the line, -1 at the lower edge, 1 at the upper edge\n // we clamp the line width outset to be between 0 and half the pattern height plus padding (2.0)\n // to ensure we don't sample outside the designated symbol on the sprite sheet.\n // 0.5 is added to shift the component to be bounded between 0 and 1 for interpolation of\n // the texture coordinate\n float y_a = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_a.y + 2.0) / 2.0) / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (u_pattern_size_b.y + 2.0) / 2.0) / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n gl_FragColor = color * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_linesofar = a_linesofar;\n v_width2 = vec2(outset, inset);\n}\n"},lineSDF:{fragmentSource:"\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + ANTIALIASING;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist =outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x / floorwidth, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x / floorwidth, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n v_width2 = vec2(outset, inset);\n}\n"},raster:{fragmentSource:"uniform float u_fade_t;\nuniform float u_opacity;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n if (color0.a > 0.0) {\n color0.rgb = color0.rgb / color0.a;\n }\n if (color1.a > 0.0) {\n color1.rgb = color1.rgb / color1.a;\n }\n vec4 color = mix(color0, color1, u_fade_t);\n color.a *= u_opacity;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n // We are using Int16 for texture position coordinates to give us enough precision for\n // fractional coordinates. We use 8192 to scale the texture coordinates in the buffer\n // as an arbitrarily high number to preserve adequate precision when rendering.\n // This is also the same value as the EXTENT we are using for our tile buffer pos coordinates,\n // so math for modifying either is consistent.\n v_pos0 = (((a_texture_pos / 8192.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},symbolIcon:{fragmentSource:"uniform sampler2D u_texture;\n\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n lowp float alpha = opacity * v_fade_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\nuniform highp float u_camera_to_center_distance;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform float u_fade_change;\n\n#pragma mapbox: define lowp float opacity\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n\n float size;\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // See comments in symbol_sdf.vertex\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles\n 4.0);\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // See comments in symbol_sdf.vertex\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);\n\n v_tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n v_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n}\n"},symbolSDF:{fragmentSource:"#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO\n\nuniform bool u_is_halo;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform sampler2D u_texture;\nuniform highp float u_gamma_scale;\nuniform bool u_is_text;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 tex = v_data0.xy;\n float gamma_scale = v_data1.x;\n float size = v_data1.y;\n float fade_opacity = v_data1[2];\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n lowp vec4 color = fill_color;\n highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);\n lowp float buff = (256.0 - 64.0) / 256.0;\n if (u_is_halo) {\n color = halo_color;\n gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n }\n\n lowp float dist = texture2D(u_texture, tex).a;\n highp float gamma_scaled = gamma * gamma_scale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n gl_FragColor = color * (alpha * opacity * fade_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\n// contents of a_size vary based on the type of property value\n// used for {text,icon}-size.\n// For constants, a_size is disabled.\n// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature.\n// For composite functions:\n// [ text-size(lowerZoomStop, feature),\n// text-size(upperZoomStop, feature) ]\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\n\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform highp float u_camera_to_center_distance;\nuniform float u_fade_change;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n float size;\n\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // If the label is pitched with the map, layout is done in pitched space,\n // which makes labels in the distance smaller relative to viewport space.\n // We counteract part of that effect by multiplying by the perspective ratio.\n // If the label isn't pitched with the map, we do layout in viewport space,\n // which makes labels in the distance larger relative to the features around\n // them. We counteract part of that effect by dividing by the perspective ratio.\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = clamp(\n 0.5 + 0.5 * distance_ratio,\n 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles\n 4.0);\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // Point labels with 'rotation-alignment: map' are horizontal with respect to tile units\n // To figure out that angle in projected space, we draw a short horizontal line in tile\n // space, project it, and measure its angle in projected space.\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0);\n float gamma_scale = gl_Position.w;\n\n vec2 tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n\n v_data0 = vec2(tex.x, tex.y);\n v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity);\n}\n"}},rr=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,nr=function(t){var e=er[t],r={};e.fragmentSource=e.fragmentSource.replace(rr,function(t,e,n,a,i){return r[i]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nvarying "+n+" "+a+" "+i+";\n#else\nuniform "+n+" "+a+" u_"+i+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+i+"\n "+n+" "+a+" "+i+" = u_"+i+";\n#endif\n"}),e.vertexSource=e.vertexSource.replace(rr,function(t,e,n,a,i){var o="float"===a?"vec2":"vec4";return r[i]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float a_"+i+"_t;\nattribute "+n+" "+o+" a_"+i+";\nvarying "+n+" "+a+" "+i+";\n#else\nuniform "+n+" "+a+" u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+i+" = unpack_mix_"+o+"(a_"+i+", a_"+i+"_t);\n#else\n "+n+" "+a+" "+i+" = u_"+i+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float a_"+i+"_t;\nattribute "+n+" "+o+" a_"+i+";\n#else\nuniform "+n+" "+a+" u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+n+" "+a+" "+i+" = unpack_mix_"+o+"(a_"+i+", a_"+i+"_t);\n#else\n "+n+" "+a+" "+i+" = u_"+i+";\n#endif\n"})};for(var ar in er)nr(ar);var ir=er,or=function(t,e,r,n){var a=t.gl;this.program=a.createProgram();var o=r.defines().concat("#define DEVICE_PIXEL_RATIO "+i.devicePixelRatio.toFixed(1));n&&o.push("#define OVERDRAW_INSPECTOR;");var s=o.concat(ir.prelude.fragmentSource,e.fragmentSource).join("\n"),l=o.concat(ir.prelude.vertexSource,e.vertexSource).join("\n"),u=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(u,s),a.compileShader(u),a.attachShader(this.program,u);var c=a.createShader(a.VERTEX_SHADER);a.shaderSource(c,l),a.compileShader(c),a.attachShader(this.program,c);for(var f=r.layoutAttributes||[],h=0;h>16,s>>16),n.uniform2f(r.uniforms.u_pixel_coord_lower,65535&o,65535&s)};function xr(t,e,r,n,a){if(!gr(r.paint.get("fill-pattern"),t))for(var i=!0,o=0,s=n;o0){var l=i.now(),u=(l-e.timeAdded)/s,c=r?(l-r.timeAdded)/s:-1,f=n.getSource(),h=o.coveringZoomLevel({tileSize:f.tileSize,roundZoom:f.roundZoom}),p=!r||Math.abs(r.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),d=p&&e.refreshedUponExpiration?1:t.clamp(p?u:1-c,0,1);return e.refreshedUponExpiration&&u>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}function Lr(e,r,n){var a=e.context,o=a.gl;a.lineWidth.set(1*i.devicePixelRatio);var s=n.posMatrix,l=e.useProgram("debug");a.setDepthMode(Ht.disabled),a.setStencilMode(Gt.disabled),a.setColorMode(e.colorModeForRenderPass()),o.uniformMatrix4fv(l.uniforms.u_matrix,!1,s),o.uniform4f(l.uniforms.u_color,1,0,0,1),e.debugVAO.bind(a,l,e.debugBuffer,[]),o.drawArrays(o.LINE_STRIP,0,e.debugBuffer.length);for(var u=function(t,e,r,n){n=n||1;var a,i,o,s,l,u,c,f,h=[];for(a=0,i=t.length;a":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]};var zr={symbol:function(t,e,r,n){if("translucent"===t.renderPass){var a=t.context;a.setStencilMode(Gt.disabled),a.setColorMode(t.colorModeForRenderPass()),0!==r.paint.get("icon-opacity").constantOr(1)&&fr(t,e,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright")),0!==r.paint.get("text-opacity").constantOr(1)&&fr(t,e,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright")),e.map.showCollisionBoxes&&function(t,e,r,n){lr(t,e,r,n,!1),lr(t,e,r,n,!0)}(t,e,r,n)}},circle:function(t,e,r,n){if("translucent"===t.renderPass){var a=r.paint.get("circle-opacity"),i=r.paint.get("circle-stroke-width"),o=r.paint.get("circle-stroke-opacity");if(0!==a.constantOr(1)||0!==i.constantOr(1)&&0!==o.constantOr(1)){var s=t.context,l=s.gl;s.setDepthMode(t.depthModeForSublayer(0,Ht.ReadOnly)),s.setStencilMode(Gt.disabled),s.setColorMode(t.colorModeForRenderPass());for(var u=!0,c=0;c0?1-1/(1.001-a):-a),s.uniform1f(u.uniforms.u_contrast_factor,(i=r.paint.get("raster-contrast"))>0?1/(1-i):1+i),s.uniform3fv(u.uniforms.u_spin_weights,function(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}(r.paint.get("raster-hue-rotate"))),s.uniform1f(u.uniforms.u_buffer_scale,1),s.uniform1i(u.uniforms.u_image0,0),s.uniform1i(u.uniforms.u_image1,1);for(var c=n.length&&n[0].overscaledZ,f=0,h=n;fe.row){var r=t;t=e,e=r}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function Dr(t,e,r,n,a){var i=Math.max(r,Math.floor(e.y0)),o=Math.min(n,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx0,f=e.dx<0,h=i;hl.dy&&(o=s,s=l,l=o),s.dy>u.dy&&(o=s,s=u,u=o),l.dy>u.dy&&(o=l,l=u,u=o),s.dy&&Dr(u,s,n,a,i),l.dy&&Dr(u,l,n,a,i)}Pr.prototype.resize=function(t,e){var r=this.context.gl;if(this.width=t*i.devicePixelRatio,this.height=e*i.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var n=0,a=this.style._order;n=0;this.currentLayer--){var m=n.style._layers[s[n.currentLayer]];m.source!==(v&&v.id)&&(g=[],(v=n.style.sourceCaches[m.source])&&(n.clearStencil(),g=v.getVisibleCoordinates(),v.getSource().isTileClipped&&n._renderTileClippingMasks(g))),n.renderLayer(n,v,m,g)}this.renderPass="translucent";var y,x=[];for(this.currentLayer=0,this.currentLayer;this.currentLayer0?e.pop():null},Pr.prototype._createProgramCached=function(t,e){this.cache=this.cache||{};var r=""+t+(e.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new or(this.context,ir[t],e,this._showOverdrawInspector)),this.cache[r]},Pr.prototype.useProgram=function(t,e){var r=this._createProgramCached(t,e||this.emptyProgramConfiguration);return this.context.program.set(r.program),r};var Br=t.default$20.vec4,Fr=t.default$20.mat4,Nr=t.default$20.mat2,jr=function(t,e,r){this.tileSize=512,this._renderWorldCopies=void 0===r||r,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new W(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._posMatrixCache={},this._alignedPosMatrixCache={}},Vr={minZoom:{configurable:!0},maxZoom:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerPoint:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},unmodified:{configurable:!0},x:{configurable:!0},y:{configurable:!0},point:{configurable:!0}};jr.prototype.clone=function(){var t=new jr(this._minZoom,this._maxZoom,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._calcMatrices(),t},Vr.minZoom.get=function(){return this._minZoom},Vr.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},Vr.maxZoom.get=function(){return this._maxZoom},Vr.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},Vr.renderWorldCopies.get=function(){return this._renderWorldCopies},Vr.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},Vr.worldSize.get=function(){return this.tileSize*this.scale},Vr.centerPoint.get=function(){return this.size._div(2)},Vr.size.get=function(){return new t.default$1(this.width,this.height)},Vr.bearing.get=function(){return-this.angle/Math.PI*180},Vr.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=Nr.create(),Nr.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},Vr.pitch.get=function(){return this._pitch/Math.PI*180},Vr.pitch.set=function(e){var r=t.clamp(e,0,60)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},Vr.fov.get=function(){return this._fov/Math.PI*180},Vr.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},Vr.zoom.get=function(){return this._zoom},Vr.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},Vr.center.get=function(){return this._center},Vr.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},jr.prototype.coveringZoomLevel=function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},jr.prototype.getVisibleUnwrappedCoordinates=function(e){var r=this.pointCoordinate(new t.default$1(0,0),0),n=this.pointCoordinate(new t.default$1(this.width,0),0),a=Math.floor(r.column),i=Math.floor(n.column),o=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var s=a;s<=i;s++)0!==s&&o.push(new t.UnwrappedTileID(s,e));return o},jr.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),n=r;if(void 0!==e.minzoom&&re.maxzoom&&(r=e.maxzoom);var a=this.pointCoordinate(this.centerPoint,r),i=new t.default$1(a.column-.5,a.row-.5);return function(e,r,n,a){void 0===a&&(a=!0);var i=1<=0&&l<=i)for(u=r;uo&&(a=o-v)}if(this.lngRange){var g=this.x,m=u.x/2;g-ml&&(n=l-m)}void 0===n&&void 0===a||(this.center=this.unproject(new t.default$1(void 0!==n?n:this.x,void 0!==a?a:this.y))),this._unmodified=c,this._constraining=!1}},jr.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var t=this._fov/2,e=Math.PI/2+this._pitch,r=Math.sin(t)*this.cameraToCenterDistance/Math.sin(Math.PI-e-t),n=this.x,a=this.y,i=1.01*(Math.cos(Math.PI/2-this._pitch)*r+this.cameraToCenterDistance),o=new Float64Array(16);Fr.perspective(o,this._fov,this.width/this.height,1,i),Fr.scale(o,o,[1,-1,1]),Fr.translate(o,o,[0,0,-this.cameraToCenterDistance]),Fr.rotateX(o,o,this._pitch),Fr.rotateZ(o,o,this.angle),Fr.translate(o,o,[-n,-a,0]);var s=this.worldSize/(2*Math.PI*6378137*Math.abs(Math.cos(this.center.lat*(Math.PI/180))));Fr.scale(o,o,[1,1,s,1]),this.projMatrix=o;var l=this.width%2/2,u=this.height%2/2,c=Math.cos(this.angle),f=Math.sin(this.angle),h=n-Math.round(n)+c*l+f*u,p=a-Math.round(a)+c*u+f*l,d=new Float64Array(o);if(Fr.translate(d,d,[h>.5?h-1:h,p>.5?p-1:p,0]),this.alignedProjMatrix=d,o=Fr.create(),Fr.scale(o,o,[this.width/2,-this.height/2,1]),Fr.translate(o,o,[1,-1,0]),this.pixelMatrix=Fr.multiply(new Float64Array(16),o,this.projMatrix),!(o=Fr.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={}}},jr.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.default$1(0,0)).zoomTo(this.zoom),r=[e.column*this.tileSize,e.row*this.tileSize,0,1];return Br.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},Object.defineProperties(jr.prototype,Vr);var Ur=function(){var e,r,n,a,i;t.bindAll(["_onHashChange","_updateHash"],this),this._updateHash=(e=this._updateHashUnthrottled.bind(this),r=300,n=!1,a=0,i=function(){a=0,n&&(e(),a=setTimeout(i,r),n=!1)},function(){return n=!0,a||i(),a})};Ur.prototype.addTo=function(e){return this._map=e,t.default.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},Ur.prototype.remove=function(){return t.default.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},Ur.prototype.getHashString=function(t){var e=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,n),i=Math.round(e.lng*a)/a,o=Math.round(e.lat*a)/a,s=this._map.getBearing(),l=this._map.getPitch(),u="";return u+=t?"#/"+i+"/"+o+"/"+r:"#"+r+"/"+o+"/"+i,(s||l)&&(u+="/"+Math.round(10*s)/10),l&&(u+="/"+Math.round(l)),u},Ur.prototype._onHashChange=function(){var e=t.default.location.hash.replace("#","").split("/");return e.length>=3&&(this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:+(e[3]||0),pitch:+(e[4]||0)}),!0)},Ur.prototype._updateHashUnthrottled=function(){var e=this.getHashString();t.default.history.replaceState(t.default.history.state,"",e)};var qr=function(e){function r(r,n,a,i){void 0===i&&(i={});var o=s.mousePos(n.getCanvasContainer(),a),l=n.unproject(o);e.call(this,r,t.extend({point:o,lngLat:l,originalEvent:a},i)),this._defaultPrevented=!1,this.target=n}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var n={defaultPrevented:{configurable:!0}};return r.prototype.preventDefault=function(){this._defaultPrevented=!0},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(r.prototype,n),r}(t.Event),Hr=function(e){function r(r,n,a){var i=s.touchPos(n.getCanvasContainer(),a),o=i.map(function(t){return n.unproject(t)}),l=i.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new t.default$1(0,0)),u=n.unproject(l);e.call(this,r,{points:i,point:l,lngLats:o,lngLat:u,originalEvent:a}),this._defaultPrevented=!1}e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r;var n={defaultPrevented:{configurable:!0}};return r.prototype.preventDefault=function(){this._defaultPrevented=!0},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(r.prototype,n),r}(t.Event),Gr=function(t){function e(e,r,n){t.call(this,e,{originalEvent:n}),this._defaultPrevented=!1}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,r),e}(t.Event),Wr=function(e){this._map=e,this._el=e.getCanvasContainer(),this._delta=0,t.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};Wr.prototype.isEnabled=function(){return!!this._enabled},Wr.prototype.isActive=function(){return!!this._active},Wr.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},Wr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Wr.prototype.onWheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.default.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=i.now(),a=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(a*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this.isActive()||this._start(e)),e.preventDefault()}},Wr.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this.isActive()||this._start(t)},Wr.prototype._start=function(e){if(this._delta){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),this._active=!0,this._map.fire(new t.Event("movestart",{originalEvent:e})),this._map.fire(new t.Event("zoomstart",{originalEvent:e})),this._finishTimeout&&clearTimeout(this._finishTimeout);var r=s.mousePos(this._el,e);this._around=W.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(r)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame))}},Wr.prototype._onScrollFrame=function(){var e=this;if(this._frameId=null,this.isActive()){var r=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?1/450:.01,a=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==a&&(a=1/a);var o="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(o*a))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var s=!1;if("wheel"===this._type){var l=Math.min((i.now()-this._lastWheelEventTime)/200,1),u=this._easing(l);r.zoom=t.number(this._startZoom,this._targetZoom,u),l<1?this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame)):s=!0}else r.zoom=this._targetZoom,s=!0;r.setLocationAtPoint(this._around,this._aroundPoint),this._map.fire(new t.Event("move",{originalEvent:this._lastWheelEvent})),this._map.fire(new t.Event("zoom",{originalEvent:this._lastWheelEvent})),s&&(this._active=!1,this._finishTimeout=setTimeout(function(){e._map.fire(new t.Event("zoomend",{originalEvent:e._lastWheelEvent})),e._map.fire(new t.Event("moveend",{originalEvent:e._lastWheelEvent})),delete e._targetZoom},200))}},Wr.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var n=this._prevEase,a=(i.now()-n.start)/n.duration,o=n.easing(a+.01)-n.easing(a),s=.27/Math.sqrt(o*o+1e-4)*.01,l=Math.sqrt(.0729-s*s);r=t.bezier(s,l,.25,1)}return this._prevEase={start:i.now(),duration:e,easing:r},r};var Yr=function(e){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),t.bindAll(["_onMouseMove","_onMouseUp","_onKeyDown"],this)};Yr.prototype.isEnabled=function(){return!!this._enabled},Yr.prototype.isActive=function(){return!!this._active},Yr.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},Yr.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},Yr.prototype.onMouseDown=function(e){this.isEnabled()&&e.shiftKey&&0===e.button&&(t.default.document.addEventListener("mousemove",this._onMouseMove,!1),t.default.document.addEventListener("keydown",this._onKeyDown,!1),t.default.document.addEventListener("mouseup",this._onMouseUp,!1),s.disableDrag(),this._startPos=s.mousePos(this._el,e),this._active=!0)},Yr.prototype._onMouseMove=function(t){var e=this._startPos,r=s.mousePos(this._el,t);this._box||(this._box=s.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(e.x,r.x),a=Math.max(e.x,r.x),i=Math.min(e.y,r.y),o=Math.max(e.y,r.y);s.setTransform(this._box,"translate("+n+"px,"+i+"px)"),this._box.style.width=a-n+"px",this._box.style.height=o-i+"px"},Yr.prototype._onMouseUp=function(e){if(0===e.button){var r=this._startPos,n=s.mousePos(this._el,e),a=(new Y).extend(this._map.unproject(r)).extend(this._map.unproject(n));this._finish(),s.suppressClick(),r.x===n.x&&r.y===n.y?this._fireEvent("boxzoomcancel",e):this._map.fitBounds(a,{linear:!0}).fire(new t.Event("boxzoomend",{originalEvent:e,boxZoomBounds:a}))}},Yr.prototype._onKeyDown=function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},Yr.prototype._finish=function(){this._active=!1,t.default.document.removeEventListener("mousemove",this._onMouseMove,!1),t.default.document.removeEventListener("keydown",this._onKeyDown,!1),t.default.document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(s.remove(this._box),this._box=null),s.enableDrag()},Yr.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,{originalEvent:r}))};var Xr=t.bezier(0,0,.25,1),Zr=function(e,r){this._map=e,this._el=r.element||e.getCanvasContainer(),this._state="disabled",this._button=r.button||"right",this._bearingSnap=r.bearingSnap||0,this._pitchWithRotate=!1!==r.pitchWithRotate,t.bindAll(["_onMouseMove","_onMouseUp","_onBlur","_onDragFrame"],this)};Zr.prototype.isEnabled=function(){return"disabled"!==this._state},Zr.prototype.isActive=function(){return"active"===this._state},Zr.prototype.enable=function(){this.isEnabled()||(this._state="enabled")},Zr.prototype.disable=function(){if(this.isEnabled())switch(this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend"),this._pitchWithRotate&&this._fireEvent("pitchend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled"}},Zr.prototype.onMouseDown=function(e){if("enabled"===this._state){if("right"===this._button){if(this._eventButton=s.mouseButton(e),this._eventButton!==(e.ctrlKey?0:2))return}else{if(e.ctrlKey||0!==s.mouseButton(e))return;this._eventButton=0}s.disableDrag(),t.default.document.addEventListener("mousemove",this._onMouseMove,{capture:!0}),t.default.document.addEventListener("mouseup",this._onMouseUp),t.default.addEventListener("blur",this._onBlur),this._state="pending",this._inertia=[[i.now(),this._map.getBearing()]],this._previousPos=s.mousePos(this._el,e),this._center=this._map.transform.centerPoint,e.preventDefault()}},Zr.prototype._onMouseMove=function(t){this._lastMoveEvent=t,this._pos=s.mousePos(this._el,t),"pending"===this._state&&(this._state="active",this._fireEvent("rotatestart",t),this._fireEvent("movestart",t),this._pitchWithRotate&&this._fireEvent("pitchstart",t)),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame))},Zr.prototype._onDragFrame=function(){this._frameId=null;var t=this._lastMoveEvent;if(t){var e=this._map.transform,r=this._previousPos,n=this._pos,a=.8*(r.x-n.x),o=-.5*(r.y-n.y),s=e.bearing-a,l=e.pitch-o,u=this._inertia,c=u[u.length-1];this._drainInertiaBuffer(),u.push([i.now(),this._map._normalizeBearing(s,c[1])]),e.bearing=s,this._pitchWithRotate&&(this._fireEvent("pitch",t),e.pitch=l),this._fireEvent("rotate",t),this._fireEvent("move",t),delete this._lastMoveEvent,this._previousPos=this._pos}},Zr.prototype._onMouseUp=function(t){if(s.mouseButton(t)===this._eventButton)switch(this._state){case"active":this._state="enabled",s.suppressClick(),this._unbind(),this._deactivate(),this._inertialRotate(t);break;case"pending":this._state="enabled",this._unbind()}},Zr.prototype._onBlur=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend",t),this._pitchWithRotate&&this._fireEvent("pitchend",t),this._fireEvent("moveend",t);break;case"pending":this._state="enabled",this._unbind()}},Zr.prototype._unbind=function(){t.default.document.removeEventListener("mousemove",this._onMouseMove,{capture:!0}),t.default.document.removeEventListener("mouseup",this._onMouseUp),t.default.removeEventListener("blur",this._onBlur),s.enableDrag()},Zr.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._previousPos},Zr.prototype._inertialRotate=function(t){var e=this;this._fireEvent("rotateend",t),this._drainInertiaBuffer();var r=this._map,n=r.getBearing(),a=this._inertia,i=function(){Math.abs(n)180&&(p=180);var d=p/180;u+=f*p*(d/2),Math.abs(r._normalizeBearing(u,0))0&&e-t[0][0]>160;)t.shift()};var $r=t.bezier(0,0,.3,1),Jr=function(e){this._map=e,this._el=e.getCanvasContainer(),this._state="disabled",t.bindAll(["_onMove","_onMouseUp","_onTouchEnd","_onBlur","_onDragFrame"],this)};Jr.prototype.isEnabled=function(){return"disabled"!==this._state},Jr.prototype.isActive=function(){return"active"===this._state},Jr.prototype.enable=function(){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._state="enabled")},Jr.prototype.disable=function(){if(this.isEnabled())switch(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("dragend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled"}},Jr.prototype.onMouseDown=function(e){"enabled"===this._state&&(e.ctrlKey||0!==s.mouseButton(e)||(s.addEventListener(t.default.document,"mousemove",this._onMove,{capture:!0}),s.addEventListener(t.default.document,"mouseup",this._onMouseUp),this._start(e)))},Jr.prototype.onTouchStart=function(e){"enabled"===this._state&&(e.touches.length>1||(s.addEventListener(t.default.document,"touchmove",this._onMove,{capture:!0,passive:!1}),s.addEventListener(t.default.document,"touchend",this._onTouchEnd),this._start(e)))},Jr.prototype._start=function(e){t.default.addEventListener("blur",this._onBlur),this._state="pending",this._previousPos=s.mousePos(this._el,e),this._inertia=[[i.now(),this._previousPos]]},Jr.prototype._onMove=function(t){this._lastMoveEvent=t,t.preventDefault(),this._pos=s.mousePos(this._el,t),this._drainInertiaBuffer(),this._inertia.push([i.now(),this._pos]),"pending"===this._state&&(this._state="active",this._fireEvent("dragstart",t),this._fireEvent("movestart",t)),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame))},Jr.prototype._onDragFrame=function(){this._frameId=null;var t=this._lastMoveEvent;if(t){var e=this._map.transform;e.setLocationAtPoint(e.pointLocation(this._previousPos),this._pos),this._fireEvent("drag",t),this._fireEvent("move",t),this._previousPos=this._pos,delete this._lastMoveEvent}},Jr.prototype._onMouseUp=function(t){if(0===s.mouseButton(t))switch(this._state){case"active":this._state="enabled",s.suppressClick(),this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind()}},Jr.prototype._onTouchEnd=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind()}},Jr.prototype._onBlur=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._fireEvent("dragend",t),this._fireEvent("moveend",t);break;case"pending":this._state="enabled",this._unbind()}},Jr.prototype._unbind=function(){s.removeEventListener(t.default.document,"touchmove",this._onMove,{capture:!0,passive:!1}),s.removeEventListener(t.default.document,"touchend",this._onTouchEnd),s.removeEventListener(t.default.document,"mousemove",this._onMove,{capture:!0}),s.removeEventListener(t.default.document,"mouseup",this._onMouseUp),s.removeEventListener(t.default,"blur",this._onBlur)},Jr.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._previousPos,delete this._pos},Jr.prototype._inertialPan=function(t){this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=this._inertia;if(e.length<2)this._fireEvent("moveend",t);else{var r=e[e.length-1],n=e[0],a=r[1].sub(n[1]),i=(r[0]-n[0])/1e3;if(0===i||r[1].equals(n[1]))this._fireEvent("moveend",t);else{var o=a.mult(.3/i),s=o.mag();s>1400&&(s=1400,o._unit()._mult(s));var l=s/750,u=o.mult(-l/2);this._map.panBy(u,{duration:1e3*l,easing:$r,noMoveStart:!0},{originalEvent:t})}}},Jr.prototype._fireEvent=function(e,r){return this._map.fire(new t.Event(e,r?{originalEvent:r}:{}))},Jr.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=i.now();t.length>0&&e-t[0][0]>160;)t.shift()};var Kr=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onKeyDown"],this)};function Qr(t){return t*(2-t)}Kr.prototype.isEnabled=function(){return!!this._enabled},Kr.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},Kr.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},Kr.prototype._onKeyDown=function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=0,r=0,n=0,a=0,i=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),i=-1);break;case 40:t.shiftKey?n=-1:(i=1,t.preventDefault());break;default:return}var o=this._map,s=o.getZoom(),l={duration:300,delayEndEvents:500,easing:Qr,zoom:e?Math.round(s)+e*(t.shiftKey?2:1):s,bearing:o.getBearing()+15*r,pitch:o.getPitch()+10*n,offset:[100*-a,100*-i],center:o.getCenter()};o.easeTo(l,{originalEvent:t})}};var tn=function(e){this._map=e,t.bindAll(["_onDblClick","_onZoomEnd"],this)};tn.prototype.isEnabled=function(){return!!this._enabled},tn.prototype.isActive=function(){return!!this._active},tn.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},tn.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},tn.prototype.onTouchStart=function(t){var e=this;this.isEnabled()&&(t.points.length>1||(this._tapped?(clearTimeout(this._tapped),this._tapped=null,this._zoom(t)):this._tapped=setTimeout(function(){e._tapped=null},300)))},tn.prototype.onDblClick=function(t){this.isEnabled()&&(t.originalEvent.preventDefault(),this._zoom(t))},tn.prototype._zoom=function(t){this._active=!0,this._map.on("zoomend",this._onZoomEnd),this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)},tn.prototype._onZoomEnd=function(){this._active=!1,this._map.off("zoomend",this._onZoomEnd)};var en=t.bezier(0,0,.15,1),rn=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onMove","_onEnd","_onTouchFrame"],this)};rn.prototype.isEnabled=function(){return!!this._enabled},rn.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)},rn.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._enabled=!1)},rn.prototype.disableRotation=function(){this._rotationDisabled=!0},rn.prototype.enableRotation=function(){this._rotationDisabled=!1},rn.prototype.onStart=function(e){if(this.isEnabled()&&2===e.touches.length){var r=s.mousePos(this._el,e.touches[0]),n=s.mousePos(this._el,e.touches[1]);this._startVec=r.sub(n),this._gestureIntent=void 0,this._inertia=[],s.addEventListener(t.default.document,"touchmove",this._onMove,{passive:!1}),s.addEventListener(t.default.document,"touchend",this._onEnd)}},rn.prototype._getTouchEventData=function(t){var e=s.mousePos(this._el,t.touches[0]),r=s.mousePos(this._el,t.touches[1]),n=e.sub(r);return{vec:n,center:e.add(r).div(2),scale:n.mag()/this._startVec.mag(),bearing:this._rotationDisabled?0:180*n.angleWith(this._startVec)/Math.PI}},rn.prototype._onMove=function(e){if(2===e.touches.length){var r=this._getTouchEventData(e),n=r.vec,a=r.scale,i=r.bearing;if(!this._gestureIntent){var o=Math.abs(1-a)>.15;Math.abs(i)>10?this._gestureIntent="rotate":o&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._map.fire(new t.Event(this._gestureIntent+"start",{originalEvent:e})),this._map.fire(new t.Event("movestart",{originalEvent:e})),this._startVec=n)}this._lastTouchEvent=e,this._frameId||(this._frameId=this._map._requestRenderFrame(this._onTouchFrame)),e.preventDefault()}},rn.prototype._onTouchFrame=function(){this._frameId=null;var e=this._gestureIntent;if(e){var r=this._map.transform;this._startScale||(this._startScale=r.scale,this._startBearing=r.bearing);var n=this._getTouchEventData(this._lastTouchEvent),a=n.center,o=n.bearing,s=n.scale,l=r.pointLocation(a),u=r.locationPoint(l);"rotate"===e&&(r.bearing=this._startBearing+o),r.zoom=r.scaleZoom(this._startScale*s),r.setLocationAtPoint(l,u),this._map.fire(new t.Event(e,{originalEvent:this._lastTouchEvent})),this._map.fire(new t.Event("move",{originalEvent:this._lastTouchEvent})),this._drainInertiaBuffer(),this._inertia.push([i.now(),s,a])}},rn.prototype._onEnd=function(e){s.removeEventListener(t.default.document,"touchmove",this._onMove,{passive:!1}),s.removeEventListener(t.default.document,"touchend",this._onEnd);var r=this._gestureIntent,n=this._startScale;if(this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._gestureIntent,delete this._startScale,delete this._startBearing,delete this._lastTouchEvent,r){this._map.fire(new t.Event(r+"end",{originalEvent:e})),this._drainInertiaBuffer();var a=this._inertia,i=this._map;if(a.length<2)i.snapToNorth({},{originalEvent:e});else{var o=a[a.length-1],l=a[0],u=i.transform.scaleZoom(n*o[1]),c=i.transform.scaleZoom(n*l[1]),f=u-c,h=(o[0]-l[0])/1e3,p=o[2];if(0!==h&&u!==c){var d=.15*f/h;Math.abs(d)>2.5&&(d=d>0?2.5:-2.5);var v=1e3*Math.abs(d/(12*.15)),g=u+d*v/2e3;g<0&&(g=0),i.easeTo({zoom:g,duration:v,easing:en,around:this._aroundCenter?i.getCenter():i.unproject(p),noMoveStart:!0},{originalEvent:e})}else i.snapToNorth({},{originalEvent:e})}}},rn.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=i.now();t.length>2&&e-t[0][0]>160;)t.shift()};var nn={scrollZoom:Wr,boxZoom:Yr,dragRotate:Zr,dragPan:Jr,keyboard:Kr,doubleClickZoom:tn,touchZoomRotate:rn};var an=function(e){function r(r,n){e.call(this),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=n.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.getCenter=function(){return this.transform.center},r.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},r.prototype.panBy=function(e,r,n){return e=t.default$1.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},r),n)},r.prototype.panTo=function(e,r,n){return this.easeTo(t.extend({center:e},r),n)},r.prototype.getZoom=function(){return this.transform.zoom},r.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},r.prototype.zoomTo=function(e,r,n){return this.easeTo(t.extend({zoom:e},r),n)},r.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},r.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},r.prototype.getBearing=function(){return this.transform.bearing},r.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},r.prototype.rotateTo=function(e,r,n){return this.easeTo(t.extend({bearing:e},r),n)},r.prototype.resetNorth=function(e,r){return this.rotateTo(0,t.extend({duration:1e3},e),r),this},r.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())e?1:0}),["bottom","left","right","top"]))return t.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'"),this;e=Y.convert(e);var i=[(r.padding.left-r.padding.right)/2,(r.padding.top-r.padding.bottom)/2],o=Math.min(r.padding.right,r.padding.left),s=Math.min(r.padding.top,r.padding.bottom);r.offset=[r.offset[0]+i[0],r.offset[1]+i[1]];var l=t.default$1.convert(r.offset),u=this.transform,c=u.project(e.getNorthWest()),f=u.project(e.getSouthEast()),h=f.sub(c),p=(u.width-2*o-2*Math.abs(l.x))/h.x,d=(u.height-2*s-2*Math.abs(l.y))/h.y;return d<0||p<0?(t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset."),this):(r.center=u.unproject(c.add(f).div(2)),r.zoom=Math.min(u.scaleZoom(u.scale*Math.min(p,d)),r.maxZoom),r.bearing=0,r.linear?this.easeTo(r,n):this.flyTo(r,n))},r.prototype.jumpTo=function(e,r){this.stop();var n=this.transform,a=!1,i=!1,o=!1;return"zoom"in e&&n.zoom!==+e.zoom&&(a=!0,n.zoom=+e.zoom),void 0!==e.center&&(n.center=W.convert(e.center)),"bearing"in e&&n.bearing!==+e.bearing&&(i=!0,n.bearing=+e.bearing),"pitch"in e&&n.pitch!==+e.pitch&&(o=!0,n.pitch=+e.pitch),this.fire(new t.Event("movestart",r)).fire(new t.Event("move",r)),a&&this.fire(new t.Event("zoomstart",r)).fire(new t.Event("zoom",r)).fire(new t.Event("zoomend",r)),i&&this.fire(new t.Event("rotatestart",r)).fire(new t.Event("rotate",r)).fire(new t.Event("rotateend",r)),o&&this.fire(new t.Event("pitchstart",r)).fire(new t.Event("pitch",r)).fire(new t.Event("pitchend",r)),this.fire(new t.Event("moveend",r))},r.prototype.easeTo=function(e,r){var n=this;this.stop(),!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate&&(e.duration=0);var a=this.transform,i=this.getZoom(),o=this.getBearing(),s=this.getPitch(),l="zoom"in e?+e.zoom:i,u="bearing"in e?this._normalizeBearing(e.bearing,o):o,c="pitch"in e?+e.pitch:s,f=a.centerPoint.add(t.default$1.convert(e.offset)),h=a.pointLocation(f),p=W.convert(e.center||h);this._normalizeCenter(p);var d,v,g=a.project(h),m=a.project(p).sub(g),y=a.zoomScale(l-i);return e.around&&(d=W.convert(e.around),v=a.locationPoint(d)),this._zooming=l!==i,this._rotating=o!==u,this._pitching=c!==s,this._prepareEase(r,e.noMoveStart),clearTimeout(this._easeEndTimeoutID),this._ease(function(e){if(n._zooming&&(a.zoom=t.number(i,l,e)),n._rotating&&(a.bearing=t.number(o,u,e)),n._pitching&&(a.pitch=t.number(s,c,e)),d)a.setLocationAtPoint(d,v);else{var h=a.zoomScale(a.zoom-i),p=l>i?Math.min(2,y):Math.max(.5,y),x=Math.pow(p,1-e),b=a.unproject(g.add(m.mult(e*x)).mult(h));a.setLocationAtPoint(a.renderWorldCopies?b.wrap():b,f)}n._fireMoveEvents(r)},function(){e.delayEndEvents?n._easeEndTimeoutID=setTimeout(function(){return n._afterEase(r)},e.delayEndEvents):n._afterEase(r)},e),this},r.prototype._prepareEase=function(e,r){this._moving=!0,r||this.fire(new t.Event("movestart",e)),this._zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&this.fire(new t.Event("pitchstart",e))},r.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},r.prototype._afterEase=function(e){var r=this._zooming,n=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,r&&this.fire(new t.Event("zoomend",e)),n&&this.fire(new t.Event("rotateend",e)),a&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))},r.prototype.flyTo=function(e,r){var n=this;this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var a=this.transform,i=this.getZoom(),o=this.getBearing(),s=this.getPitch(),l="zoom"in e?t.clamp(+e.zoom,a.minZoom,a.maxZoom):i,u="bearing"in e?this._normalizeBearing(e.bearing,o):o,c="pitch"in e?+e.pitch:s,f=a.zoomScale(l-i),h=a.centerPoint.add(t.default$1.convert(e.offset)),p=a.pointLocation(h),d=W.convert(e.center||p);this._normalizeCenter(d);var v=a.project(p),g=a.project(d).sub(v),m=e.curve,y=Math.max(a.width,a.height),x=y/f,b=g.mag();if("minZoom"in e){var _=t.clamp(Math.min(e.minZoom,i,l),a.minZoom,a.maxZoom),w=y/a.zoomScale(_-i);m=Math.sqrt(w/b*2)}var k=m*m;function M(t){var e=(x*x-y*y+(t?-1:1)*k*k*b*b)/(2*(t?x:y)*k*b);return Math.log(Math.sqrt(e*e+1)-e)}function A(t){return(Math.exp(t)-Math.exp(-t))/2}function T(t){return(Math.exp(t)+Math.exp(-t))/2}var S=M(0),E=function(t){return T(S)/T(S+m*t)},C=function(t){return y*((T(S)*(A(e=S+m*t)/T(e))-A(S))/k)/b;var e},L=(M(1)-S)/m;if(Math.abs(b)<1e-6||!isFinite(L)){if(Math.abs(y-x)<1e-6)return this.easeTo(e,r);var I=xe.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==u,this._pitching=c!==s,this._prepareEase(r,!1),this._ease(function(e){var l=e*L,f=1/E(l);a.zoom=i+a.scaleZoom(f),n._rotating&&(a.bearing=t.number(o,u,e)),n._pitching&&(a.pitch=t.number(s,c,e));var p=a.unproject(v.add(g.mult(C(l))).mult(f));a.setLocationAtPoint(a.renderWorldCopies?p.wrap():p,h),n._fireMoveEvents(r)},function(){return n._afterEase(r)},e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var t=this._onEaseEnd;delete this._onEaseEnd,t.call(this)}return this},r.prototype._ease=function(t,e,r){!1===r.animate||0===r.duration?(t(1),e()):(this._easeStart=i.now(),this._easeOptions=r,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.prototype._renderFrameCallback=function(){var t=Math.min((i.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var n=Math.abs(e-r);return Math.abs(e-360-r)180?-360:r<-180?360:0}},r}(t.Evented),on=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};on.prototype.getDefaultPosition=function(){return"bottom-right"},on.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=s.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},on.prototype.onRemove=function(){s.remove(this._container),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0},on.prototype._updateEditLink=function(){var t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));var e=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:g.ACCESS_TOKEN}];if(t){var r=e.reduce(function(t,r,n){return r.value&&(t+=r.key+"="+r.value+(n=0)return!1;return!0})).length?(this._container.innerHTML=t.join(" | "),this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null}},on.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")};var sn=function(){t.bindAll(["_updateLogo"],this)};sn.prototype.onAdd=function(t){this._map=t,this._container=s.create("div","mapboxgl-ctrl");var e=s.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.href="https://www.mapbox.com/",e.setAttribute("aria-label","Mapbox logo"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._container},sn.prototype.onRemove=function(){s.remove(this._container),this._map.off("sourcedata",this._updateLogo)},sn.prototype.getDefaultPosition=function(){return"bottom-left"},sn.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},sn.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t){if(t[e].getSource().mapbox_logo)return!0}return!1}};var ln=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};ln.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},ln.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,n=e?this._queue.concat(e):this._queue;re.maxZoom)throw new Error("maxZoom must be greater than minZoom");var n=new jr(e.minZoom,e.maxZoom,e.renderWorldCopies);r.call(this,n,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new ln;var a=e.transformRequest;if(this._transformRequest=a?function(t,e){return a(t,e)||{url:t}}:function(t){return{url:t}},"string"==typeof e.container){var i=t.default.document.getElementById(e.container);if(!i)throw new Error("Container '"+e.container+"' not found.");this._container=i}else{if(!(e.container instanceof cn))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render","_onData","_onDataLoading"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),void 0!==t.default&&(t.default.addEventListener("online",this._onWindowOnline,!1),t.default.addEventListener("resize",this._onWindowResize,!1)),function(t,e){var r=t.getCanvasContainer(),n=null,a=!1;for(var i in nn)t[i]=new nn[i](t,e),e.interactive&&e[i]&&t[i].enable(e[i]);s.addEventListener(r,"mouseout",function(e){t.fire(new qr("mouseout",t,e))}),s.addEventListener(r,"mousedown",function(r){a=!0;var n=new qr("mousedown",t,r);t.fire(n),n.defaultPrevented||(e.interactive&&!t.doubleClickZoom.isActive()&&t.stop(),t.boxZoom.onMouseDown(r),t.boxZoom.isActive()||t.dragPan.isActive()||t.dragRotate.onMouseDown(r),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onMouseDown(r))}),s.addEventListener(r,"mouseup",function(e){var r=t.dragRotate.isActive();n&&!r&&t.fire(new qr("contextmenu",t,n)),n=null,a=!1,t.fire(new qr("mouseup",t,e))}),s.addEventListener(r,"mousemove",function(e){if(!t.dragPan.isActive()&&!t.dragRotate.isActive()){for(var n=e.toElement||e.target;n&&n!==r;)n=n.parentNode;n===r&&t.fire(new qr("mousemove",t,e))}}),s.addEventListener(r,"mouseover",function(e){for(var n=e.toElement||e.target;n&&n!==r;)n=n.parentNode;n===r&&t.fire(new qr("mouseover",t,e))}),s.addEventListener(r,"touchstart",function(r){var n=new Hr("touchstart",t,r);t.fire(n),n.defaultPrevented||(e.interactive&&t.stop(),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onTouchStart(r),t.touchZoomRotate.onStart(r),t.doubleClickZoom.onTouchStart(n))},{passive:!1}),s.addEventListener(r,"touchmove",function(e){t.fire(new Hr("touchmove",t,e))},{passive:!1}),s.addEventListener(r,"touchend",function(e){t.fire(new Hr("touchend",t,e))}),s.addEventListener(r,"touchcancel",function(e){t.fire(new Hr("touchcancel",t,e))}),s.addEventListener(r,"click",function(e){t.fire(new qr("click",t,e))}),s.addEventListener(r,"dblclick",function(e){var r=new qr("dblclick",t,e);t.fire(r),r.defaultPrevented||t.doubleClickZoom.onDblClick(r)}),s.addEventListener(r,"contextmenu",function(e){var r=t.dragRotate.isActive();a||r?a&&(n=e):t.fire(new qr("contextmenu",t,e)),e.preventDefault()}),s.addEventListener(r,"wheel",function(e){var r=new Gr("wheel",t,e);t.fire(r),r.defaultPrevented||t.scrollZoom.onWheel(e)},{passive:!1})}(this,e),this._hash=e.hash&&(new Ur).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),this.resize(),e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new on),this.addControl(new sn,e.logoPosition),this.on("style.load",function(){this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",this._onData),this.on("dataloading",this._onDataLoading)}r&&(n.__proto__=r),n.prototype=Object.create(r&&r.prototype),n.prototype.constructor=n;var a={showTileBoundaries:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0}};return n.prototype.addControl=function(t,e){void 0===e&&t.getDefaultPosition&&(e=t.getDefaultPosition()),void 0===e&&(e="top-right");var r=t.onAdd(this),n=this._controlPositions[e];return-1!==e.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this},n.prototype.removeControl=function(t){return t.onRemove(this),this},n.prototype.resize=function(e){var r=this._containerDimensions(),n=r[0],a=r[1];return this._resizeCanvas(n,a),this.transform.resize(n,a),this.painter.resize(n,a),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e)).fire(new t.Event("resize",e)).fire(new t.Event("moveend",e))},n.prototype.getBounds=function(){var e=new Y(this.transform.pointLocation(new t.default$1(0,this.transform.height)),this.transform.pointLocation(new t.default$1(this.transform.width,0)));return(this.transform.angle||this.transform.pitch)&&(e.extend(this.transform.pointLocation(new t.default$1(this.transform.size.x,0))),e.extend(this.transform.pointLocation(new t.default$1(0,this.transform.size.y)))),e},n.prototype.getMaxBounds=function(){return this.transform.latRange&&2===this.transform.latRange.length&&this.transform.lngRange&&2===this.transform.lngRange.length?new Y([this.transform.lngRange[0],this.transform.latRange[0]],[this.transform.lngRange[1],this.transform.latRange[1]]):null},n.prototype.setMaxBounds=function(t){if(t){var e=Y.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null==t&&(this.transform.lngRange=null,this.transform.latRange=null,this._update());return this},n.prototype.setMinZoom=function(t){if((t=null==t?0:t)>=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},n.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},n.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update(),this},n.prototype.getMaxZoom=function(){return this.transform.maxZoom},n.prototype.project=function(t){return this.transform.locationPoint(W.convert(t))},n.prototype.unproject=function(e){return this.transform.pointLocation(t.default$1.convert(e))},n.prototype.isMoving=function(){return this._moving||this.dragPan.isActive()||this.dragRotate.isActive()||this.scrollZoom.isActive()},n.prototype.isZooming=function(){return this._zooming||this.scrollZoom.isActive()},n.prototype.isRotating=function(){return this._rotating||this.dragRotate.isActive()},n.prototype.on=function(t,e,n){var a,i=this;if(void 0===n)return r.prototype.on.call(this,t,e);var o=function(){if("mouseenter"===t||"mouseover"===t){var r=!1;return{layer:e,listener:n,delegates:{mousemove:function(a){var o=i.getLayer(e)?i.queryRenderedFeatures(a.point,{layers:[e]}):[];o.length?r||(r=!0,n.call(i,new qr(t,i,a.originalEvent,{features:o}))):r=!1},mouseout:function(){r=!1}}}}if("mouseleave"===t||"mouseout"===t){var o=!1;return{layer:e,listener:n,delegates:{mousemove:function(r){(i.getLayer(e)?i.queryRenderedFeatures(r.point,{layers:[e]}):[]).length?o=!0:o&&(o=!1,n.call(i,new qr(t,i,r.originalEvent)))},mouseout:function(e){o&&(o=!1,n.call(i,new qr(t,i,e.originalEvent)))}}}}return{layer:e,listener:n,delegates:(a={},a[t]=function(t){var r=i.getLayer(e)?i.queryRenderedFeatures(t.point,{layers:[e]}):[];r.length&&(t.features=r,n.call(i,t),delete t.features)},a)}}();for(var s in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(o),o.delegates)i.on(s,o.delegates[s]);return this},n.prototype.off=function(t,e,n){if(void 0===n)return r.prototype.off.call(this,t,e);if(this._delegatedListeners&&this._delegatedListeners[t])for(var a=this._delegatedListeners[t],i=0;i180;){var o=r.locationPoint(t);if(o.x>=0&&o.y>=0&&o.x<=r.width&&o.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}vn.prototype._rotateCompassArrow=function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t},vn.prototype.onAdd=function(t){return this._map=t,this.options.showCompass&&(this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Zr(t,{button:"left",element:this._compass}),this._handler.enable()),this._container},vn.prototype.onRemove=function(){s.remove(this._container),this.options.showCompass&&(this._map.off("rotate",this._rotateCompassArrow),this._handler.disable(),delete this._handler),delete this._map},vn.prototype._createButton=function(t,e,r){var n=s.create("button",t,this._container);return n.type="button",n.setAttribute("aria-label",e),n.addEventListener("click",r),n};var mn={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function yn(t,e,r){var n=t.classList;for(var a in mn)n.remove("mapboxgl-"+r+"-anchor-"+a);n.add("mapboxgl-"+r+"-anchor-"+e)}var xn=function(e){if((arguments[0]instanceof t.default.HTMLElement||2===arguments.length)&&(e=t.extend({element:e},arguments[1])),t.bindAll(["_update","_onMapClick"],this),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",e&&e.element)this._element=e.element,this._offset=t.default$1.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=s.create("div");var r=s.createNS("http://www.w3.org/2000/svg","svg");r.setAttributeNS(null,"height","41px"),r.setAttributeNS(null,"width","27px"),r.setAttributeNS(null,"viewBox","0 0 27 41");var n=s.createNS("http://www.w3.org/2000/svg","g");n.setAttributeNS(null,"stroke","none"),n.setAttributeNS(null,"stroke-width","1"),n.setAttributeNS(null,"fill","none"),n.setAttributeNS(null,"fill-rule","evenodd");var a=s.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"fill-rule","nonzero");var i=s.createNS("http://www.w3.org/2000/svg","g");i.setAttributeNS(null,"transform","translate(3.0, 29.0)"),i.setAttributeNS(null,"fill","#000000");for(var o=0,l=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];o5280)Tn(e,u,h/5280,"mi");else Tn(e,u,h,"ft")}else if(r&&"nautical"===r.unit){Tn(e,u,f/1852,"nm")}else Tn(e,u,f,"m")}function Tn(t,e,r,n){var a,i,o,s=(a=r,(i=Math.pow(10,(""+Math.floor(a)).length-1))*(o=(o=a/i)>=10?10:o>=5?5:o>=3?3:o>=2?2:1)),l=s/r;"m"===n&&s>=1e3&&(s/=1e3,n="km"),t.style.width=e*l+"px",t.innerHTML=s+n}Mn.prototype.getDefaultPosition=function(){return"bottom-left"},Mn.prototype._onMove=function(){An(this._map,this._container,this.options)},Mn.prototype.onAdd=function(t){return this._map=t,this._container=s.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},Mn.prototype.onRemove=function(){s.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},Mn.prototype.setUnit=function(t){this.options.unit=t,An(this._map,this._container,this.options)};var Sn=function(){this._fullscreen=!1,t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.default.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.default.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.default.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.default.document&&(this._fullscreenchange="MSFullscreenChange"),this._className="mapboxgl-ctrl"};Sn.prototype.onAdd=function(e){return this._map=e,this._mapContainer=this._map.getContainer(),this._container=s.create("div",this._className+" mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._container.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._container},Sn.prototype.onRemove=function(){s.remove(this._container),this._map=null,t.default.document.removeEventListener(this._fullscreenchange,this._changeIcon)},Sn.prototype._checkFullscreenSupport=function(){return!!(t.default.document.fullscreenEnabled||t.default.document.mozFullScreenEnabled||t.default.document.msFullscreenEnabled||t.default.document.webkitFullscreenEnabled)},Sn.prototype._setupUI=function(){var e=this._fullscreenButton=s.create("button",this._className+"-icon "+this._className+"-fullscreen",this._container);e.setAttribute("aria-label","Toggle fullscreen"),e.type="button",this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.default.document.addEventListener(this._fullscreenchange,this._changeIcon)},Sn.prototype._isFullscreen=function(){return this._fullscreen},Sn.prototype._changeIcon=function(){(t.default.document.fullscreenElement||t.default.document.mozFullScreenElement||t.default.document.webkitFullscreenElement||t.default.document.msFullscreenElement)===this._mapContainer!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(this._className+"-shrink"),this._fullscreenButton.classList.toggle(this._className+"-fullscreen"))},Sn.prototype._onClickFullscreen=function(){this._isFullscreen()?t.default.document.exitFullscreen?t.default.document.exitFullscreen():t.default.document.mozCancelFullScreen?t.default.document.mozCancelFullScreen():t.default.document.msExitFullscreen?t.default.document.msExitFullscreen():t.default.document.webkitCancelFullScreen&&t.default.document.webkitCancelFullScreen():this._mapContainer.requestFullscreen?this._mapContainer.requestFullscreen():this._mapContainer.mozRequestFullScreen?this._mapContainer.mozRequestFullScreen():this._mapContainer.msRequestFullscreen?this._mapContainer.msRequestFullscreen():this._mapContainer.webkitRequestFullscreen&&this._mapContainer.webkitRequestFullscreen()};var En={closeButton:!0,closeOnClick:!0},Cn=function(e){function r(r){e.call(this),this.options=t.extend(Object.create(En),r),t.bindAll(["_update","_onClickClose"],this)}return e&&(r.__proto__=e),r.prototype=Object.create(e&&e.prototype),r.prototype.constructor=r,r.prototype.addTo=function(e){return this._map=e,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this.fire(new t.Event("open")),this},r.prototype.isOpen=function(){return!!this._map},r.prototype.remove=function(){return this._content&&s.remove(this._content),this._container&&(s.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire(new t.Event("close")),this},r.prototype.getLngLat=function(){return this._lngLat},r.prototype.setLngLat=function(t){return this._lngLat=W.convert(t),this._pos=null,this._update(),this},r.prototype.setText=function(e){return this.setDOMContent(t.default.document.createTextNode(e))},r.prototype.setHTML=function(e){var r,n=t.default.document.createDocumentFragment(),a=t.default.document.createElement("body");for(a.innerHTML=e;r=a.firstChild;)n.appendChild(r);return this.setDOMContent(n)},r.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},r.prototype._createContent=function(){this._content&&s.remove(this._content),this._content=s.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=s.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},r.prototype._update=function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=s.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=s.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content)),this._map.transform.renderWorldCopies&&(this._lngLat=gn(this._lngLat,this._pos,this._map.transform));var e=this._pos=this._map.project(this._lngLat),r=this.options.anchor,n=function e(r){if(r){if("number"==typeof r){var n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.default$1(0,0),top:new t.default$1(0,r),"top-left":new t.default$1(n,n),"top-right":new t.default$1(-n,n),bottom:new t.default$1(0,-r),"bottom-left":new t.default$1(n,-n),"bottom-right":new t.default$1(-n,-n),left:new t.default$1(r,0),right:new t.default$1(-r,0)}}if(r instanceof t.default$1||Array.isArray(r)){var a=t.default$1.convert(r);return{center:a,top:a,"top-left":a,"top-right":a,bottom:a,"bottom-left":a,"bottom-right":a,left:a,right:a}}return{center:t.default$1.convert(r.center||[0,0]),top:t.default$1.convert(r.top||[0,0]),"top-left":t.default$1.convert(r["top-left"]||[0,0]),"top-right":t.default$1.convert(r["top-right"]||[0,0]),bottom:t.default$1.convert(r.bottom||[0,0]),"bottom-left":t.default$1.convert(r["bottom-left"]||[0,0]),"bottom-right":t.default$1.convert(r["bottom-right"]||[0,0]),left:t.default$1.convert(r.left||[0,0]),right:t.default$1.convert(r.right||[0,0])}}return e(new t.default$1(0,0))}(this.options.offset);if(!r){var a,i=this._container.offsetWidth,o=this._container.offsetHeight;a=e.y+n.bottom.ythis._map.transform.height-o?["bottom"]:[],e.xthis._map.transform.width-i/2&&a.push("right"),r=0===a.length?"bottom":a.join("-")}var l=e.add(n[r]).round();s.setTransform(this._container,mn[r]+" translate("+l.x+"px,"+l.y+"px)"),yn(this._container,r,"popup")}},r.prototype._onClickClose=function(){this.remove()},r}(t.Evented);var Ln={version:"0.45.0",supported:e,workerCount:Math.max(Math.floor(i.hardwareConcurrency/2),1),setRTLTextPlugin:t.setRTLTextPlugin,Map:hn,NavigationControl:vn,GeolocateControl:wn,AttributionControl:on,ScaleControl:Mn,FullscreenControl:Sn,Popup:Cn,Marker:xn,Style:Qe,LngLat:W,LngLatBounds:Y,Point:t.default$1,Evented:t.Evented,config:g,get accessToken(){return g.ACCESS_TOKEN},set accessToken(t){g.ACCESS_TOKEN=t},workerUrl:""};return Ln});return n})}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],394:[function(t,e,r){"use strict";e.exports=o;var n=t("convex-hull");function a(t,e,r){var n=new Array(t);for(var a=0;ap[1][2])b[0]=-b[0];if(p[0][2]>p[2][0])b[1]=-b[1];if(p[1][0]>p[0][1])b[2]=-b[2];return true};function v(t,e,r){var n=e[0],a=e[1],i=e[2],o=e[3];t[0]=r[0]*n+r[4]*a+r[8]*i+r[12]*o;t[1]=r[1]*n+r[5]*a+r[9]*i+r[13]*o;t[2]=r[2]*n+r[6]*a+r[10]*i+r[14]*o;t[3]=r[3]*n+r[7]*a+r[11]*i+r[15]*o;return t}function g(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 m(t,e,r,n,a){t[0]=e[0]*n+r[0]*a;t[1]=e[1]*n+r[1]*a;t[2]=e[2]*n+r[2]*a}},{"./normalize":396,"gl-mat4/clone":248,"gl-mat4/create":249,"gl-mat4/determinant":250,"gl-mat4/invert":254,"gl-mat4/transpose":264,"gl-vec3/cross":314,"gl-vec3/dot":317,"gl-vec3/length":322,"gl-vec3/normalize":328}],396:[function(t,e,r){e.exports=function t(e,r){var n=r[15];if(n===0)return false;var a=1/n;for(var i=0;i<16;i++)e[i]=r[i]*a;return true}},{}],397:[function(t,e,r){var n=t("gl-vec3/lerp");var a=t("mat4-recompose");var i=t("mat4-decompose");var o=t("gl-mat4/determinant");var s=t("quat-slerp");var l=h();var u=h();var c=h();e.exports=f;function f(t,e,r,f){if(o(e)===0||o(r)===0)return false;var h=i(e,l.translate,l.scale,l.skew,l.perspective,l.quaternion);var p=i(r,u.translate,u.scale,u.skew,u.perspective,u.quaternion);if(!h||!p)return false;n(c.translate,l.translate,u.translate,f);n(c.skew,l.skew,u.skew,f);n(c.scale,l.scale,u.scale,f);n(c.perspective,l.perspective,u.perspective,f);s(c.quaternion,l.quaternion,u.quaternion,f);a(t,c.translate,c.scale,c.skew,c.perspective,c.quaternion);return true}function h(){return{translate:p(),scale:p(1),skew:p(),perspective:d(),quaternion:d()}}function p(t){return[t||0,t||0,t||0]}function d(){return[0,0,0,1]}},{"gl-mat4/determinant":250,"gl-vec3/lerp":323,"mat4-decompose":395,"mat4-recompose":398,"quat-slerp":450}],398:[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")};var a=n.create();var i=n.create();e.exports=function t(e,r,a,o,s,l){n.identity(e);n.fromRotationTranslation(e,l,r);e[3]=s[0];e[7]=s[1];e[11]=s[2];e[15]=s[3];n.identity(i);if(o[2]!==0){i[9]=o[2];n.multiply(e,e,i)}if(o[1]!==0){i[9]=0;i[8]=o[1];n.multiply(e,e,i)}if(o[0]!==0){i[8]=0;i[4]=o[0];n.multiply(e,e,i)}n.scale(e,e,a);return e}},{"gl-mat4/create":249,"gl-mat4/fromRotationTranslation":252,"gl-mat4/identity":253,"gl-mat4/multiply":256,"gl-mat4/scale":262,"gl-mat4/translate":263}],399:[function(t,e,r){"use strict";e.exports=Math.log2||function(t){return Math.log(t)*Math.LOG2E}},{}],400:[function(t,e,r){"use strict";var n=t("binary-search-bounds");var a=t("mat4-interpolate");var i=t("gl-mat4/invert");var o=t("gl-mat4/rotateX");var s=t("gl-mat4/rotateY");var l=t("gl-mat4/rotateZ");var u=t("gl-mat4/lookAt");var c=t("gl-mat4/translate");var f=t("gl-mat4/scale");var h=t("gl-vec3/normalize");var p=[0,0,0];e.exports=m;function d(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=[-Infinity,Infinity]}var v=d.prototype;v.recalcMatrix=function(t){var e=this._time;var r=n.le(e,t);var o=this.computedMatrix;if(r<0){return}var s=this._components;if(r===e.length-1){var l=16*r;for(var u=0;u<16;++u){o[u]=s[l++]}}else{var c=e[r+1]-e[r];var l=16*r;var f=this.prevMatrix;var p=true;for(var u=0;u<16;++u){f[u]=s[l++]}var d=this.nextMatrix;for(var u=0;u<16;++u){d[u]=s[l++];p=p&&f[u]===d[u]}if(c<1e-6||p){for(var u=0;u<16;++u){o[u]=f[u]}}else{a(o,f,d,(t-e[r])/c)}}var v=this.computedUp;v[0]=o[1];v[1]=o[5];v[2]=o[9];h(v,v);var g=this.computedInverse;i(g,o);var m=this.computedEye;var y=g[15];m[0]=g[12]/y;m[1]=g[13]/y;m[2]=g[14]/y;var x=this.computedCenter;var b=Math.exp(this.computedRadius[0]);for(var u=0;u<3;++u){x[u]=m[u]-o[2+4*u]*b}};v.idle=function(t){if(t1&&n(t[o[c-2]],t[o[c-1]],u)<=0){c-=1;o.pop()}o.push(l);c=s.length;while(c>1&&n(t[s[c-2]],t[s[c-1]],u)>=0){c-=1;s.pop()}s.push(l)}var r=new Array(s.length+o.length-2);var f=0;for(var a=0,h=o.length;a0;--p){r[f++]=s[p]}return r}},{"robust-orientation":471}],402:[function(t,e,r){"use strict";e.exports=a;var n=t("mouse-event");function a(t,e){if(!e){e=t;t=window}var r=0;var a=0;var i=0;var o={shift:false,alt:false,control:false,meta:false};var s=false;function l(t){var e=false;if("altKey"in t){e=e||t.altKey!==o.alt;o.alt=!!t.altKey}if("shiftKey"in t){e=e||t.shiftKey!==o.shift;o.shift=!!t.shiftKey}if("ctrlKey"in t){e=e||t.ctrlKey!==o.control;o.control=!!t.ctrlKey}if("metaKey"in t){e=e||t.metaKey!==o.meta;o.meta=!!t.metaKey}return e}function u(t,s){var u=n.x(s);var c=n.y(s);if("buttons"in s){t=s.buttons|0}if(t!==r||u!==a||c!==i||l(s)){r=t|0;a=u||0;i=c||0;e&&e(r,a,i,o)}}function c(t){u(0,t)}function f(){if(r||a||i||o.shift||o.alt||o.meta||o.control){a=i=0;r=0;o.shift=o.alt=o.control=o.meta=false;e&&e(0,0,0,o)}}function h(t){if(l(t)){e&&e(r,a,i,o)}}function p(t){if(n.buttons(t)===0){u(0,t)}else{u(r,t)}}function d(t){u(r|n.buttons(t),t)}function v(t){u(r&~n.buttons(t),t)}function g(){if(s){return}s=true;t.addEventListener("mousemove",p);t.addEventListener("mousedown",d);t.addEventListener("mouseup",v);t.addEventListener("mouseleave",c);t.addEventListener("mouseenter",c);t.addEventListener("mouseout",c);t.addEventListener("mouseover",c);t.addEventListener("blur",f);t.addEventListener("keyup",h);t.addEventListener("keydown",h);t.addEventListener("keypress",h);if(t!==window){window.addEventListener("blur",f);window.addEventListener("keyup",h);window.addEventListener("keydown",h);window.addEventListener("keypress",h)}}function m(){if(!s){return}s=false;t.removeEventListener("mousemove",p);t.removeEventListener("mousedown",d);t.removeEventListener("mouseup",v);t.removeEventListener("mouseleave",c);t.removeEventListener("mouseenter",c);t.removeEventListener("mouseout",c);t.removeEventListener("mouseover",c);t.removeEventListener("blur",f);t.removeEventListener("keyup",h);t.removeEventListener("keydown",h);t.removeEventListener("keypress",h);if(t!==window){window.removeEventListener("blur",f);window.removeEventListener("keyup",h);window.removeEventListener("keydown",h);window.removeEventListener("keypress",h)}}g();var y={element:t};Object.defineProperties(y,{enabled:{get:function(){return s},set:function(t){if(t){g()}else{m()}},enumerable:true},buttons:{get:function(){return r},enumerable:true},x:{get:function(){return a},enumerable:true},y:{get:function(){return i},enumerable:true},mods:{get:function(){return o},enumerable:true}});return y}},{"mouse-event":404}],403:[function(t,e,r){var n={left:0,top:0};e.exports=a;function a(t,e,r){e=e||t.currentTarget||t.srcElement;if(!Array.isArray(r)){r=[0,0]}var n=t.clientX||0;var a=t.clientY||0;var o=i(e);r[0]=n-o.left;r[1]=a-o.top;return r}function i(t){if(t===window||t===document||t===document.body){return n}else{return t.getBoundingClientRect()}}},{}],404:[function(t,e,r){"use strict";function n(t){if(typeof t==="object"){if("buttons"in t){return t.buttons}else if("which"in t){var e=t.which;if(e===2){return 4}else if(e===3){return 2}else if(e>0){return 1<=0){return 1<0){N.push(l(D,S[R-1])+"*"+s(S[R-1]))}P.push(d(D,S[R])+"=("+N.join("-")+")|0")}}for(var D=0;D=0;--D){j.push(s(S[D]))}P.push(w+"=("+j.join("*")+")|0",b+"=mallocUint32("+w+")",x+"=mallocUint32("+w+")",k+"=0");P.push(v(0)+"=0");for(var R=1;R<1<=0;--e){G(e,0)}var r=[];for(var e=0;e0;M=M-1&d){w.push(x+"["+k+"+"+m(M)+"]")}w.push(y(0));for(var M=0;M0){",p(S[t]),"=1;");$(t-1,e|1< 0")}if(typeof t.vertex!=="function"){e("Must specify vertex creation function")}if(typeof t.cell!=="function"){e("Must specify cell creation function")}if(typeof t.phase!=="function"){e("Must specify phase function")}var i=t.getters||[];var o=new Array(n);for(var s=0;s=0){o[s]=true}else{o[s]=false}}return T(t.vertex,t.cell,t.phase,a,r,o)}},{"typedarray-pool":507}],407:[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:false,rvalue:true,count:1},{name:"_inline_1_arg1_",lvalue:true,rvalue:false,count:1},{name:"_inline_1_arg2_",lvalue:false,rvalue:true,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:false,funcName:"cwise",blockSize:64});e.exports=function(t,e){n(t,e);return t}},{"cwise/lib/wrapper":136}],408:[function(t,e,r){"use strict";e.exports=h;var n=t("dup");var a=t("cwise-compiler");var i={};var o={};var s={body:"",args:[],thisVars:[],localVars:[]};var l=a({args:["array","array","array"],pre:s,post:s,body:{args:[{name:"out",lvalue:true,rvalue:false,count:1},{name:"left",lvalue:false,rvalue:true,count:1},{name:"right",lvalue:false,rvalue:true,count:1}],body:"out=0.5*(left-right)",thisVars:[],localVars:[]},funcName:"cdiff"});var u=a({args:["array"],pre:s,post:s,body:{args:[{name:"out",lvalue:true,rvalue:false,count:1}],body:"out=0",thisVars:[],localVars:[]},funcName:"zero"});function c(t){if(t in i){return i[t]}var e=[];for(var r=0;r=0){s.push("0")}else if(e.indexOf(-(l+1))>=0){s.push("s["+l+"]-1")}else{s.push("-1");i.push("1");o.push("s["+l+"]-2")}}var u=".lo("+i.join()+").hi("+o.join()+")";if(i.length===0){u=""}if(r>0){a.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0){continue}a.push("&&s[",l,"]>2")}a.push("){grad",r,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0){continue}a.push(",dst.pick(",s.join(),",",l,")",u)}a.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",h.join(),")-src.get(",p.join(),")))}else{dst.set(",s.join(),",",c,",0)};")}else{a.push("if(s[",c,"]>1){diff(",f,",src.pick(",h.join(),")",u,",src.pick(",p.join(),")",u,");}else{zero(",f,");};")}break;case"mirror":if(r===0){a.push("dst.set(",s.join(),",",c,",0);")}else{a.push("zero(",f,");")}break;case"wrap":var d=s.slice();var v=s.slice();if(e[l]<0){d[c]="s["+c+"]-2";v[c]="0"}else{d[c]="s["+c+"]-1";v[c]="1"}if(r===0){a.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",d.join(),")-src.get(",v.join(),")))}else{dst.set(",s.join(),",",c,",0)};")}else{a.push("if(s[",c,"]>2){diff(",f,",src.pick(",d.join(),")",u,",src.pick(",v.join(),")",u,");}else{zero(",f,");};")}break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}if(r>0){a.push("};")}}for(var f=0;f<1<>",rrshift:">>>"};(function(){for(var t in l){var e=l[t];r[t]=s({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t});r[t+"eq"]=s({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:true,funcName:t+"eq"});r[t+"s"]=s({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"});r[t+"seq"]=s({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:true,funcName:t+"seq"})}})();var u={not:"!",bnot:"~",neg:"-",recip:"1.0/"};(function(){for(var t in u){var e=u[t];r[t]=s({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t});r[t+"eq"]=s({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:true,count:2,funcName:t+"eq"})}})();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};(function(){for(var t in c){var e=c[t];r[t]=s({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t});r[t+"s"]=s({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"});r[t+"eq"]=s({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:true,count:2,funcName:t+"eq"});r[t+"seq"]=s({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:true,count:2,funcName:t+"seq"})}})();var f=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];(function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"});r.norm1=n({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:false,rvalue:true,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=n({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:false,rvalue:true,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}});r.inf=n({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:false,rvalue:true,count:2},{name:"_inline_1_arg1_",lvalue:false,rvalue:true,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}});r.random=s({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=s({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"});r.assigns=s({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"});r.equals=n({args:["array","array"],pre:a,body:{args:[{name:"x",lvalue:false,rvalue:true,count:1},{name:"y",lvalue:false,rvalue:true,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":133}],412:[function(t,e,r){"use strict";var n=t("ndarray");var a=t("./doConvert.js");e.exports=function t(e,r){var i=[],o=e,s=1;while(Array.isArray(o)){i.push(o.length);s*=o.length;o=o[0]}if(i.length===0){return n()}if(!r){r=n(new Float64Array(s),i)}a(r,e);return r}},{"./doConvert.js":413,ndarray:417}],413:[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:true,rvalue:false,count:1},{name:"_inline_1_arg1_",lvalue:false,rvalue:true,count:1},{name:"_inline_1_arg2_",lvalue:false,rvalue:true,count:4}],thisVars:[],localVars:["_inline_1_i","_inline_1_v"]},post:{body:"{}",args:[],thisVars:[],localVars:[]},funcName:"convert",blockSize:64})},{"cwise-compiler":133}],414:[function(t,e,r){"use strict";var n=t("typedarray-pool");var a=32;function i(t){switch(t){case"uint8":return[n.mallocUint8,n.freeUint8];case"uint16":return[n.mallocUint16,n.freeUint16];case"uint32":return[n.mallocUint32,n.freeUint32];case"int8":return[n.mallocInt8,n.freeInt8];case"int16":return[n.mallocInt16,n.freeInt16];case"int32":return[n.mallocInt32,n.freeInt32];case"float32":return[n.mallocFloat,n.freeFloat];case"float64":return[n.mallocDouble,n.freeDouble];default:return null}}function o(t){var e=[];for(var r=0;r1){var u=[];for(var c=1;c1){r.push("dptr=0;sptr=ptr");for(var c=t.length-1;c>=0;--c){var p=t[c];if(p===0){continue}r.push(["for(i",p,"=0;i",p,"b){break __l}"].join(""));for(var c=t.length-1;c>=1;--c){r.push("sptr+=e"+c,"dptr+=f"+c,"}")}r.push("dptr=cptr;sptr=cptr-s0");for(var c=t.length-1;c>=0;--c){var p=t[c];if(p===0){continue}r.push(["for(i",p,"=0;i",p,"=0;--c){var p=t[c];if(p===0){continue}r.push(["for(i",p,"=0;i",p,"scratch)){",h("cptr",f("cptr-s0")),"cptr-=s0","}",h("cptr","scratch"))}r.push("}");if(t.length>1&&s){r.push("free(scratch)")}r.push("} return "+n);if(s){var d=new Function("malloc","free",r.join("\n"));return d(s[0],s[1])}else{var d=new Function(r.join("\n"));return d()}}function l(t,e,r){var n=["'use strict'"];var s=["ndarrayQuickSort",t.join("d"),e].join("");var l=["left","right","data","offset"].concat(o(t.length));var u=i(e);var c=0;n.push(["function ",s,"(",l.join(","),"){"].join(""));var f=["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){var h=[];for(var p=1;p=0;--i){var o=t[i];if(o===0){continue}n.push(["for(i",o,"=0;i",o,"1){for(var i=0;i1){n.push("ptr_shift+=d"+o)}else{n.push("ptr0+=d"+o)}n.push("}")}}function y(e,r,a,i){if(r.length===1){n.push("ptr0="+d(r[0]))}else{for(var o=0;o1){for(var o=0;o=1;--o){if(a){n.push("pivot_ptr+=f"+o)}if(r.length>1){n.push("ptr_shift+=e"+o)}else{n.push("ptr0+=e"+o)}n.push("}")}}function x(){if(t.length>1&&u){n.push("free(pivot1)","free(pivot2)")}}function b(e,r){var a="el"+e;var i="el"+r;if(t.length>1){var o="__l"+ ++c;y(o,[a,i],false,["comp=",v("ptr0"),"-",v("ptr1"),"\n","if(comp>0){tmp0=",a,";",a,"=",i,";",i,"=tmp0;break ",o,"}\n","if(comp<0){break ",o,"}"].join(""))}else{n.push(["if(",v(d(a)),">",v(d(i)),"){tmp0=",a,";",a,"=",i,";",i,"=tmp0}"].join(""))}}b(1,2);b(4,5);b(1,3);b(2,3);b(1,4);b(3,4);b(2,5);b(2,3);b(4,5);if(t.length>1){m(["el1","el2","el3","el4","el5","index1","index3","index5"],true,["pivot1[pivot_ptr]=",v("ptr1"),"\n","pivot2[pivot_ptr]=",v("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",v("ptr0"),"\n","y=",v("ptr2"),"\n","z=",v("ptr4"),"\n",g("ptr5","x"),"\n",g("ptr6","y"),"\n",g("ptr7","z")].join(""))}else{n.push(["pivot1=",v(d("el2")),"\n","pivot2=",v(d("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",v(d("el1")),"\n","y=",v(d("el3")),"\n","z=",v(d("el5")),"\n",g(d("index1"),"x"),"\n",g(d("index3"),"y"),"\n",g(d("index5"),"z")].join(""))}function _(e,r){if(t.length>1){m([e,r],false,g("ptr0",v("ptr1")))}else{n.push(g(d(e),v(d(r))))}}_("index2","left");_("index4","right");function w(e,r,a){if(t.length>1){var i="__l"+ ++c;y(i,[r],true,[e,"=",v("ptr0"),"-pivot",a,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else{n.push([e,"=",v(d(r)),"-pivot",a].join(""))}}function k(e,r){if(t.length>1){m([e,r],false,["tmp=",v("ptr0"),"\n",g("ptr0",v("ptr1")),"\n",g("ptr1","tmp")].join(""))}else{n.push(["ptr0=",d(e),"\n","ptr1=",d(r),"\n","tmp=",v("ptr0"),"\n",g("ptr0",v("ptr1")),"\n",g("ptr1","tmp")].join(""))}}function M(e,r,a){if(t.length>1){m([e,r,a],false,["tmp=",v("ptr0"),"\n",g("ptr0",v("ptr1")),"\n",g("ptr1",v("ptr2")),"\n",g("ptr2","tmp")].join(""));n.push("++"+r,"--"+a)}else{n.push(["ptr0=",d(e),"\n","ptr1=",d(r),"\n","ptr2=",d(a),"\n","++",r,"\n","--",a,"\n","tmp=",v("ptr0"),"\n",g("ptr0",v("ptr1")),"\n",g("ptr1",v("ptr2")),"\n",g("ptr2","tmp")].join(""))}}function A(t,e){k(t,e);n.push("--"+e)}n.push("if(pivots_are_equal){");n.push("for(k=less;k<=great;++k){");w("comp","k",1);n.push("if(comp===0){continue}");n.push("if(comp<0){");n.push("if(k!==less){");k("k","less");n.push("}");n.push("++less");n.push("}else{");n.push("while(true){");w("comp","great",1);n.push("if(comp>0){");n.push("great--");n.push("}else if(comp<0){");M("k","less","great");n.push("break");n.push("}else{");A("k","great");n.push("break");n.push("}");n.push("}");n.push("}");n.push("}");n.push("}else{");n.push("for(k=less;k<=great;++k){");w("comp_pivot1","k",1);n.push("if(comp_pivot1<0){");n.push("if(k!==less){");k("k","less");n.push("}");n.push("++less");n.push("}else{");w("comp_pivot2","k",2);n.push("if(comp_pivot2>0){");n.push("while(true){");w("comp","great",2);n.push("if(comp>0){");n.push("if(--great1){m([e,r],true,[g("ptr0",v("ptr1")),"\n",g("ptr1",["pivot",a,"[pivot_ptr]"].join(""))].join(""))}else{n.push(g(d(e),v(d(r))),g(d(r),"pivot"+a))}}T("left","(less-1)",1);T("right","(great+1)",2);function S(e,r){n.push(["if((",r,"-",e,")<=",a,"){\n","insertionSort(",e,",",r,",data,offset,",o(t.length).join(","),")\n","}else{\n",s,"(",e,",",r,",data,offset,",o(t.length).join(","),")\n","}"].join(""))}S("left","(less-2)");S("(great+2)","right");n.push("if(pivots_are_equal){");x();n.push("return");n.push("}");function E(e,r,a){if(t.length>1){n.push(["__l",++c,":while(true){"].join(""));m([e],true,["if(",v("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",c,"}"].join(""));n.push(a,"}")}else{n.push(["while(",v(d(e)),"===pivot",r,"){",a,"}"].join(""))}}n.push("if(lessindex5){");E("less",1,"++less");E("great",2,"--great");n.push("for(k=less;k<=great;++k){");w("comp_pivot1","k",1);n.push("if(comp_pivot1===0){");n.push("if(k!==less){");k("k","less");n.push("}");n.push("++less");n.push("}else{");w("comp_pivot2","k",2);n.push("if(comp_pivot2===0){");n.push("while(true){");w("comp","great",2);n.push("if(comp===0){");n.push("if(--great1&&u){var C=new Function("insertionSort","malloc","free",n.join("\n"));return C(r,u[0],u[1])}var C=new Function("insertionSort",n.join("\n"));return C(r)}function u(t,e){var r=["'use strict'"];var n=["ndarraySortWrapper",t.join("d"),e].join("");var i=["array"];r.push(["function ",n,"(",i.join(","),"){"].join(""));var u=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"];for(var c=0;c0){u.push(["d",g,"=s",g,"-d",d,"*n",d].join(""))}else{u.push(["d",g,"=s",g].join(""))}d=g}var p=t.length-1-c;if(p!==0){if(v>0){u.push(["e",p,"=s",p,"-e",v,"*n",v,",f",p,"=",f[p],"-f",v,"*n",v].join(""))}else{u.push(["e",p,"=s",p,",f",p,"=",f[p]].join(""))}v=p}}r.push("var "+u.join(","));var m=["0","n0-1","data","offset"].concat(o(t.length));r.push(["if(n0<=",a,"){","insertionSort(",m.join(","),")}else{","quickSort(",m.join(","),")}"].join(""));r.push("}return "+n);var y=new Function("insertionSort","quickSort",r.join("\n"));var x=s(t,e);var b=l(t,e,x);return y(x,b)}e.exports=u},{"typedarray-pool":507}],415:[function(t,e,r){"use strict";var n=t("./lib/compile_sort.js");var a={};function i(t){var e=t.order;var r=t.dtype;var i=[e,r];var o=i.join(":");var s=a[o];if(!s){a[o]=s=n(e,r)}s(t);return t}e.exports=i},{"./lib/compile_sort.js":414}],416:[function(t,e,r){"use strict";var n=t("ndarray-linear-interpolate");var a=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=new Array(_inline_3_arg4_)}",args:[{name:"_inline_3_arg0_",lvalue:false,rvalue:false,count:0},{name:"_inline_3_arg1_",lvalue:false,rvalue:false,count:0},{name:"_inline_3_arg2_",lvalue:false,rvalue:false,count:0},{name:"_inline_3_arg3_",lvalue:false,rvalue:false,count:0},{name:"_inline_3_arg4_",lvalue:false,rvalue:true,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_4_arg2_(this_warped,_inline_4_arg0_),_inline_4_arg1_=_inline_4_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_4_arg0_",lvalue:false,rvalue:true,count:1},{name:"_inline_4_arg1_",lvalue:true,rvalue:false,count:1},{name:"_inline_4_arg2_",lvalue:false,rvalue:true,count:1},{name:"_inline_4_arg3_",lvalue:false,rvalue:true,count:1},{name:"_inline_4_arg4_",lvalue:false,rvalue:false,count:0}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:false,funcName:"warpND",blockSize:64});var i=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_7_arg2_(this_warped,_inline_7_arg0_),_inline_7_arg1_=_inline_7_arg3_(_inline_7_arg4_,this_warped[0])}",args:[{name:"_inline_7_arg0_",lvalue:false,rvalue:true,count:1},{name:"_inline_7_arg1_",lvalue:true,rvalue:false,count:1},{name:"_inline_7_arg2_",lvalue:false,rvalue:true,count:1},{name:"_inline_7_arg3_",lvalue:false,rvalue:true,count:1},{name:"_inline_7_arg4_",lvalue:false,rvalue:true,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:false,funcName:"warp1D",blockSize:64});var o=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,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],this_warped[1])}",args:[{name:"_inline_10_arg0_",lvalue:false,rvalue:true,count:1},{name:"_inline_10_arg1_",lvalue:true,rvalue:false,count:1},{name:"_inline_10_arg2_",lvalue:false,rvalue:true,count:1},{name:"_inline_10_arg3_",lvalue:false,rvalue:true,count:1},{name:"_inline_10_arg4_",lvalue:false,rvalue:true,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:false,funcName:"warp2D",blockSize:64});var 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_13_arg2_(this_warped,_inline_13_arg0_),_inline_13_arg1_=_inline_13_arg3_(_inline_13_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_13_arg0_",lvalue:false,rvalue:true,count:1},{name:"_inline_13_arg1_",lvalue:true,rvalue:false,count:1},{name:"_inline_13_arg2_",lvalue:false,rvalue:true,count:1},{name:"_inline_13_arg3_",lvalue:false,rvalue:true,count:1},{name:"_inline_13_arg4_",lvalue:false,rvalue:true,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:false,funcName:"warp3D",blockSize:64});e.exports=function t(e,r,l){switch(r.shape.length){case 1:i(e,l,n.d1,r);break;case 2:o(e,l,n.d2,r);break;case 3:s(e,l,n.d3,r);break;default:a(e,l,n.bind(undefined,r),r.shape.length);break}return e}},{"cwise/lib/wrapper":136,"ndarray-linear-interpolate":410}],417:[function(t,e,r){var n=t("iota-array");var a=t("is-buffer");var i=typeof Float64Array!=="undefined";function o(t,e){return t[0]-e[0]}function s(){var t=this.stride;var e=new Array(t.length);var r;for(r=0;rMath.abs(this.stride[1]))?[1,0]:[0,1]}})")}else if(e===3){i.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];}}})")}}else{i.push("ORDER})")}}i.push("proto.set=function "+r+"_set("+u.join(",")+",v){");if(a){i.push("return this.data.set("+f+",v)}")}else{i.push("return this.data["+f+"]=v}")}i.push("proto.get=function "+r+"_get("+u.join(",")+"){");if(a){i.push("return this.data.get("+f+")}")}else{i.push("return this.data["+f+"]}")}i.push("proto.index=function "+r+"_index(",u.join(),"){return "+f+"}");i.push("proto.hi=function "+r+"_hi("+u.join(",")+"){return new "+r+"(this.data,"+l.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+l.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var d=l.map(function(t){return"a"+t+"=this.shape["+t+"]"});var v=l.map(function(t){return"c"+t+"=this.stride["+t+"]"});i.push("proto.lo=function "+r+"_lo("+u.join(",")+"){var b=this.offset,d=0,"+d.join(",")+","+v.join(","));for(var g=0;g=0){d=i"+g+"|0;b+=c"+g+"*d;a"+g+"-=d}")}i.push("return new "+r+"(this.data,"+l.map(function(t){return"a"+t}).join(",")+","+l.map(function(t){return"c"+t}).join(",")+",b)}");i.push("proto.step=function "+r+"_step("+u.join(",")+"){var "+l.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+l.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var g=0;g=0){c=(c+this.stride["+g+"]*i"+g+")|0}else{a.push(this.shape["+g+"]);b.push(this.stride["+g+"])}")}i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}");i.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+l.map(function(t){return"shape["+t+"]"}).join(",")+","+l.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var o=new Function("CTOR_LIST","ORDER",i.join("\n"));return o(c[t],s)}function u(t){if(a(t)){return"buffer"}if(i){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"}}if(Array.isArray(t)){return"array"}return"generic"}var c={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};(function(){for(var t in c){c[t].push(l(t,-1))}});function f(t,e,r,n){if(t===undefined){var a=c.array[0];return a([])}else if(typeof t==="number"){t=[t]}if(e===undefined){e=[t.length]}var i=e.length;if(r===undefined){r=new Array(i);for(var o=i-1,s=1;o>=0;--o){r[o]=s;s*=e[o]}}if(n===undefined){n=0;for(var o=0;o>>0;e.exports=o;function o(t,e){if(isNaN(t)||isNaN(e)){return NaN}if(t===e){return t}if(t===0){if(e<0){return-a}else{return a}}var r=n.hi(t);var o=n.lo(t);if(e>t===t>0){if(o===i){r+=1;o=0}else{o+=1}}else{if(o===0){o=i;r-=1}else{o-=1}}return n.pack(o,r)}},{"double-bits":151}],419:[function(t,e,r){var n=Math.PI;var a=c(120);e.exports=i;function i(t){var e;var r=[];var n=0;var a=0;var i=0;var u=0;var f=null;var h=null;var p=0;var d=0;for(var v=0,g=t.length;v7){r.push(m.splice(0,7));m.unshift("C")}break;case"S":var x=p;var b=d;if(e=="C"||e=="S"){x+=x-n;b+=b-a}m=["C",x,b,m[1],m[2],m[3],m[4]];break;case"T":if(e=="Q"||e=="T"){f=p*2-f;h=d*2-h}else{f=p;h=d}m=s(p,d,f,h,m[1],m[2]);break;case"Q":f=m[1];h=m[2];m=s(p,d,m[1],m[2],m[3],m[4]);break;case"L":m=o(p,d,m[1],m[2]);break;case"H":m=o(p,d,m[1],d);break;case"V":m=o(p,d,p,m[1]);break;case"Z":m=o(p,d,i,u);break}e=y;p=m[m.length-2];d=m[m.length-1];if(m.length>4){n=m[m.length-4];a=m[m.length-3]}else{n=p;a=d}r.push(m)}return r}function o(t,e,r,n){return["C",t,e,r,n,r,n]}function s(t,e,r,n,a,i){return["C",t/3+2/3*r,e/3+2/3*n,a/3+2/3*r,i/3+2/3*n,a,i]}function l(t,e,r,i,o,s,c,f,h,p){if(!p){var d=u(t,e,-o);t=d.x;e=d.y;d=u(f,h,-o);f=d.x;h=d.y;var v=(t-f)/2;var g=(e-h)/2;var m=v*v/(r*r)+g*g/(i*i);if(m>1){m=Math.sqrt(m);r=m*r;i=m*i}var y=r*r;var x=i*i;var b=(s==c?-1:1)*Math.sqrt(Math.abs((y*x-y*g*g-x*v*v)/(y*g*g+x*v*v)));if(b==Infinity)b=1;var _=b*r*g/i+(t+f)/2;var w=b*-i*v/r+(e+h)/2;var k=Math.asin(((e-w)/i).toFixed(9));var M=Math.asin(((h-w)/i).toFixed(9));k=t<_?n-k:k;M=f<_?n-M:M;if(k<0)k=n*2+k;if(M<0)M=n*2+M;if(c&&k>M)k=k-n*2;if(!c&&M>k)M=M-n*2}else{k=p[0];M=p[1];_=p[2];w=p[3]}if(Math.abs(M-k)>a){var A=M;var T=f;var S=h;M=k+a*(c&&M>k?1:-1);f=_+r*Math.cos(M);h=w+i*Math.sin(M);var E=l(f,h,r,i,o,0,c,T,S,[M,A,_,w])}var C=Math.tan((M-k)/4);var L=4/3*r*C;var I=4/3*i*C;var z=[2*t-(t+L*Math.sin(k)),2*e-(e-I*Math.cos(k)),f+L*Math.sin(M),h-I*Math.cos(M),f,h];if(p)return z;if(E)z=z.concat(E);for(var P=0;Po){var _=i[c];var w=1/Math.sqrt(m*x);for(var b=0;b<3;++b){var k=(b+1)%3;var M=(b+2)%3;_[b]+=w*(y[k]*g[M]-y[M]*g[k])}}}}for(var s=0;so){var w=1/Math.sqrt(A);for(var b=0;b<3;++b){_[b]*=w}}else{for(var b=0;b<3;++b){_[b]=0}}}return i};r.faceNormals=function(t,e,r){var n=t.length;var i=new Array(n);var o=r===void 0?a:r;for(var s=0;so){d=1/Math.sqrt(d)}else{d=0}for(var c=0;c<3;++c){p[c]*=d}i[s]=p}return i}},{}],421:[function(t,e,r){"use strict";var n=Object.getOwnPropertySymbols;var a=Object.prototype.hasOwnProperty;var i=Object.prototype.propertyIsEnumerable;function o(t){if(t===null||t===undefined){throw new TypeError("Object.assign cannot be called with null or undefined")}return Object(t)}function s(){try{if(!Object.assign){return false}var t=new String("abc");t[5]="de";if(Object.getOwnPropertyNames(t)[0]==="5"){return false}var e={};for(var r=0;r<10;r++){e["_"+String.fromCharCode(r)]=r}var n=Object.getOwnPropertyNames(e).map(function(t){return e[t]});if(n.join("")!=="0123456789"){return false}var a={};"abcdefghijklmnopqrst".split("").forEach(function(t){a[t]=t});if(Object.keys(Object.assign({},a)).join("")!=="abcdefghijklmnopqrst"){return false}return true}catch(t){return false}}e.exports=s()?Object.assign:function(t,e){var r;var s=o(t);var l;for(var u=1;u0){var f=Math.sqrt(c+1);t[0]=.5*(o-l)/f;t[1]=.5*(s-n)/f;t[2]=.5*(r-i)/f;t[3]=.5*f}else{var h=Math.max(e,i,u);var f=Math.sqrt(2*h-c+1);if(e>=h){t[0]=.5*f;t[1]=.5*(a+r)/f;t[2]=.5*(s+n)/f;t[3]=.5*(o-l)/f}else if(i>=h){t[0]=.5*(r+a)/f;t[1]=.5*f;t[2]=.5*(l+o)/f;t[3]=.5*(s-n)/f}else{t[0]=.5*(n+s)/f;t[1]=.5*(o+l)/f;t[2]=.5*f;t[3]=.5*(r-a)/f}}return t}},{}],423:[function(t,e,r){"use strict";e.exports=p;var n=t("filtered-vector");var a=t("gl-mat4/lookAt");var i=t("gl-mat4/fromQuat");var o=t("gl-mat4/invert");var s=t("./lib/quatFromFrame");function l(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function u(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function c(t,e){var r=e[0];var n=e[1];var a=e[2];var i=e[3];var o=u(r,n,a,i);if(o>1e-6){t[0]=r/o;t[1]=n/o;t[2]=a/o;t[3]=i/o}else{t[0]=t[1]=t[2]=0;t[3]=1}}function f(t,e,r){this.radius=n([r]);this.center=n(e);this.rotation=n(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)}var h=f.prototype;h.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())};h.recalcMatrix=function(t){this.radius.curve(t);this.center.curve(t);this.rotation.curve(t);var e=this.computedRotation;c(e,e);var r=this.computedMatrix;i(r,e);var n=this.computedCenter;var a=this.computedEye;var o=this.computedUp;var s=Math.exp(this.computedRadius[0]);a[0]=n[0]+s*r[2];a[1]=n[1]+s*r[6];a[2]=n[2]+s*r[10];o[0]=r[1];o[1]=r[5];o[2]=r[9];for(var l=0;l<3;++l){var u=0;for(var f=0;f<3;++f){u+=r[l+4*f]*a[f]}r[12+l]=-u}};h.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n){e[n]=r[n]}return e}return r};h.idle=function(t){this.center.idle(t);this.radius.idle(t);this.rotation.idle(t)};h.flush=function(t){this.center.flush(t);this.radius.flush(t);this.rotation.flush(t)};h.pan=function(t,e,r,n){e=e||0;r=r||0;n=n||0;this.recalcMatrix(t);var a=this.computedMatrix;var i=a[1];var o=a[5];var s=a[9];var u=l(i,o,s);i/=u;o/=u;s/=u;var c=a[0];var f=a[4];var h=a[8];var p=c*i+f*o+h*s;c-=i*p;f-=o*p;h-=s*p;var d=l(c,f,h);c/=d;f/=d;h/=d;var v=a[2];var g=a[6];var m=a[10];var y=v*i+g*o+m*s;var x=v*c+g*f+m*h;v-=y*i+x*c;g-=y*o+x*f;m-=y*s+x*h;var b=l(v,g,m);v/=b;g/=b;m/=b;var _=c*e+i*r;var w=f*e+o*r;var k=h*e+s*r;this.center.move(t,_,w,k);var M=Math.exp(this.computedRadius[0]);M=Math.max(1e-4,M+n);this.radius.set(t,Math.log(M))};h.rotate=function(t,e,r,n){this.recalcMatrix(t);e=e||0;r=r||0;var a=this.computedMatrix;var i=a[0];var o=a[4];var s=a[8];var c=a[1];var f=a[5];var h=a[9];var p=a[2];var d=a[6];var v=a[10];var g=e*i+r*c;var m=e*o+r*f;var y=e*s+r*h;var x=-(d*y-v*m);var b=-(v*g-p*y);var _=-(p*m-d*g);var w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2)));var k=u(x,b,_,w);if(k>1e-6){x/=k;b/=k;_/=k;w/=k}else{x=b=_=0;w=1}var M=this.computedRotation;var A=M[0];var T=M[1];var S=M[2];var E=M[3];var C=A*w+E*x+T*_-S*b;var L=T*w+E*b+S*x-A*_;var I=S*w+E*_+A*b-T*x;var z=E*w-A*x-T*b-S*_;if(n){x=p;b=d;_=v;var P=Math.sin(n)/l(x,b,_);x*=P;b*=P;_*=P;w=Math.cos(e);C=C*w+z*x+L*_-I*b;L=L*w+z*b+I*x-C*_;I=I*w+z*_+C*b-L*x;z=z*w-C*x-L*b-I*_}var O=u(C,L,I,z);if(O>1e-6){C/=O;L/=O;I/=O;z/=O}else{C=L=I=0;z=1}this.rotation.set(t,C,L,I,z)};h.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;a(i,e,r,n);var o=this.computedRotation;s(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]);c(o,o);this.rotation.set(t,o[0],o[1],o[2],o[3]);var l=0;for(var u=0;u<3;++u){l+=Math.pow(r[u]-e[u],2)}this.radius.set(t,.5*Math.log(Math.max(l,1e-6)));this.center.set(t,r[0],r[1],r[2])};h.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)};h.setMatrix=function(t,e){var r=this.computedRotation;s(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]);c(r,r);this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;o(n,e);var a=n[15];if(Math.abs(a)>1e-6){var i=n[12]/a;var l=n[13]/a;var u=n[14]/a;this.recalcMatrix(t);var f=Math.exp(this.computedRadius[0]);this.center.set(t,i-n[2]*f,l-n[6]*f,u-n[10]*f);this.radius.idle(t)}else{this.center.idle(t);this.radius.idle(t)}};h.setDistance=function(t,e){if(e>0){this.radius.set(t,Math.log(e))}};h.setDistanceLimits=function(t,e){if(t>0){t=Math.log(t)}else{t=-Infinity}if(e>0){e=Math.log(e)}else{e=Infinity}e=Math.max(e,t);this.radius.bounds[0][0]=t;this.radius.bounds[1][0]=e};h.getDistanceLimits=function(t){var e=this.radius.bounds;if(t){t[0]=Math.exp(e[0][0]);t[1]=Math.exp(e[1][0]);return t}return[Math.exp(e[0][0]),Math.exp(e[1][0])]};h.toJSON=function(){this.recalcMatrix(this.lastT());return{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]}};h.fromJSON=function(t){var e=this.lastT();var r=t.center;if(r){this.center.set(e,r[0],r[1],r[2])}var n=t.rotation;if(n){this.rotation.set(e,n[0],n[1],n[2],n[3])}var a=t.distance;if(a&&a>0){this.radius.set(e,Math.log(a))}this.setDistanceLimits(t.zoomMin,t.zoomMax)};function p(t){t=t||{};var e=t.center||[0,0,0];var r=t.rotation||[0,0,0,1];var n=t.radius||1;e=[].slice.call(e,0,3);r=[].slice.call(r,0,4);c(r,r);var a=new f(r,e,Math.log(n));a.setDistanceLimits(t.zoomMin,t.zoomMax);if("eye"in t||"up"in t){a.lookAt(0,t.eye,t.center,t.up)}return a}},{"./lib/quatFromFrame":422,"filtered-vector":215,"gl-mat4/fromQuat":251,"gl-mat4/invert":254,"gl-mat4/lookAt":255}],424:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function t(e,r,a){a=typeof a!=="undefined"?a+"":" ";return n(a,r)+e}},{"repeat-string":464}],425:[function(t,e,r){"use strict";function n(t,e){if(typeof t!=="string")return[t];var r=[t];if(typeof e==="string"||Array.isArray(e)){e={brackets:e}}else if(!e)e={};var n=e.brackets?Array.isArray(e.brackets)?e.brackets:[e.brackets]:["{}","[]","()"];var a=e.escape||"___";var i=!!e.flat;n.forEach(function(t){var e=new RegExp(["\\",t[0],"[^\\",t[0],"\\",t[1],"]*\\",t[1]].join(""));var n=[];function i(e,i,o){var s=r.push(e.slice(t[0].length,-t[1].length))-1;n.push(s);return a+s}r.forEach(function(t,n){var a;var o=0;while(t!=a){a=t;t=t.replace(e,i);if(o++>1e4)throw Error("References have circular dependency. Please, check them.")}r[n]=t});n=n.reverse();r=r.map(function(e){n.forEach(function(r){e=e.replace(new RegExp("(\\"+a+r+"(?![0-9]))","g"),t[0]+"$1"+t[1])});return e})});var o=new RegExp("\\"+a+"([0-9]+)");function s(t,e,r){var n=[],a;var i=0;while(a=o.exec(t)){if(i++>1e4)throw Error("Circular references in parenthesis");n.push(t.slice(0,a.index));n.push(s(e[a[1]],e));t=t.slice(a.index+a[0].length)}n.push(t);return n}return i?r:s(r[0],r)}function a(t,e){if(e&&e.flat){var r=e&&e.escape||"___";var n=t[0],a;if(!n)return"";var i=new RegExp("\\"+r+"([0-9]+)");var o=0;while(n!=a){if(o++>1e4)throw Error("Circular references in "+t);a=n;n=n.replace(i,s)}return n}return t.reduce(function t(e,r){if(Array.isArray(r)){r=r.reduce(t,"")}return e+r},"");function s(e,r){if(t[r]==null)throw Error("Reference "+r+"is undefined");return t[r]}}function i(t,e){if(Array.isArray(t)){return a(t,e)}else{return n(t,e)}}i.parse=n;i.stringify=a;e.exports=i},{}],426:[function(t,e,r){"use strict";var n=t("pick-by-alias");e.exports=a;function a(t){var e;if(arguments.length>1){t=arguments}if(typeof t==="string"){t=t.split(/\s/).map(parseFloat)}else if(typeof t==="number"){t=[t]}if(t.length&&typeof t[0]==="number"){if(t.length===1){e={width:t[0],height:t[0],x:0,y:0}}else if(t.length===2){e={width:t[0],height:t[1],x:0,y:0}}else{e={x:t[0],y:t[1],width:t[2]-t[0]||0,height:t[3]-t[1]||0}}}else if(t){t=n(t,{left:"x l left Left",top:"y t top Top",width:"w width W Width",height:"h height W Width",bottom:"b bottom Bottom",right:"r right Right"});e={x:t.left||0,y:t.top||0};if(t.width==null){if(t.right)e.width=t.right-e.x;else e.width=0}else{e.width=t.width}if(t.height==null){if(t.bottom)e.height=t.bottom-e.y;else e.height=0}else{e.height=t.height}}return e}},{"pick-by-alias":432}],427:[function(t,e,r){e.exports=i;var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0};var a=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function i(t){var e=[];t.replace(a,function(t,r,a){var i=r.toLowerCase();a=s(a);if(i=="m"&&a.length>2){e.push([r].concat(a.splice(0,2)));i="l";r=r=="m"?"l":"L"}while(true){if(a.length==n[i]){a.unshift(r);return e.push(a)}if(a.length0;--u){l=i[u];s=r[u];r[u]=r[l];r[l]=s;i[u]=i[s];i[s]=l;o=(o+s)*u}n.freeUint32(i);n.freeUint32(r);return o}function o(t,e,r){switch(t){case 0:if(r){return r}return[];case 1:if(r){r[0]=0;return r}else{return[0]}case 2:if(r){if(e){r[0]=0;r[1]=1}else{r[0]=1;r[1]=0}return r}else{return e?[0,1]:[1,0]}default:break}r=r||new Array(t);var n,a,i,o=1;r[0]=0;for(i=1;i0;--i){n=e/o|0;e=e-n*o|0;o=o/i|0;a=r[i]|0;r[i]=r[n]|0;r[n]=a|0}return r}r.rank=i;r.unrank=o},{"invert-permutation":383,"typedarray-pool":507}],432:[function(t,e,r){"use strict";e.exports=function t(e,r,n){var i={},o,s;if(typeof r==="string")r=a(r);if(Array.isArray(r)){var l={};for(s=0;s0){o=i[c][r][0];l=c;break}}s=o[l^1];for(var f=0;f<2;++f){var h=i[f][r];for(var p=0;p0){o=d;s=v;l=f}}}if(a){return s}if(o){u(o,l)}return s}function f(t,r){var a=i[r][t][0];var o=[t];u(a,r);var s=a[r^1];var l=r;while(true){while(s!==t){o.push(s);s=c(o[o.length-2],s,false)}if(i[0][t].length+i[1][t].length===0){break}var f=o[o.length-1];var h=t;var p=o[1];var d=c(f,h,true);if(n(e[f],e[h],e[p],e[d])<0){break}o.push(t);s=c(f,h)}return o}function h(t,e){return e[1]===e[e.length-1]}for(var o=0;o0){var v=i[0][o].length;var g=f(o,p);if(h(d,g)){d.push.apply(d,g)}else{if(d.length>0){l.push(d)}d=g}}if(d.length>0){l.push(d)}}}return l}},{"compare-angle":114}],434:[function(t,e,r){"use strict";e.exports=a;var n=t("edges-to-adjacency-list");function a(t,e){var r=n(t,e.length);var a=new Array(e.length);var i=new Array(e.length);var o=[];for(var s=0;s0){var u=o.pop();a[u]=false;var c=r[u];for(var s=0;s0}g=g.filter(m);var y=g.length;var x=new Array(y);var b=new Array(y);for(var v=0;v0){var U=j.pop();var q=z[U];l(q,function(t,e){return t-e});var H=q.length;var G=V[U];var W;if(G===0){var T=g[U];W=[T]}for(var v=0;v=0){continue}V[Y]=G^1;j.push(Y);if(G===0){var T=g[Y];if(!N(T)){T.reverse();W.push(T)}}}if(G===0){r.push(W)}}return r}},{"./lib/trim-leaves":434,"edges-to-adjacency-list":156,"planar-dual":433,"point-in-big-polygon":439,"robust-sum":476,"two-product":505,uniq:509}],436:[function(t,e,r){"use strict";e.exports=t("./quad")},{"./quad":438}],437:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{dup:98}],438:[function(t,e,r){"use strict";var n=t("binary-search-bounds");var a=t("clamp");var i=t("parse-rect");var o=t("array-bounds");var s=t("pick-by-alias");var l=t("defined");var u=t("flatten-vertex-data");var c=t("is-obj");var f=t("dtype");var h=t("math-log2");e.exports=function t(e,r){if(!r){r={}}e=u(e,"float64");r=s(r,{bounds:"range bounds dataBox databox",maxDepth:"depth maxDepth maxdepth level maxLevel maxlevel levels",dtype:"type dtype format out dst output destination"});var a=l(r.maxDepth,255);var d=l(r.bounds,o(e,2));if(d[0]===d[2]){d[2]++}if(d[1]===d[3]){d[3]++}var v=p(e,d);var g=e.length>>>1;var m;if(!r.dtype){r.dtype="array"}if(typeof r.dtype==="string"){m=new(f(r.dtype))(g)}else if(r.dtype){m=r.dtype;if(Array.isArray(m)){m.length=g}}for(var y=0;ya){for(var f=0;fs||w>l||k=A){return}if(i===o){return}var u=x[a];if(o===undefined){o=u.length}for(var c=i;c=f&&p<=g&&d>=v&&d<=m){S.push(h)}}var y=b[a];var T=y[i*4+0];var L=y[i*4+1];var I=y[i*4+2];var z=y[i*4+3];var P=C(y,i+1);var O=n*.5;var D=a+1;E(t,r,O,D,T,L||I||z||P);E(t,r+O,O,D,L,I||z||P);E(t+O,r,O,D,I,z||P);E(t+O,r+O,O,D,z,P)}function C(t,e){var r=null,n=0;while(r===null){r=t[e*4+n];n++;if(n>t.length){return null}}return r}return S}function I(t,e,r,a,i){var o=[];for(var s=0;s0&&e[a]===r[0]){i=t[a-1]}else{return 1}}var s=1;while(i){var l=i.key;var u=n(r,l[0],l[1]);if(l[0][0]0){s=-1;i=i.right}else{return 0}}else{if(u>0){i=i.left}else if(u<0){s=1;i=i.right}else{return 0}}}return s}}function f(t){return 1}function h(t){return function e(r){if(t(r[0],r[1])){return 0}return 1}}function p(t,e){return function r(n){if(t(n[0],n[1])){return 0}return e(n)}}function d(t){var e=t.length;var r=[];var n=[];var i=0;for(var o=0;o=-t},pointBetween:function(e,r,n){var a=e[1]-r[1];var i=n[0]-r[0];var o=e[0]-r[0];var s=n[1]-r[1];var l=o*i+a*s;if(l-t)return false;return true},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])t!=o-a>t&&(i-u)*(a-c)/(o-c)+u-n>t)s=!s;i=u;o=c}return s}};return e}e.exports=n},{}],443:[function(t,e,r){var n={toPolygon:function(t,e){function r(e){if(e.length<=0)return t.segments({inverted:false,regions:[]});function r(e){var r=e.slice(0,e.length-1);return t.segments({inverted:false,regions:[r]})}var n=r(e[0]);for(var a=1;a0})}function c(t,n){var a=t.seg;var i=n.seg;var o=a.start;var s=a.end;var l=i.start;var u=i.end;if(r)r.checkIntersection(a,i);var c=e.linesIntersect(o,s,l,u);if(c===false){if(!e.pointsCollinear(o,s,l))return false;if(e.pointsSame(o,u)||e.pointsSame(s,l))return false;var f=e.pointsSame(o,l);var h=e.pointsSame(s,u);if(f&&h)return n;var d=!f&&e.pointBetween(o,l,u);var v=!h&&e.pointBetween(s,l,u);if(f){if(v){p(n,s)}else{p(t,u)}return n}else if(d){if(!h){if(v){p(n,s)}else{p(t,u)}}p(n,o)}}else{if(c.alongA===0){if(c.alongB===-1)p(t,l);else if(c.alongB===0)p(t,c.pt);else if(c.alongB===1)p(t,u)}if(c.alongB===0){if(c.alongA===-1)p(n,o);else if(c.alongA===0)p(n,c.pt);else if(c.alongA===1)p(n,s)}}return false}var f=[];while(!o.isEmpty()){var h=o.getHead();if(r)r.vert(h.pt[0]);if(h.isStart){if(r)r.segmentNew(h.seg,h.primary);var d=u(h);var v=d.before?d.before.ev:null;var g=d.after?d.after.ev:null;if(r){r.tempStatus(h.seg,v?v.seg:false,g?g.seg:false)}function m(){if(v){var t=c(h,v);if(t)return t}if(g)return c(h,g);return false}var y=m();if(y){if(t){var x;if(h.seg.myFill.below===null)x=true;else x=h.seg.myFill.above!==h.seg.myFill.below;if(x)y.seg.myFill.above=!y.seg.myFill.above}else{y.seg.otherFill=h.seg.myFill}if(r)r.segmentUpdate(y.seg);h.other.remove();h.remove()}if(o.getHead()!==h){if(r)r.rewind(h.seg);continue}if(t){var x;if(h.seg.myFill.below===null)x=true;else x=h.seg.myFill.above!==h.seg.myFill.below;if(!g){h.seg.myFill.below=a}else{h.seg.myFill.below=g.seg.myFill.above}if(x)h.seg.myFill.above=!h.seg.myFill.below;else h.seg.myFill.above=h.seg.myFill.below}else{if(h.seg.otherFill===null){var b;if(!g){b=h.primary?i:a}else{if(h.primary===g.primary)b=g.seg.otherFill.above;else b=g.seg.myFill.above}h.seg.otherFill={above:b,below:b}}}if(r){r.status(h.seg,v?v.seg:false,g?g.seg:false)}h.other.status=d.insert(n.node({ev:h}))}else{var _=h.status;if(_===null){throw new Error("PolyBool: Zero-length segment detected; your epsilon is "+"probably too small or too large")}if(s.exists(_.prev)&&s.exists(_.next))c(_.prev.ev,_.next.ev);if(r)r.statusRemove(_.ev.seg);_.remove();if(!h.primary){var w=h.seg.myFill;h.seg.myFill=h.seg.otherFill;h.seg.otherFill=w}f.push(h.seg)}o.getHead().remove()}if(r)r.done();return f}if(!t){return{calculate:function(t,e,r,n){t.forEach(function(t){f(i(t.start,t.end,t),true)});r.forEach(function(t){f(i(t.start,t.end,t),false)});return d(e,n)}}}return{addRegion:function(t){var r;var n=t[t.length-1];for(var i=0;i=u){x=1;_=u+2*h+d}else{x=-h/u;_=h*x+d}}else{x=0;if(p>=0){b=0;_=d}else if(-p>=f){b=1;_=f+2*p+d}else{b=-p/f;_=p*b+d}}}else{x=0;if(p>=0){b=0;_=d}else if(-p>=f){b=1;_=f+2*p+d}else{b=-p/f;_=p*b+d}}}else if(b<0){b=0;if(h>=0){x=0;_=d}else if(-h>=u){x=1;_=u+2*h+d}else{x=-h/u;_=h*x+d}}else{var w=1/y;x*=w;b*=w;_=x*(u*x+c*b+2*h)+b*(c*x+f*b+2*p)+d}}else{var k,M,A,T;if(x<0){k=c+h;M=f+p;if(M>k){A=M-k;T=u-2*c+f;if(A>=T){x=1;b=0;_=u+2*h+d}else{x=A/T;b=1-x;_=x*(u*x+c*b+2*h)+b*(c*x+f*b+2*p)+d}}else{x=0;if(M<=0){b=1;_=f+2*p+d}else if(p>=0){b=0;_=d}else{b=-p/f;_=p*b+d}}}else if(b<0){k=c+p;M=u+h;if(M>k){A=M-k;T=u-2*c+f;if(A>=T){b=1;x=0;_=f+2*p+d}else{b=A/T;x=1-b;_=x*(u*x+c*b+2*h)+b*(c*x+f*b+2*p)+d}}else{b=0;if(M<=0){x=1;_=u+2*h+d}else if(h>=0){x=0;_=d}else{x=-h/u;_=h*x+d}}}else{A=f+p-c-h;if(A<=0){x=0;b=1;_=f+2*p+d}else{T=u-2*c+f;if(A>=T){x=1;b=0;_=u+2*h+d}else{x=A/T;b=1-x;_=x*(u*x+c*b+2*h)+b*(c*x+f*b+2*p)+d}}}}var S=1-x-b;for(var l=0;l1){for(var r=1;r0){var u=t[r-1];if(n(s,u)===0&&i(u)!==l){r-=1;continue}}t[r++]=s}t.length=r;return t}},{"cell-orientation":99,"compare-cell":115,"compare-oriented-cell":116}],457:[function(t,e,r){"use strict";var n=t("array-bounds");var a=t("color-normalize");var i=t("update-diff");var o=t("pick-by-alias");var s=t("object-assign");var l=t("flatten-vertex-data");var u=t("to-float32");var c=u.float32;var f=u.fract32;e.exports=p;var h=[[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]];function p(t,e){if(typeof t==="function"){if(!e){e={}}e.regl=t}else{e=t}if(e.length){e.positions=e}t=e.regl;if(!t.hasExtension("ANGLE_instanced_arrays")){throw Error("regl-error2d: `ANGLE_instanced_arrays` extension should be enabled")}var r=t._gl,u,p,d,v,g,m,y={color:"black",capSize:5,lineWidth:1,opacity:1,viewport:null,range:null,offset:0,count:0,bounds:null,positions:[],errors:[]},x=[];v=t.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array(0)});p=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)});d=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)});g=t.buffer({usage:"dynamic",type:"float",data:new Uint8Array(0)});m=t.buffer({usage:"static",type:"float",data:h});k(e);u=t({vert:"\n\t\tprecision highp float;\n\n\t\tattribute vec2 position, positionFract;\n\t\tattribute vec4 error;\n\t\tattribute vec4 color;\n\n\t\tattribute vec2 direction, lineOffset, capOffset;\n\n\t\tuniform vec4 viewport;\n\t\tuniform float lineWidth, capSize;\n\t\tuniform vec2 scale, scaleFract, translate, translateFract;\n\n\t\tvarying vec4 fragColor;\n\n\t\tvoid main() {\n\t\t\tfragColor = color / 255.;\n\n\t\t\tvec2 pixelOffset = lineWidth * lineOffset + (capSize + lineWidth) * capOffset;\n\n\t\t\tvec2 dxy = -step(.5, direction.xy) * error.xz + step(direction.xy, vec2(-.5)) * error.yw;\n\n\t\t\tvec2 position = position + dxy;\n\n\t\t\tvec2 pos = (position + translate) * scale\n\t\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t\t+ (position + translate) * scaleFract\n\t\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n\t\t\tpos += pixelOffset / viewport.zw;\n\n\t\t\tgl_Position = vec4(pos * 2. - 1., 0, 1);\n\t\t}\n\t\t",frag:"\n\t\tprecision mediump float;\n\n\t\tvarying vec4 fragColor;\n\n\t\tuniform float opacity;\n\n\t\tvoid main() {\n\t\t\tgl_FragColor = fragColor;\n\t\t\tgl_FragColor.a *= opacity;\n\t\t}\n\t\t",uniforms:{range:t.prop("range"),lineWidth:t.prop("lineWidth"),capSize:t.prop("capSize"),opacity:t.prop("opacity"),scale:t.prop("scale"),translate:t.prop("translate"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{color:{buffer:v,offset:function(t,e){return e.offset*4},divisor:1},position:{buffer:p,offset:function(t,e){return e.offset*8},divisor:1},positionFract:{buffer:d,offset:function(t,e){return e.offset*8},divisor:1},error:{buffer:g,offset:function(t,e){return e.offset*16},divisor:1},direction:{buffer:m,stride:24,offset:0},lineOffset:{buffer:m,stride:24,offset:8},capOffset:{buffer:m,stride:24,offset:16}},primitive:"triangles",blend:{enable:true,color:[0,0,0,0],equation:{rgb:"add",alpha:"add"},func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},depth:{enable:false},scissor:{enable:true,box:t.prop("viewport")},viewport:t.prop("viewport"),stencil:false,instances:t.prop("count"),count:h.length});s(b,{update:k,draw:_,destroy:M,regl:t,gl:r,canvas:r.canvas,groups:x});return b;function b(t){if(t){k(t)}else if(t===null){M()}_()}function _(e){if(typeof e==="number"){return w(e)}if(e&&!Array.isArray(e)){e=[e]}t._refresh();x.forEach(function(t,r){if(!t){return}if(e){if(!e[r]){t.draw=false}else{t.draw=true}}if(!t.draw){t.draw=true;return}w(r)})}function w(t){if(typeof t==="number"){t=x[t]}if(t==null){return}if(!(t&&t.count&&t.color&&t.opacity&&t.positions&&t.positions.length>1)){return}t.scaleRatio=[t.scale[0]*t.viewport.width,t.scale[1]*t.viewport.height];u(t);if(t.after){t.after(t)}}function k(t){if(!t){return}if(t.length!=null){if(typeof t[0]==="number"){t=[{positions:t}]}}else if(!Array.isArray(t)){t=[t]}var e=0,u=0;b.groups=x=t.map(function(t,c){var h=x[c];if(!t){return h}else if(typeof t==="function"){t={after:t}}else if(typeof t[0]==="number"){t={positions:t}}t=o(t,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"});if(!h){x[c]=h={id:c,scale:null,translate:null,scaleFract:null,translateFract:null,draw:true};t=s({},y,t)}i(h,t,[{lineWidth:function(t){return+t*.5},capSize:function(t){return+t*.5},opacity:parseFloat,errors:function(t){t=l(t);u+=t.length;return t},positions:function(t,r){t=l(t,"float64");r.count=Math.floor(t.length/2);r.bounds=n(t,2);r.offset=e;e+=r.count;return t}},{color:function(t,e){var r=e.count;if(!t){t="transparent"}if(!Array.isArray(t)||typeof t[0]==="number"){var n=t;t=Array(r);for(var i=0;i 0. && baClipping < length(normalWidth * endBotJoin)) {\n\t\t//handle miter clipping\n\t\tbTopCoord -= normalWidth * endTopJoin;\n\t\tbTopCoord += normalize(endTopJoin * normalWidth) * baClipping;\n\t}\n\n\tif (nextReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);\n\t\tbBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\tbTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {\n\t\t//handle miter clipping\n\t\taBotCoord -= normalWidth * startBotJoin;\n\t\taBotCoord += normalize(startBotJoin * normalWidth) * abClipping;\n\t}\n\n\tvec2 aTopPosition = (aTopCoord) * scale + translate;\n\tvec2 aBotPosition = (aBotCoord) * scale + translate;\n\n\tvec2 bTopPosition = (bTopCoord) * scale + translate;\n\tvec2 bBotPosition = (bBotCoord) * scale + translate;\n\n\t//position is normalized 0..1 coord on the screen\n\tvec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;\n\n\tstartCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\tendCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tenableStartMiter = step(dot(currTangent, prevTangent), .5);\n\tenableEndMiter = step(dot(currTangent, nextTangent), .5);\n\n\t//bevel miter cutoffs\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n\n\t//round miter cutoffs\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\nuniform float dashSize, pixelRatio, thickness, opacity, id, miterMode;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nvoid main() {\n\tfloat alpha = 1., distToStart, distToEnd;\n\tfloat cutoff = thickness * .5;\n\n\t//bevel miter\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToStart + 1., 0.), 1.);\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToEnd + 1., 0.), 1.);\n\t\t}\n\t}\n\n\t// round miter\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - startCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - endCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\t}\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashSize) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t, .5)).r;\n\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]),attributes:{lineEnd:{buffer:e,divisor:0,stride:8,offset:0},lineTop:{buffer:e,divisor:0,stride:8,offset:4},aColor:{buffer:t.prop("colorBuffer"),stride:4,offset:0,divisor:1},bColor:{buffer:t.prop("colorBuffer"),stride:4,offset:4,divisor:1},prevCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:0,divisor:1},aCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:8,divisor:1},bCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:16,divisor:1},nextCoord:{buffer:t.prop("positionBuffer"),stride:8,offset:24,divisor:1}}},r))}catch(t){a=n}var s=t({primitive:"triangle",elements:function(t,e){return e.triangles},offset:0,vert:o(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\n\nuniform vec4 color;\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio, id;\nuniform vec4 viewport;\nuniform float opacity;\n\nvarying vec4 fragColor;\n\nconst float MAX_LINES = 256.;\n\nvoid main() {\n\tfloat depth = (MAX_LINES - 4. - id) / (MAX_LINES);\n\n\tvec2 position = position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n\tfragColor.a *= opacity;\n}\n"]),frag:o(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n\tgl_FragColor = fragColor;\n}\n"]),uniforms:{scale:t.prop("scale"),color:t.prop("fill"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),translate:t.prop("translate"),opacity:t.prop("opacity"),pixelRatio:t.context("pixelRatio"),id:t.prop("id"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{position:{buffer:t.prop("positionBuffer"),stride:8,offset:8},positionFract:{buffer:t.prop("positionFractBuffer"),stride:8,offset:8}},blend:r.blend,depth:{enable:false},scissor:r.scissor,stencil:r.stencil,viewport:r.viewport});return{fill:s,rect:n,miter:a}};g.defaults={dashes:null,join:"miter",miterLimit:1,thickness:10,cap:"square",color:"black",opacity:1,overlay:false,viewport:null,range:null,close:false,fill:null};g.prototype.render=function(){var t=[],e=arguments.length;while(e--)t[e]=arguments[e];if(t.length){(r=this).update.apply(r,t)}this.draw();var r};g.prototype.draw=function(){var t=this;var e=[],r=arguments.length;while(r--)e[r]=arguments[r];(e.length?e:this.passes).forEach(function(e,r){if(e&&Array.isArray(e)){return(n=t).draw.apply(n,e)}if(typeof e==="number"){e=t.passes[e]}if(!(e&&e.count>1&&e.opacity)){return}t.regl._refresh();if(e.fill&&e.triangles&&e.triangles.length>2){t.shaders.fill(e)}if(!e.thickness){return}if(e.scale[0]*e.viewport.width>g.precisionThreshold||e.scale[1]*e.viewport.height>g.precisionThreshold){t.shaders.rect(e)}else if(e.join==="rect"||!e.join&&(e.thickness<=2||e.count>=g.maxPoints)){t.shaders.rect(e)}else{t.shaders.miter(e)}var n});return this};g.prototype.update=function(t){var e=this;if(!t){return}if(t.length!=null){if(typeof t[0]==="number"){t=[{positions:t}]}}else if(!Array.isArray(t)){t=[t]}var r=this;var o=r.regl;var f=r.gl;t.forEach(function(t,r){var d=e.passes[r];if(t===undefined){return}if(t===null){e.passes[r]=null;return}if(typeof t[0]==="number"){t={positions:t}}t=s(t,{positions:"positions points data coords",thickness:"thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth",join:"lineJoin linejoin join type mode",miterLimit:"miterlimit miterLimit",dashes:"dash dashes dasharray dash-array dashArray",color:"color colour stroke colors colours stroke-color strokeColor",fill:"fill fill-color fillColor",opacity:"alpha opacity",overlay:"overlay crease overlap intersect",close:"closed close closed-path closePath",range:"range dataBox",viewport:"viewport viewBox",hole:"holes hole hollow"});if(!d){e.passes[r]=d={id:r,scale:null,scaleFract:null,translate:null,translateFract:null,count:0,hole:[],depth:0,dashLength:1,dashTexture:o.texture({channels:1,data:new Uint8Array([255]),width:1,height:1,mag:"linear",min:"linear"}),colorBuffer:o.buffer({usage:"dynamic",type:"uint8",data:new Uint8Array}),positionBuffer:o.buffer({usage:"dynamic",type:"float",data:new Uint8Array}),positionFractBuffer:o.buffer({usage:"dynamic",type:"float",data:new Uint8Array})};t=i({},g.defaults,t)}if(t.thickness!=null){d.thickness=parseFloat(t.thickness)}if(t.opacity!=null){d.opacity=parseFloat(t.opacity)}if(t.miterLimit!=null){d.miterLimit=parseFloat(t.miterLimit)}if(t.overlay!=null){d.overlay=!!t.overlay;if(r 1.0 + delta) {\n\t\tdiscard;\n\t}\n\n\talpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);\n\n\tfloat borderRadius = fragBorderRadius;\n\tfloat ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);\n\tvec4 color = mix(fragColor, fragBorderColor, ratio);\n\tcolor.a *= alpha * opacity;\n\tgl_FragColor = color;\n}\n"]);y.vert=l(["precision highp float;\n#define GLSLIFY 1\n\nattribute float x, y, xFract, yFract;\nattribute float size, borderSize;\nattribute vec4 colorId, borderColorId;\nattribute float isActive;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\nuniform sampler2D palette;\nuniform vec2 paletteSize;\n\nconst float maxSize = 100.;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragBorderRadius, fragWidth;\n\nvec2 paletteCoord(float id) {\n return vec2(\n (mod(id, paletteSize.x) + .5) / paletteSize.x,\n (floor(id / paletteSize.x) + .5) / paletteSize.y\n );\n}\nvec2 paletteCoord(vec2 id) {\n return vec2(\n (id.x + .5) / paletteSize.x,\n (id.y + .5) / paletteSize.y\n );\n}\n\nvec4 getColor(vec4 id) {\n // zero-palette means we deal with direct buffer\n if (paletteSize.x == 0.) return id / 255.;\n return texture2D(palette, paletteCoord(id.xy));\n}\n\nvoid main() {\n // ignore inactive points\n if (isActive == 0.) return;\n\n vec2 position = vec2(x, y);\n vec2 positionFract = vec2(xFract, yFract);\n\n vec4 color = getColor(colorId);\n vec4 borderColor = getColor(borderColorId);\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = (size + borderSize) * pixelRatio;\n\n vec2 pos = (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0, 1);\n\n fragBorderRadius = 1. - 2. * borderSize / (size + borderSize);\n fragColor = color;\n fragBorderColor = borderColor.a == 0. || borderSize == 0. ? vec4(color.rgb, 0.) : borderColor;\n fragWidth = 1. / gl_PointSize;\n}\n"]);if(h){y.frag=y.frag.replace("smoothstep","smoothStep")}this.drawCircle=t(y)}m.defaults={color:"black",borderColor:"transparent",borderSize:0,size:12,opacity:1,marker:undefined,viewport:null,range:null,pixelSize:null,count:0,offset:0,bounds:null,positions:[],snap:1e4};m.prototype.render=function(){var t=[],e=arguments.length;while(e--)t[e]=arguments[e];if(t.length){(r=this).update.apply(r,t)}this.draw();return this;var r};m.prototype.draw=function(){var t=this;var e=[],r=arguments.length;while(r--)e[r]=arguments[r];var n=this;var a=n.groups;if(e.length===1&&Array.isArray(e[0])&&(e[0][0]===null||Array.isArray(e[0][0]))){e=e[0]}this.regl._refresh();if(e.length){for(var i=0;in)){e.tree=o(t,{bounds:c})}else if(n&&n.length){e.tree=n}if(e.tree){var p={primitive:"points",usage:"static",data:e.tree,type:"uint32"};if(e.elements){e.elements(p)}else{e.elements=h.elements(p)}}i({data:d(t),usage:"dynamic"});s({data:v(t),usage:"dynamic"});l({data:new Uint8Array(u),type:"uint8",usage:"stream"});return t}},{marker:function(e,r,n){var a=r.activation;a.forEach(function(t){return t&&t.destroy&&t.destroy()});a.length=0;if(!e||typeof e[0]==="number"){var i=t.addMarker(e);a[i]=true}else{var o=[];for(var s=0,l=Math.min(e.length,r.count);s=0){return i}var o;if(t instanceof Uint8Array||t instanceof Uint8ClampedArray){o=t}else{o=new Uint8Array(t.length);for(var s=0,l=t.length;so*o*4){this.tooManyColors=true}this.updatePalette(a);return s.length===1?s[0]:s};m.prototype.updatePalette=function(t){if(this.tooManyColors){return}var e=this;var r=e.maxColors;var n=e.paletteTexture;var a=Math.ceil(t.length*.25/r);if(a>1){t=t.slice();for(var i=t.length*.25%r;iT){continue}if(!c.lower&&A2){n=f[0];i=f[2];a=f[1];o=f[3]}else if(f.length){n=a=f[0];i=o=f[1]}else{n=f.x;a=f.y;i=f.x+f.width;o=f.y+f.height}if(h.length>2){s=h[0];u=h[2];l=h[1];c=h[3]}else if(h.length){s=l=h[0];u=c=h[1]}else{s=h.x;l=h.y;u=h.x+h.width;c=h.y+h.height}return[s,a,u,o]}function p(t){if(typeof t==="number"){return[t,t,t,t]}else if(t.length===2){return[t[0],t[1],t[0],t[1]]}else{var e=l(t);return[e.x,e.y,e.x+e.width,e.y+e.height]}}},{"array-bounds":56,"array-range":58,"flatten-vertex-data":462,"parse-rect":426,"pick-by-alias":432,raf:451,"regl-scatter2d/scatter":460}],462:[function(t,e,r){arguments[4][48][0].apply(r,arguments)},{dtype:153,dup:48}],463:[function(e,r,n){(function(e,a){"object"===typeof n&&"undefined"!==typeof r?r.exports=a():"function"===typeof t&&t.amd?t(a):e.createREGL=a()})(this,function(){function t(t,e){this.id=X++;this.type=t;this.data=e}function e(t){if(0===t.length)return[];var r=t.charAt(0),n=t.charAt(t.length-1);if(1>>=e;r=(255>>=r;e|=r;r=(15>>=r;e|=r;r=(3>>r>>1}function h(){function t(t){t:{for(var e=16;268435456>=e;e*=16)if(t<=e){t=e;break t}t=0}e=r[f(t)>>2];return 0>2].push(t)}var r=c(8,function(){return[]});return{alloc:t,free:e,allocType:function(e,r){var n=null;switch(e){case 5120:n=new Int8Array(t(r),0,r);break;case 5121:n=new Uint8Array(t(r),0,r);break;case 5122:n=new Int16Array(t(2*r),0,r);break;case 5123:n=new Uint16Array(t(2*r),0,r);break;case 5124:n=new Int32Array(t(4*r),0,r);break;case 5125:n=new Uint32Array(t(4*r),0,r);break;case 5126:n=new Float32Array(t(4*r),0,r);break;default:return null}return n.length!==r?n.subarray(0,r):n},freeType:function(t){e(t.buffer)}}}function p(t){return!!t&&"object"===typeof t&&Array.isArray(t.shape)&&Array.isArray(t.stride)&&"number"===typeof t.offset&&t.shape.length===t.stride.length&&(Array.isArray(t.data)||tt(t.data))}function d(t,e,r,n,a,i){for(var o=0;oa&&(a=n.buffer.byteLength,5123===c?a>>=1:5125===c&&(a>>=2));n.vertCount=a;a=o;0>o&&(a=4,o=n.buffer.dimension,1===o&&(a=0),2===o&&(a=1),3===o&&(a=4));n.primType=a}function o(t){n.elementsCount--;delete s[t.id];t.buffer.destroy();t.buffer=null}var s={},l=0,u={uint8:5121,uint16:5123};e.oes_element_index_uint&&(u.uint32=5125);a.prototype.bind=function(){this.buffer.bind()};var c=[];return{create:function(t,e){function s(t){if(t)if("number"===typeof t)l(t),c.primType=4,c.vertCount=t|0,c.type=5121;else{var e=null,r=35044,n=-1,a=-1,o=0,f=0;if(Array.isArray(t)||tt(t)||p(t))e=t;else if("data"in t&&(e=t.data),"usage"in t&&(r=it[t.usage]),"primitive"in t&&(n=ut[t.primitive]),"count"in t&&(a=t.count|0),"type"in t&&(f=u[t.type]),"length"in t)o=t.length|0;else if(o=a,5123===f||5122===f)o*=2;else if(5125===f||5124===f)o*=4;i(c,e,r,n,a,o,f)}else l(),c.primType=4,c.vertCount=0,c.type=5121;return s}var l=r.create(null,34963,!0),c=new a(l._buffer);n.elementsCount++;s(t);s._reglType="elements";s._elements=c;s.subdata=function(t,e){l.subdata(t,e);return s};s.destroy=function(){o(c)};return s},createStream:function(t){var e=c.pop();e||(e=new a(r.create(null,34963,!0,!1)._buffer));i(e,t,35040,-1,-1,0,0);return e},destroyStream:function(t){c.push(t)},getElements:function(t){return"function"===typeof t&&t._elements instanceof a?t._elements:null},clear:function(){et(s).forEach(o)}}}function _(t){for(var e=K.allocType(5123,t.length),r=0;r>>31<<15,i=(n<<1>>>24)-127,n=n>>13&1023;e[r]=-24>i?a:-14>i?a+(n+1024>>-14-i):15>=a,r.height>>=a,h(r,n[a]),t.mipmask|=1<e;++e)t.images[e]=null;return t}function L(t){for(var e=t.images,r=0;re){for(var r=0;r=--this.refCount&&B(this)}});o.profile&&(i.getTotalTextureSize=function(){var t=0;Object.keys(ut).forEach(function(e){t+=ut[e].stats.size});return t});return{create2D:function(e,r){function n(t,e){var r=a.texInfo;I.call(r);var i=k();"number"===typeof t?"number"===typeof e?y(i,t|0,e|0):y(i,t|0,t|0):t?(z(r,t),x(i,t)):y(i,1,1);r.genMipmaps&&(i.mipmask=(i.width<<1)-1);a.mipmask=i.mipmask;l(a,i);a.internalformat=i.internalformat;n.width=i.width;n.height=i.height;D(a);b(i,3553);P(r,3553);R();L(i);o.profile&&(a.stats.size=C(a.internalformat,a.type,i.width,i.height,r.genMipmaps,!1));n.format=Z[a.internalformat];n.type=$[a.type];n.mag=J[r.magFilter];n.min=Q[r.minFilter];n.wrapS=at[r.wrapS];n.wrapT=at[r.wrapT];return n}var a=new O(3553);ut[a.id]=a;i.textureCount++;n(e,r);n.subimage=function(t,e,r,i){e|=0;r|=0;i|=0;var o=v();l(o,a);o.width=0;o.height=0;h(o,t);o.width=o.width||(a.width>>i)-e;o.height=o.height||(a.height>>i)-r;D(a);d(o,3553,e,r,i);R();g(o);return n};n.resize=function(e,r){var i=e|0,s=r|0||i;if(i===a.width&&s===a.height)return n;n.width=a.width=i;n.height=a.height=s;D(a);for(var l,u=a.channels,c=a.type,f=0;a.mipmask>>f;++f){var h=i>>f,p=s>>f;if(!h||!p)break;l=K.zero.allocType(c,h*p*u);t.texImage2D(3553,f,a.format,h,p,0,a.format,a.type,l);l&&K.zero.freeType(l)}R();o.profile&&(a.stats.size=C(a.internalformat,a.type,i,s,!1,!1));return n};n._reglType="texture2d";n._texture=a;o.profile&&(n.stats=a.stats);n.destroy=function(){a.decRef()};return n},createCube:function(e,r,n,a,s,c){function f(t,e,r,n,a,i){var s,c=p.texInfo;I.call(c);for(s=0;6>s;++s)m[s]=k();if("number"===typeof t||!t)for(t=t|0||1,s=0;6>s;++s)y(m[s],t,t);else if("object"===typeof t)if(e)x(m[0],t),x(m[1],e),x(m[2],r),x(m[3],n),x(m[4],a),x(m[5],i);else if(z(c,t),u(p,t),"faces"in t)for(t=t.faces,s=0;6>s;++s)l(m[s],p),x(m[s],t[s]);else for(s=0;6>s;++s)x(m[s],t);l(p,m[0]);p.mipmask=c.genMipmaps?(m[0].width<<1)-1:m[0].mipmask;p.internalformat=m[0].internalformat;f.width=m[0].width;f.height=m[0].height;D(p);for(s=0;6>s;++s)b(m[s],34069+s);P(c,34067);R();o.profile&&(p.stats.size=C(p.internalformat,p.type,f.width,f.height,c.genMipmaps,!0));f.format=Z[p.internalformat];f.type=$[p.type];f.mag=J[c.magFilter];f.min=Q[c.minFilter];f.wrapS=at[c.wrapS];f.wrapT=at[c.wrapT];for(s=0;6>s;++s)L(m[s]);return f}var p=new O(34067);ut[p.id]=p;i.cubeCount++;var m=Array(6);f(e,r,n,a,s,c);f.subimage=function(t,e,r,n,a){r|=0;n|=0;a|=0;var i=v();l(i,p);i.width=0;i.height=0;h(i,e);i.width=i.width||(p.width>>a)-r;i.height=i.height||(p.height>>a)-n;D(p);d(i,34069+t,r,n,a);R();g(i);return f};f.resize=function(e){e|=0;if(e!==p.width){f.width=p.width=e;f.height=p.height=e;D(p);for(var r=0;6>r;++r)for(var n=0;p.mipmask>>n;++n)t.texImage2D(34069+r,n,p.format,e>>n,e>>n,0,p.format,p.type,null);R();o.profile&&(p.stats.size=C(p.internalformat,p.type,f.width,f.height,!1,!0));return f}};f._reglType="textureCube";f._texture=p;o.profile&&(f.stats=p.stats);f.destroy=function(){p.decRef()};return f},clear:function(){for(var e=0;er;++r)if(0!==(e.mipmask&1<>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;6>n;++n)t.texImage2D(34069+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);P(e.texInfo,e.target)})}}}function I(t,e,r,n,a,i){function o(t,e,r){this.target=t;this.texture=e;this.renderbuffer=r;var n=t=0;e?(t=e.width,n=e.height):r&&(t=r.width,n=r.height);this.width=t;this.height=n}function s(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function l(t,e,r){t&&(t.texture?t.texture._texture.refCount+=1:t.renderbuffer._renderbuffer.refCount+=1)}function u(e,r){r&&(r.texture?t.framebufferTexture2D(36160,e,r.target,r.texture._texture.texture,0):t.framebufferRenderbuffer(36160,e,36161,r.renderbuffer._renderbuffer.renderbuffer))}function c(t){var e=3553,r=null,n=null,a=t;"object"===typeof t&&(a=t.data,"target"in t&&(e=t.target|0));t=a._reglType;"texture2d"===t?r=a:"textureCube"===t?r=a:"renderbuffer"===t&&(n=a,e=36161);return new o(e,r,n)}function f(t,e,r,i,s){if(r)return t=n.create2D({width:t,height:e,format:i,type:s}),t._texture.refCount=0,new o(3553,t,null);t=a.create({width:t,height:e,format:i});t._renderbuffer.refCount=0;return new o(36161,null,t)}function h(t){return t&&(t.texture||t.renderbuffer)}function p(t,e,r){t&&(t.texture?t.texture.resize(e,r):t.renderbuffer&&t.renderbuffer.resize(e,r))}function d(){this.id=k++;M[this.id]=this;this.framebuffer=t.createFramebuffer();this.height=this.width=0;this.colorAttachments=[];this.depthStencilAttachment=this.stencilAttachment=this.depthAttachment=null}function v(t){t.colorAttachments.forEach(s);s(t.depthAttachment);s(t.stencilAttachment);s(t.depthStencilAttachment)}function g(e){t.deleteFramebuffer(e.framebuffer);e.framebuffer=null;i.framebufferCount--;delete M[e.id]}function m(e){var n;t.bindFramebuffer(36160,e.framebuffer);var a=e.colorAttachments;for(n=0;na;++a){for(u=0;ut;++t)r[t].resize(n);e.width=e.height=n;return e},_reglType:"framebufferCube",destroy:function(){r.forEach(function(t){t.destroy()})}})},clear:function(){et(M).forEach(g)},restore:function(){et(M).forEach(function(e){e.framebuffer=t.createFramebuffer();m(e)})}})}function z(){this.w=this.z=this.y=this.x=this.state=0;this.buffer=null;this.size=0;this.normalized=!1;this.type=5126;this.divisor=this.stride=this.offset=0}function P(t,e,r,n){t=r.maxAttributes;e=Array(t);for(r=0;rt&&(t=e.stats.uniformsCount)});return t},r.getMaxAttributesCount=function(){var t=0;h.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)});return t});return{clear:function(){var e=t.deleteShader.bind(t);et(u).forEach(e);u={};et(c).forEach(e);c={};h.forEach(function(e){t.deleteProgram(e.program)});h.length=0;f={};r.shaderCount=0},program:function(t,e,n){var a=f[e];a||(a=f[e]={});var i=a[t];i||(i=new s(e,t),r.shaderCount++,l(i,n),a[t]=i,h.push(i));return i},restore:function(){u={};c={};for(var t=0;t"+e+"?"+a+".constant["+e+"]:0;"}).join(""),"}}else{","if(",o,"(",a,".buffer)){",c,"=",s,".createStream(",34962,",",a,".buffer);","}else{",c,"=",s,".getBuffer(",a,".buffer);","}",f,'="type" in ',a,"?",i.glTypes,"[",a,".type]:",c,".dtype;",l.normalized,"=!!",a,".normalized;");n("size");n("offset");n("stride");n("divisor");r("}}");r.exit("if(",l.isStream,"){",s,".destroyStream(",c,");","}");return l})});return o}function C(t){var e=t["static"],r=t.dynamic,n={};Object.keys(e).forEach(function(t){var r=e[t];n[t]=q(function(t,e){return"number"===typeof r||"boolean"===typeof r?""+r:t.link(r)})});Object.keys(r).forEach(function(t){var e=r[t];n[t]=H(e,function(t,r){return t.invoke(r,e)})});return n}function L(t,e,r,n,a){var i=_(t,a),o=k(t,i,a),s=A(t,a),l=T(t,a),u=M(t,a),c=o.viewport;c&&(l.viewport=c);c=g("scissor.box");(o=o[c])&&(l[c]=o);o=0>1)",v],");")}function e(){r(g,".drawArraysInstancedANGLE(",[h,p,d,v],");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(l+".drawElements("+[h,d,m,p+"<<(("+m+"-5121)>>1)"]+");")}function e(){r(l+".drawArrays("+[h,p,d]+");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}var s=t.shared,l=s.gl,u=s.draw,c=n.draw,f=function(){var a=c.elements,i=e;if(a){if(a.contextDep&&n.contextDynamic||a.propDep)i=r;a=a.append(t,i)}else a=i.def(u,".","elements");a&&i("if("+a+")"+l+".bindBuffer(34963,"+a+".buffer.buffer);");return a}(),h=a("primitive"),p=a("offset"),d=function(){var a=c.count,i=e;if(a){if(a.contextDep&&n.contextDynamic||a.propDep)i=r;a=a.append(t,i)}else a=i.def(u,".","count");return a}();if("number"===typeof d){if(0===d)return}else r("if(",d,"){"),r.exit("}");var v,g;ot&&(v=a("instances"),g=t.instancing);var m=f+".type",y=c.elements&&U(c.elements);ot&&("number"!==typeof v||0<=v)?"string"===typeof v?(r("if(",v,">0){"),i(),r("}else if(",v,"<0){"),o(),r("}")):i():o()}function Y(t,e,r,n,a){e=x();a=e.proc("body",a);ot&&(e.instancing=a.def(e.shared.extensions,".angle_instanced_arrays"));t(e,a,r,n);return e.compile().body}function X(t,e,r,n){D(t,e);B(t,e,r,n.attributes,function(){return!0});G(t,e,r,n.uniforms,function(){return!0});W(t,e,e,r)}function $(t,e){var r=t.proc("draw",1);D(t,r);I(t,r,e.context);z(t,r,e.framebuffer);P(t,r,e);O(t,r,e.state);R(t,r,e,!1,!0);var n=e.shader.progVar.append(t,r);r(t.shared.gl,".useProgram(",n,".program);");if(e.shader.program)X(t,r,e,e.shader.program);else{var a=t.global.def("{}"),i=r.def(n,".id"),o=r.def(a,"[",i,"]");r(t.cond(o).then(o,".call(this,a0);")["else"](o,"=",a,"[",i,"]=",t.link(function(r){return Y(X,t,e,r,1)}),"(",n,");",o,".call(this,a0);"))}0=--this.refCount&&o(this)};a.profile&&(n.getTotalRenderbufferSize=function(){var t=0;Object.keys(c).forEach(function(e){t+=c[e].stats.size});return t});return{create:function(e,r){function o(e,r){var n=0,i=0,c=32854;"object"===typeof e&&e?("shape"in e?(i=e.shape,n=i[0]|0,i=i[1]|0):("radius"in e&&(n=i=e.radius|0),"width"in e&&(n=e.width|0),"height"in e&&(i=e.height|0)),"format"in e&&(c=s[e.format])):"number"===typeof e?(n=e|0,i="number"===typeof r?r|0:n):e||(n=i=1);if(n!==u.width||i!==u.height||c!==u.format)return o.width=u.width=n,o.height=u.height=i,u.format=c,t.bindRenderbuffer(36161,u.renderbuffer),t.renderbufferStorage(36161,c,n,i),a.profile&&(u.stats.size=kt[u.format]*u.width*u.height),o.format=l[u.format],o}var u=new i(t.createRenderbuffer());c[u.id]=u;n.renderbufferCount++;o(e,r);o.resize=function(e,r){var n=e|0,i=r|0||n;if(n===u.width&&i===u.height)return o;o.width=u.width=n;o.height=u.height=i;t.bindRenderbuffer(36161,u.renderbuffer);t.renderbufferStorage(36161,u.format,n,i);a.profile&&(u.stats.size=kt[u.format]*u.width*u.height);return o};o._reglType="renderbuffer";o._renderbuffer=u;a.profile&&(o.stats=u.stats);o.destroy=function(){u.decRef()};return o},clear:function(){et(c).forEach(o)},restore:function(){et(c).forEach(function(e){e.renderbuffer=t.createRenderbuffer();t.bindRenderbuffer(36161,e.renderbuffer);t.renderbufferStorage(36161,e.format,e.width,e.height)});t.bindRenderbuffer(36161,null)}}},At=[];At[6408]=4;At[6407]=3;var Tt=[];Tt[5121]=1;Tt[5126]=4;Tt[36193]=2;var St=["x","y","z","w"],Et="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),Ct={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Lt={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},It={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},zt={cw:2304,ccw:2305},Pt=new V(!1,!1,!1,function(){}),Ot=function(t,e){function r(){this.endQueryIndex=this.startQueryIndex=-1;this.sum=0;this.stats=null}function n(t,e,n){var a=s.pop()||new r;a.startQueryIndex=t;a.endQueryIndex=e;a.sum=0;a.stats=n;l.push(a)}var a=e.ext_disjoint_timer_query;if(!a)return null;var i=[],o=[],s=[],l=[],u=[],c=[];return{beginQuery:function(t){var e=i.pop()||a.createQueryEXT();a.beginQueryEXT(35007,e);o.push(e);n(o.length-1,o.length,t)},endQuery:function(){a.endQueryEXT(35007)},pushScopeStats:n,update:function(){var t,e;t=o.length;if(0!==t){c.length=Math.max(c.length,t+1);u.length=Math.max(u.length,t+1);u[0]=0;var r=c[0]=0;for(e=t=0;e=H.length&&a()}var r=W(H,t);H[r]=e}}}function h(){var t=U.viewport,e=U.scissor_box;t[0]=t[1]=e[0]=e[1]=0;E.viewportWidth=E.framebufferWidth=E.drawingBufferWidth=t[2]=e[2]=g.drawingBufferWidth;E.viewportHeight=E.framebufferHeight=E.drawingBufferHeight=t[3]=e[3]=g.drawingBufferHeight}function p(){E.tick+=1;E.time=v();h();V.procs.poll()}function d(){h();V.procs.refresh();M&&M.update()}function v(){return(J()-A)/1e3}t=l(t);if(!t)return null;var g=t.gl,m=g.getContextAttributes();g.isContextLost();var y=u(g,t);if(!y)return null;var _=n(),w={bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0},k=y.extensions,M=Ot(g,k),A=J(),T=g.drawingBufferWidth,S=g.drawingBufferHeight,E={tick:0,time:0,viewportWidth:T,viewportHeight:S,framebufferWidth:T,framebufferHeight:S,drawingBufferWidth:T,drawingBufferHeight:S,pixelRatio:t.pixelRatio},C=Q(g,k),T=P(g,k,C,_),z=x(g,w,t,T),R=b(g,k,z,w),B=O(g,_,w,t),F=L(g,k,C,function(){V.procs.poll()},E,w,t),N=Mt(g,k,C,w,t),j=I(g,k,C,F,N,w),V=G(g,_,k,C,z,R,F,j,{},T,B,{elements:null,primitive:4,count:-1,offset:0,instances:-1},E,M,t),_=D(g,j,V.procs.poll,E,m,k,C),U=V.next,q=g.canvas,H=[],X=[],K=[],tt=[t.onDestroy],et=null;q&&(q.addEventListener("webglcontextlost",i,!1),q.addEventListener("webglcontextrestored",o,!1));var rt=j.setFBO=s({framebuffer:Z.define.call(null,1,"framebuffer")});d();m=Y(s,{clear:function(t){if("framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var e=0;6>e;++e)rt(Y({framebuffer:t.framebuffer.faces[e]},t),c);else rt(t,c);else c(null,t)},prop:Z.define.bind(null,1),context:Z.define.bind(null,2),this:Z.define.bind(null,3),draw:s({}),buffer:function(t){return z.create(t,34962,!1,!1)},elements:function(t){return R.create(t,!1)},texture:F.create2D,cube:F.createCube,renderbuffer:N.create,framebuffer:j.create,framebufferCube:j.createCube,attributes:m,frame:f,on:function(t,e){var r;switch(t){case"frame":return f(e);case"lost":r=X;break;case"restore":r=K;break;case"destroy":r=tt}r.push(e);return{cancel:function(){for(var t=0;t=r){return n.substr(0,r)}while(r>n.length&&e>1){if(e&1){n+=t}e>>=1;t+=t}n+=t;n=n.substr(0,r);return n}},{}],465:[function(t,e,r){(function(t){e.exports=t.performance&&t.performance.now?function t(){return performance.now()}:Date.now||function t(){return+new Date}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],466:[function(t,e,r){"use strict";e.exports=n;function n(t){var e=t.length;var r=t[t.length-1];var n=e;for(var a=e-2;a>=0;--a){var i=r;var o=t[a];r=i+o;var s=r-i;var l=o-s;if(l){t[--n]=r;r=l}}var u=0;for(var a=n;a>1;return["sum(",f(t.slice(0,e)),",",f(t.slice(e)),")"].join("")}}function h(t){if(t.length===2){return["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")}else{var e=[];for(var r=0;r>1;return["sum(",c(t.slice(0,e)),",",c(t.slice(e)),")"].join("")}}function f(t,e){if(t.charAt(0)==="m"){if(e.charAt(0)==="w"){var r=t.split("[");return["w",e.substr(1),"m",r[0].substr(1)].join("")}else{return["prod(",t,",",e,")"].join("")}}else{return f(e,t)}}function h(t){if(t&1!==0){return"-"}return""}function p(t){if(t.length===2){return[["diff(",f(t[0][0],t[1][1]),",",f(t[1][0],t[0][1]),")"].join("")]}else{var e=[];for(var r=0;r0){r.push(",")}r.push("[");for(var o=0;o0){r.push(",")}if(o===a){r.push("+b[",i,"]")}else{r.push("+A[",i,"][",o,"]")}}r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var s=new Function("det",r.join(""));if(t<6){return s(n[t])}return s(n)}function o(){return[0]}function s(t,e){return[[e[0]],[t[0][0]]]}var l=[o,s];function u(){while(l.length>1;return["sum(",d(t.slice(0,e)),",",d(t.slice(e)),")"].join("")}}function v(t){if(t.length===2){return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")]}else{var e=[];for(var r=0;r0){if(i<=0){return o}else{s=a+i}}else if(a<0){if(i>=0){return o}else{s=-(a+i)}}else{return o}var l=u*s;if(o>=l||o<=-l){return o}return m(e,r,n)},function t(e,r,n,a){var i=e[0]-a[0];var o=r[0]-a[0];var s=n[0]-a[0];var l=e[1]-a[1];var u=r[1]-a[1];var f=n[1]-a[1];var h=e[2]-a[2];var p=r[2]-a[2];var d=n[2]-a[2];var v=o*f;var g=s*u;var m=s*l;var x=i*f;var b=i*u;var _=o*l;var w=h*(v-g)+p*(m-x)+d*(b-_);var k=(Math.abs(v)+Math.abs(g))*Math.abs(h)+(Math.abs(m)+Math.abs(x))*Math.abs(p)+(Math.abs(b)+Math.abs(_))*Math.abs(d);var M=c*k;if(w>M||-w>M){return w}return y(e,r,n,a)}];function b(t){var e=x[t.length];if(!e){e=x[t.length]=g(t.length)}return e.apply(undefined,t)}function _(){while(x.length<=s){x.push(g(x.length))}var t=[];var r=["slow"];for(var n=0;n<=s;++n){t.push("a"+n);r.push("o"+n)}var a=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(var n=2;n<=s;++n){a.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");")}a.push("}var s=new Array(arguments.length);for(var i=0;i0&&s>0||o<0&&s<0){return false}var l=n(r,t,e);var u=n(i,t,e);if(l>0&&u>0||l<0&&u<0){return false}if(o===0&&s===0&&l===0&&u===0){return a(t,e,r,i)}return true}},{"robust-orientation":471}],475:[function(t,e,r){"use strict";e.exports=a;function n(t,e){var r=t+e;var n=r-t;var a=r-n;var i=e-n;var o=t-a;var s=o+i;if(s){return[s,r]}return[r]}function a(t,e){var r=t.length|0;var a=e.length|0;if(r===1&&a===1){return n(t[0],-e[0])}var i=r+a;var o=new Array(i);var s=0;var l=0;var u=0;var c=Math.abs;var f=t[l];var h=c(f);var p=-e[u];var d=c(p);var v,g;if(h=a){v=f;l+=1;if(l=a){v=f;l+=1;if(l0){return 1}return 0}},{}],478:[function(t,e,r){"use strict";e.exports=i;var n=t("boundary-cells");var a=t("reduce-simplicial-complex");function i(t){return a(n(t))}},{"boundary-cells":83,"reduce-simplicial-complex":456}],479:[function(t,e,r){"use strict";e.exports=p;var n=t("ndarray");var a=t("typedarray-pool");var i=t("ndarray-sort");var o=t("./lib/codegen");function s(t){var e=t.length;var r=0;for(var n=0;n>1,v=E[2*m+1];","if(v===b){return m}","if(b0){l.push(",")}l.push("[");for(var n=0;n0){l.push(",")}l.push("B(C,E,c[",a[0],"],c[",a[1],"])")}l.push("]")}l.push(");")}for(var i=t+1;i>1;--i){if(i>1,o=l(t[i],e);if(o<=0){if(o===0){a=i}r=i+1}else if(o>0){n=i-1}}return a}r.findCell=h;function p(t,e){var r=new Array(t.length);for(var a=0,i=r.length;a=t.length||l(t[g],o)!==0){break}}}}return r}r.incidence=p;function d(t,e){if(!e){return p(f(g(t,0)),t,0)}var r=new Array(e);for(var n=0;n>>u&1){l.push(a[u])}}e.push(l)}}return c(e)}r.explode=v;function g(t,e){if(e<0){return[]}var r=[],a=(1<>1}return(t>>1)-1}function x(t){var e=m(t);while(true){var r=e;var n=2*t+1;var a=2*(t+1);var i=t;if(n0){var r=y(t);if(r>=0){var n=m(r);if(e0){var t=M[0];g(0,S-1);S-=1;x(0);return t}return-1}function w(t,e){var r=M[t];if(u[r]===e){return t}u[r]=-Infinity;b(t);_();u[r]=e;S+=1;return b(S-1)}function k(t){if(c[t]){return}c[t]=true;var e=s[t];var r=l[t];if(s[r]>=0){s[r]=e}if(l[e]>=0){l[e]=r}if(A[e]>=0){w(A[e],v(e))}if(A[r]>=0){w(A[r],v(r))}}var M=[];var A=new Array(n);for(var f=0;f>1;f>=0;--f){x(f)}while(true){var E=_();if(E<0||u[E]>r){break}k(E)}var C=[];for(var f=0;f=0&&r>=0&&e!==r){var n=A[e];var a=A[r];if(n!==a){z.push([n,a])}}});a.unique(a.normalize(z));return{positions:C,edges:z}}},{"robust-orientation":471,"simplicial-complex":483}],486:[function(t,e,r){"use strict";e.exports=i;var n=t("robust-orientation");function a(t,e){var r,a;if(e[0][0]e[1][0]){r=e[1];a=e[0]}else{var i=Math.min(t[0][1],t[1][1]);var o=Math.max(t[0][1],t[1][1]);var s=Math.min(e[0][1],e[1][1]);var l=Math.max(e[0][1],e[1][1]);if(ol){return i-l}return o-l}var u,c;if(t[0][1]e[1][0]){r=e[1];i=e[0]}else{return a(e,t)}var o,s;if(t[0][0]t[1][0]){o=t[1];s=t[0]}else{return-a(t,e)}var l=n(r,i,s);var u=n(r,i,o);if(l<0){if(u<=0){return l}}else if(l>0){if(u>=0){return l}}else if(u){return u}l=n(s,o,i);u=n(s,o,r);if(l<0){if(u<=0){return l}}else if(l>0){if(u>=0){return l}}else if(u){return u}return i[0]-s[0]}},{"robust-orientation":471}],487:[function(t,e,r){"use strict";e.exports=p;var n=t("binary-search-bounds");var a=t("functional-red-black-tree");var i=t("robust-orientation");var o=t("./lib/order-segments");function s(t,e,r){this.slabs=t;this.coordinates=e;this.horizontal=r}var l=s.prototype;function u(t,e){return t.y-e}function c(t,e){var r=null;while(t){var n=t.key;var a,o;if(n[0][0]0){if(e[0]!==n[1][0]){r=t;t=t.right}else{var l=c(t.right,e);if(l){return l}t=t.left}}else{if(e[0]!==n[1][0]){return t}else{var l=c(t.right,e);if(l){return l}t=t.left}}}return r}l.castUp=function(t){var e=n.le(this.coordinates,t[0]);if(e<0){return-1}var r=this.slabs[e];var a=c(this.slabs[e],t);var s=-1;if(a){s=a.value}if(this.coordinates[e]===t[0]){var l=null;if(a){l=a.key}if(e>0){var f=c(this.slabs[e-1],t);if(f){if(l){if(o(f.key,l)>0){l=f.key;s=f.value}}else{s=f.value;l=f.key}}}var h=this.horizontal[e];if(h.length>0){var p=n.ge(h,t[1],u);if(p=h.length){return s}d=h[p]}}}if(d.start){if(l){var v=i(l[0],l[1],[t[0],d.y]);if(l[0][0]>l[1][0]){v=-v}if(v>0){s=d.index}}else{s=d.index}}else if(d.y!==t[1]){s=d.index}}}}return s};function f(t,e,r,n){this.y=t;this.index=e;this.start=r;this.closed=n}function h(t,e,r,n){this.x=t;this.segment=e;this.create=r;this.index=n}function p(t){var e=t.length;var r=2*e;var n=new Array(r);for(var i=0;i1){i=1}var o=1-i;var s=t.length;var l=new Array(s);for(var u=0;u0||a>0&&c<0){var f=o(s,c,l,a);r.push(f);n.push(f.slice())}if(c<0){n.push(l.slice())}else if(c>0){r.push(l.slice())}else{r.push(l.slice());n.push(l.slice())}a=c}return{positive:r,negative:n}}function l(t,e){var r=[];var n=i(t[t.length-1],e);for(var a=t[t.length-1],s=t[0],l=0;l0||n>0&&u<0){r.push(o(a,u,s,n))}if(u>=0){r.push(s.slice())}n=u}return r}function u(t,e){var r=[];var n=i(t[t.length-1],e);for(var a=t[t.length-1],s=t[0],l=0;l0||n>0&&u<0){r.push(o(a,u,s,n))}if(u<=0){r.push(s.slice())}n=u}return r}},{"robust-dot-product":468,"robust-sum":476}],489:[function(e,r,n){!function(){"use strict";var e={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};function r(t){return i(s(t),arguments)}function a(t,e){return r.apply(null,[t].concat(e||[]))}function i(t,n){var a=1,i=t.length,o,s="",l,u,c,f,h,p,d,v;for(l=0;l=0}switch(c[8]){case"b":o=parseInt(o,10).toString(2);break;case"c":o=String.fromCharCode(parseInt(o,10));break;case"d":case"i":o=parseInt(o,10);break;case"j":o=JSON.stringify(o,null,c[6]?parseInt(c[6]):0);break;case"e":o=c[7]?parseFloat(o).toExponential(c[7]):parseFloat(o).toExponential();break;case"f":o=c[7]?parseFloat(o).toFixed(c[7]):parseFloat(o);break;case"g":o=c[7]?String(Number(o.toPrecision(c[7]))):parseFloat(o);break;case"o":o=(parseInt(o,10)>>>0).toString(8);break;case"s":o=String(o);o=c[7]?o.substring(0,c[7]):o;break;case"t":o=String(!!o);o=c[7]?o.substring(0,c[7]):o;break;case"T":o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase();o=c[7]?o.substring(0,c[7]):o;break;case"u":o=parseInt(o,10)>>>0;break;case"v":o=o.valueOf();o=c[7]?o.substring(0,c[7]):o;break;case"x":o=(parseInt(o,10)>>>0).toString(16);break;case"X":o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}if(e.json.test(c[8])){s+=o}else{if(e.number.test(c[8])&&(!d||c[3])){v=d?"+":"-";o=o.toString().replace(e.sign,"")}else{v=""}h=c[4]?c[4]==="0"?"0":c[4].charAt(1):" ";p=c[6]-(v+o).length;f=c[6]?p>0?h.repeat(p):"":"";s+=c[5]?v+o+f:h==="0"?v+f+o:f+v+o}}}return s}var o=Object.create(null);function s(t){if(o[t]){return o[t]}var r=t,n,a=[],i=0;while(r){if((n=e.text.exec(r))!==null){a.push(n[0])}else if((n=e.modulo.exec(r))!==null){a.push("%")}else if((n=e.placeholder.exec(r))!==null){if(n[2]){i|=1;var s=[],l=n[2],u=[];if((u=e.key.exec(l))!==null){s.push(u[1]);while((l=l.substring(u[0].length))!==""){if((u=e.key_access.exec(l))!==null){s.push(u[1])}else if((u=e.index_access.exec(l))!==null){s.push(u[1])}else{throw new SyntaxError("[sprintf] failed to parse named argument key")}}}else{throw new SyntaxError("[sprintf] failed to parse named argument key")}n[2]=s}else{i|=2}if(i===3){throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported")}a.push(n)}else{throw new SyntaxError("[sprintf] unexpected placeholder")}r=r.substring(n[0].length)}return o[t]=a}if(typeof n!=="undefined"){n["sprintf"]=r;n["vsprintf"]=a}if(typeof window!=="undefined"){window["sprintf"]=r;window["vsprintf"]=a;if(typeof t==="function"&&t["amd"]){t(function(){return{sprintf:r,vsprintf:a}})}}}()},{}],490:[function(t,e,r){"use strict";var n=t("parenthesis");e.exports=function t(e,r,a){if(e==null)throw Error("First argument should be a string");if(r==null)throw Error("Separator should be a string or a RegExp");if(!a)a={};else if(typeof a==="string"||Array.isArray(a)){a={ignore:a}}if(a.escape==null)a.escape=true;if(a.ignore==null)a.ignore=["[]","()","{}","<>",'""',"''","``","\u201c\u201d","\xab\xbb"];else{if(typeof a.ignore==="string"){a.ignore=[a.ignore]}a.ignore=a.ignore.map(function(t){if(t.length===1)t=t+t;return t})}var i=n.parse(e,{flat:true,brackets:a.ignore});var o=i[0];var s=o.split(r);if(a.escape){var l=[];for(var u=0;u0){e=h[h.length-1];var p=t[e];if(i[e]=0){s[e].push(o[v])}}i[e]=d}else{if(n[e]===r[e]){var g=[];var m=[],y=0;for(var d=l.length-1;d>=0;--d){var x=l[d];a[x]=false;g.push(x);m.push(s[x]);y+=s[x].length;o[x]=c.length;if(x===e){l.length=d;break}}c.push(g);var b=new Array(y);for(var d=0;d c)|0 },");if(e==="generic"){i.push("getters:[0],")}var s=[];var l=[];for(var u=0;u>>7){")}for(var u=0;u<1<<(1<128){if(u%128===0){if(f.length>0){h.push("}}")}var p="vExtra"+f.length;i.push("case ",u>>>7,":",p,"(m&0x7f,",l.join(),");break;");h=["function ",p,"(m,",l.join(),"){switch(m){"];f.push(h)}}h.push("case ",u&127,":");var d=new Array(r);var v=new Array(r);var g=new Array(r);var m=new Array(r);var y=0;for(var x=0;xx){continue}if(!(u&1<<_)!==!(u&1<0){A="+"+g[b]+"*c"}var T=.5*(d[b].length/y);var S=.5+.5*(m[b]/y);M.push("d"+b+"-"+S+"-"+T+"*("+d[b].join("+")+A+")/("+v[b].join("+")+")")}}h.push("a.push([",M.join(),"]);","break;")}i.push("}},");if(f.length>0){h.push("}}")}var E=[];for(var u=0;u<1<1){u=1}if(u<-1){u=-1}return i*Math.acos(u)};var l=function t(e,r,n,i,o,l,u,c,f,h,p,d){var v=Math.pow(o,2);var g=Math.pow(l,2);var m=Math.pow(p,2);var y=Math.pow(d,2);var x=v*g-v*y-g*m;if(x<0){x=0}x/=v*y+g*m;x=Math.sqrt(x)*(u===c?-1:1);var b=x*o/l*d;var _=x*-l/o*p;var w=h*b-f*_+(e+n)/2;var k=f*b+h*_+(r+i)/2;var M=(p-b)/o;var A=(d-_)/l;var T=(-p-b)/o;var S=(-d-_)/l;var E=s(1,0,M,A);var C=s(M,A,T,S);if(c===0&&C>0){C-=a}if(c===1&&C<0){C+=a}return[w,k,E,C]};var u=function t(e){var r=e.px,s=e.py,u=e.cx,c=e.cy,f=e.rx,h=e.ry,p=e.xAxisRotation,d=p===undefined?0:p,v=e.largeArcFlag,g=v===undefined?0:v,m=e.sweepFlag,y=m===undefined?0:m;var x=[];if(f===0||h===0){return[]}var b=Math.sin(d*a/360);var _=Math.cos(d*a/360);var w=_*(r-u)/2+b*(s-c)/2;var k=-b*(r-u)/2+_*(s-c)/2;if(w===0&&k===0){return[]}f=Math.abs(f);h=Math.abs(h);var M=Math.pow(w,2)/Math.pow(f,2)+Math.pow(k,2)/Math.pow(h,2);if(M>1){f*=Math.sqrt(M);h*=Math.sqrt(M)}var A=l(r,s,u,c,f,h,g,y,b,_,w,k),T=n(A,4),S=T[0],E=T[1],C=T[2],L=T[3];var I=Math.max(Math.ceil(Math.abs(L)/(a/4)),1);L/=I;for(var z=0;ze[2])e[2]=u[c+0];if(u[c+1]>e[3])e[3]=u[c+1]}}return e}},{"abs-svg-path":51,assert:59,"is-svg-path":391,"normalize-svg-path":496,"parse-svg-path":427}],496:[function(t,e,r){"use strict";e.exports=a;var n=t("svg-arc-to-cubic-bezier");function a(t){var e;var r=[];var a=0;var s=0;var l=0;var u=0;var c=null;var f=null;var h=0;var p=0;for(var d=0,v=t.length;d4){a=g[g.length-4];s=g[g.length-3]}else{a=h;s=p}r.push(g)}return r}function i(t,e,r,n){return["C",t,e,r,n,r,n]}function o(t,e,r,n,a,i){return["C",t/3+2/3*r,e/3+2/3*n,a/3+2/3*r,i/3+2/3*n,a,i]}},{"svg-arc-to-cubic-bezier":494}],497:[function(t,e,r){(function(r){"use strict";var n=t("svg-path-bounds");var a=t("parse-svg-path");var i=t("draw-svg-path");var o=t("is-svg-path");var s=t("bitmap-sdf");var l=document.createElement("canvas");var u=l.getContext("2d");e.exports=c;function c(t,e){if(!o(t))throw Error("Argument should be valid svg path string");if(!e)e={};var c,f;if(e.shape){c=e.shape[0];f=e.shape[1]}else{c=l.width=e.w||e.width||200;f=l.height=e.h||e.height||200}var h=Math.min(c,f);var p=e.stroke||0;var d=e.viewbox||e.viewBox||n(t);var v=[c/(d[2]-d[0]),f/(d[3]-d[1])];var g=Math.min(v[0]||0,v[1]||0)/2;u.fillStyle="black";u.fillRect(0,0,c,f);u.fillStyle="white";if(p){if(typeof p!="number")p=1;if(p>0){u.strokeStyle="white"}else{u.strokeStyle="black"}u.lineWidth=Math.abs(p)}u.translate(c*.5,f*.5);u.scale(g,g);if(r.Path2D){var m=new Path2D(t);u.fill(m);p&&u.stroke(m)}else{var y=a(t);i(u,y);u.fill();p&&u.stroke()}u.setTransform(1,0,0,1,0,0);var x=s(u,{cutoff:e.cutoff!=null?e.cutoff:.5,radius:e.radius!=null?e.radius:h*.5});return x}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"bitmap-sdf":81,"draw-svg-path":152,"is-svg-path":391,"parse-svg-path":427,"svg-path-bounds":495}],498:[function(t,e,r){(function(r){"use strict";e.exports=s;var n=t("vectorize-text");var a=window||r.global||{};var i=a.__TEXT_CACHE||{};a.__TEXT_CACHE={};function o(t){var e=t.cells;var r=t.positions;var n=new Float32Array(e.length*6);var a=0;var i=0;for(var o=0;o0){h+=.02}}var d=new Float32Array(f);var v=0;var g=-.5*h;for(var p=0;p=0;var a=!e&&n&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");if(a){if(t==="name"&&this._a===0){return this.toName()}return this.toRgbString()}if(t==="rgb"){r=this.toRgbString()}if(t==="prgb"){r=this.toPercentageRgbString()}if(t==="hex"||t==="hex6"){r=this.toHexString()}if(t==="hex3"){r=this.toHexString(true)}if(t==="hex4"){r=this.toHex8String(true)}if(t==="hex8"){r=this.toHex8String()}if(t==="name"){r=this.toName()}if(t==="hsl"){r=this.toHslString()}if(t==="hsv"){r=this.toHsvString()}return r||this.toHexString()},clone:function(){return c(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));this._r=r._r;this._g=r._g;this._b=r._b;this.setAlpha(r._a);return this},lighten:function(){return this._applyModification(k,arguments)},brighten:function(){return this._applyModification(M,arguments)},darken:function(){return this._applyModification(A,arguments)},desaturate:function(){return this._applyModification(b,arguments)},saturate:function(){return this._applyModification(_,arguments)},greyscale:function(){return this._applyModification(w,arguments)},spin:function(){return this._applyModification(T,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(I,arguments)},complement:function(){return this._applyCombination(S,arguments)},monochromatic:function(){return this._applyCombination(z,arguments)},splitcomplement:function(){return this._applyCombination(L,arguments)},triad:function(){return this._applyCombination(E,arguments)},tetrad:function(){return this._applyCombination(C,arguments)}};c.fromRatio=function(t,e){if(typeof t=="object"){var r={};for(var n in t){if(t.hasOwnProperty(n)){if(n==="a"){r[n]=t[n]}else{r[n]=q(t[n])}}}t=r}return c(t,e)};function f(t){var e={r:0,g:0,b:0};var r=1;var n=null;var a=null;var i=null;var o=false;var u=false;if(typeof t=="string"){t=X(t)}if(typeof t=="object"){if(Y(t.r)&&Y(t.g)&&Y(t.b)){e=h(t.r,t.g,t.b);o=true;u=String(t.r).substr(-1)==="%"?"prgb":"rgb"}else if(Y(t.h)&&Y(t.s)&&Y(t.v)){n=q(t.s);a=q(t.v);e=g(t.h,n,a);o=true;u="hsv"}else if(Y(t.h)&&Y(t.s)&&Y(t.l)){n=q(t.s);i=q(t.l);e=d(t.h,n,i);o=true;u="hsl"}if(t.hasOwnProperty("a")){r=t.a}}r=R(r);return{ok:o,format:t.format||u,r:s(255,l(e.r,0)),g:s(255,l(e.g,0)),b:s(255,l(e.b,0)),a:r}}function h(t,e,r){return{r:B(t,255)*255,g:B(e,255)*255,b:B(r,255)*255}}function p(t,e,r){t=B(t,255);e=B(e,255);r=B(r,255);var n=l(t,e,r),a=s(t,e,r);var i,o,u=(n+a)/2;if(n==a){i=o=0}else{var c=n-a;o=u>.5?c/(2-n-a):c/(n+a);switch(n){case t:i=(e-r)/c+(e1)r-=1;if(r<1/6)return t+(e-t)*6*r;if(r<1/2)return e;if(r<2/3)return t+(e-t)*(2/3-r)*6;return t}if(e===0){n=a=i=r}else{var s=r<.5?r*(1+e):r+e-r*e;var l=2*r-s;n=o(l,s,t+1/3);a=o(l,s,t);i=o(l,s,t-1/3)}return{r:n*255,g:a*255,b:i*255}}function v(t,e,r){t=B(t,255);e=B(e,255);r=B(r,255);var n=l(t,e,r),a=s(t,e,r);var i,o,u=n;var c=n-a;o=n===0?0:c/n;if(n==a){i=0}else{switch(n){case t:i=(e-r)/c+(e>1)+720)%360;--e;){n.h=(n.h+a)%360;i.push(c(n))}return i}function z(t,e){e=e||6;var r=c(t).toHsv();var n=r.h,a=r.s,i=r.v;var o=[];var s=1/e;while(e--){o.push(c({h:n,s:a,v:i}));i=(i+s)%1}return o}c.mix=function(t,e,r){r=r===0?0:r||50;var n=c(t).toRgb();var a=c(e).toRgb();var i=r/100;var o={r:(a.r-n.r)*i+n.r,g:(a.g-n.g)*i+n.g,b:(a.b-n.b)*i+n.b,a:(a.a-n.a)*i+n.a};return c(o)};c.readability=function(t,r){var n=c(t);var a=c(r);return(e.max(n.getLuminance(),a.getLuminance())+.05)/(e.min(n.getLuminance(),a.getLuminance())+.05)};c.isReadable=function(t,e,r){var n=c.readability(t,e);var a,i;i=false;a=Z(r);switch(a.level+a.size){case"AAsmall":case"AAAlarge":i=n>=4.5;break;case"AAlarge":i=n>=3;break;case"AAAsmall":i=n>=7;break}return i};c.mostReadable=function(t,e,r){var n=null;var a=0;var i;var o,s,l;r=r||{};o=r.includeFallbackColors;s=r.level;l=r.size;for(var u=0;ua){a=i;n=c(e[u])}}if(c.isReadable(t,n,{level:s,size:l})||!o){return n}else{r.includeFallbackColors=false;return c.mostReadable(t,["#fff","#000"],r)}};var P=c.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"};var O=c.hexNames=D(P);function D(t){var e={};for(var r in t){if(t.hasOwnProperty(r)){e[t[r]]=r}}return e}function R(t){t=parseFloat(t);if(isNaN(t)||t<0||t>1){t=1}return t}function B(t,r){if(j(t)){t="100%"}var n=V(t);t=s(r,l(0,parseFloat(t)));if(n){t=parseInt(t*r,10)/100}if(e.abs(t-r)<1e-6){return 1}return t%r/parseFloat(r)}function F(t){return s(1,l(0,t))}function N(t){return parseInt(t,16)}function j(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function V(t){return typeof t==="string"&&t.indexOf("%")!=-1}function U(t){return t.length==1?"0"+t:""+t}function q(t){if(t<=1){t=t*100+"%"}return t}function H(t){return e.round(parseFloat(t)*255).toString(16)}function G(t){return N(t)/255}var W=function(){var t="[-\\+]?\\d+%?";var e="[-\\+]?\\d*\\.\\d+%?";var r="(?:"+e+")|(?:"+t+")";var n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";var a="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+a),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+a),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+a),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})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Y(t){return!!W.CSS_UNIT.exec(t)}function X(t){t=t.replace(n,"").replace(a,"").toLowerCase();var e=false;if(P[t]){t=P[t];e=true}else if(t=="transparent"){return{r:0,g:0,b:0,a:0,format:"name"}}var r;if(r=W.rgb.exec(t)){return{r:r[1],g:r[2],b:r[3]}}if(r=W.rgba.exec(t)){return{r:r[1],g:r[2],b:r[3],a:r[4]}}if(r=W.hsl.exec(t)){return{h:r[1],s:r[2],l:r[3]}}if(r=W.hsla.exec(t)){return{h:r[1],s:r[2],l:r[3],a:r[4]}}if(r=W.hsv.exec(t)){return{h:r[1],s:r[2],v:r[3]}}if(r=W.hsva.exec(t)){return{h:r[1],s:r[2],v:r[3],a:r[4]}}if(r=W.hex8.exec(t)){return{r:N(r[1]),g:N(r[2]),b:N(r[3]),a:G(r[4]),format:e?"name":"hex8"}}if(r=W.hex6.exec(t)){return{r:N(r[1]),g:N(r[2]),b:N(r[3]),format:e?"name":"hex"}}if(r=W.hex4.exec(t)){return{r:N(r[1]+""+r[1]),g:N(r[2]+""+r[2]),b:N(r[3]+""+r[3]),a:G(r[4]+""+r[4]),format:e?"name":"hex8"}}if(r=W.hex3.exec(t)){return{r:N(r[1]+""+r[1]),g:N(r[2]+""+r[2]),b:N(r[3]+""+r[3]),format:e?"name":"hex"}}return false}function Z(t){var e,r;t=t||{level:"AA",size:"small"};e=(t.level||"AA").toUpperCase();r=(t.size||"small").toLowerCase();if(e!=="AA"&&e!=="AAA"){e="AA"}if(r!=="small"&&r!=="large"){r="small"}return{level:e,size:r}}if(typeof r!=="undefined"&&r.exports){r.exports=c}else if(typeof t==="function"&&t.amd){t(function(){return c})}else{window.tinycolor=c}})(Math)},{}],500:[function(t,e,r){"use strict";e.exports=a;e.exports.float32=e.exports.float=a;e.exports.fract32=e.exports.fract=n;function n(t){if(typeof t==="number"){return a(t-a(t))}var e=a(t);for(var r=0,n=e.length;rf)f=s[0];if(s[1]h)h=s[1]}function a(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(a);break;case"Point":n(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(n);break}}if(!e){var i=r(t),o,s=new Array(2),l,u=Infinity,c=u,f=-u,h=-u;t.arcs.forEach(function(t){var e=-1,r=t.length;while(++ef)f=s[0];if(s[1]h)h=s[1]}});for(l in t.objects){a(t.objects[l])}e=t.bbox=[u,c,f,h]}return e};var a=function(t,e){var r,n=t.length,a=n-e;while(a<--n)r=t[a],t[a++]=t[n],t[n]=r};var i=function(t,e){return e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(e){return o(t,e)})}:o(t,e)};function o(t,e){var r=e.id,n=e.bbox,a=e.properties==null?{}:e.properties,i=s(t,e);return r==null&&n==null?{type:"Feature",properties:a,geometry:i}:n==null?{type:"Feature",id:r,properties:a,geometry:i}:{type:"Feature",id:r,bbox:n,properties:a,geometry:i}}function s(t,e){var n=r(t),i=t.arcs;function o(t,e){if(e.length)e.pop();for(var r=i[t<0?~t:t],o=0,s=r.length;o1)n=f(t,e,r);else for(a=0,n=new Array(i=t.arcs.length);a1){for(var i=1,o=u(n[0]),s,c;io){c=n[0],n[0]=n[i],n[i]=c,o=s}}}return n})}}var v=function(t,e){var r=0,n=t.length;while(r>>1;if(t[a]=2))throw new Error("n must be \u22652");if(t.transform)throw new Error("already quantized");var r=n(t),a,i=r[0],o=(r[2]-i)/(e-1)||1,s=r[1],l=(r[3]-s)/(e-1)||1;function u(t){t[0]=Math.round((t[0]-i)/o);t[1]=Math.round((t[1]-s)/l)}function c(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"Point":u(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(u);break}}t.arcs.forEach(function(t){var e=1,r=1,n=t.length,a=t[0],u=a[0]=Math.round((a[0]-i)/o),c=a[1]=Math.round((a[1]-s)/l),f,h,p;for(;eMath.max(r,n)){a[2]=1}else if(r>Math.max(e,n)){a[0]=1}else{a[1]=1}var i=0;var o=0;for(var l=0;l<3;++l){i+=t[l]*t[l];o+=a[l]*t[l]}for(var l=0;l<3;++l){a[l]-=o/i*t[l]}s(a,a);return a}function h(t,e,r,a,i,o,s,l){this.center=n(r);this.up=n(a);this.right=n(i);this.radius=n([o]);this.angle=n([s,l]);this.angle.bounds=[[-Infinity,-Math.PI/2],[Infinity,Math.PI/2]];this.setDistanceLimits(t,e);this.computedCenter=this.center.curve(0);this.computedUp=this.up.curve(0);this.computedRight=this.right.curve(0);this.computedRadius=this.radius.curve(0);this.computedAngle=this.angle.curve(0);this.computedToward=[0,0,0];this.computedEye=[0,0,0];this.computedMatrix=new Array(16);for(var u=0;u<16;++u){this.computedMatrix[u]=.5}this.recalcMatrix(0)}var p=h.prototype;p.setDistanceLimits=function(t,e){if(t>0){t=Math.log(t)}else{t=-Infinity}if(e>0){e=Math.log(e)}else{e=Infinity}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];if(t){t[0]=Math.exp(e[0][0]);t[1]=Math.exp(e[1][0]);return t}return[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);var e=this.computedUp;var r=this.computedRight;var n=0;var a=0;for(var i=0;i<3;++i){a+=e[i]*r[i];n+=e[i]*e[i]}var l=Math.sqrt(n);var c=0;for(var i=0;i<3;++i){r[i]-=e[i]*a/n;c+=r[i]*r[i];e[i]/=l}var f=Math.sqrt(c);for(var i=0;i<3;++i){r[i]/=f}var h=this.computedToward;o(h,e,r);s(h,h);var p=Math.exp(this.computedRadius[0]);var d=this.computedAngle[0];var v=this.computedAngle[1];var g=Math.cos(d);var m=Math.sin(d);var y=Math.cos(v);var x=Math.sin(v);var b=this.computedCenter;var _=g*y;var w=m*y;var k=x;var M=-g*x;var A=-m*x;var T=y;var S=this.computedEye;var E=this.computedMatrix;for(var i=0;i<3;++i){var C=_*r[i]+w*h[i]+k*e[i];E[4*i+1]=M*r[i]+A*h[i]+T*e[i];E[4*i+2]=C;E[4*i+3]=0}var L=E[1];var I=E[5];var z=E[9];var P=E[2];var O=E[6];var D=E[10];var R=I*D-z*O;var B=z*P-L*D;var F=L*O-I*P;var N=u(R,B,F);R/=N;B/=N;F/=N;E[0]=R;E[4]=B;E[8]=F;for(var i=0;i<3;++i){S[i]=b[i]+E[2+4*i]*p}for(var i=0;i<3;++i){var c=0;for(var j=0;j<3;++j){c+=E[i+4*j]*S[j]}E[12+i]=-c}E[15]=1};p.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n){e[n]=r[n]}return e}return r};var d=[0,0,0];p.rotate=function(t,e,r,n){this.angle.move(t,e,r);if(n){this.recalcMatrix(t);var a=this.computedMatrix;d[0]=a[2];d[1]=a[6];d[2]=a[10];var o=this.computedUp;var s=this.computedRight;var l=this.computedToward;for(var u=0;u<3;++u){a[4*u]=o[u];a[4*u+1]=s[u];a[4*u+2]=l[u]}i(a,a,n,d);for(var u=0;u<3;++u){o[u]=a[4*u];s[u]=a[4*u+1]}this.up.set(t,o[0],o[1],o[2]);this.right.set(t,s[0],s[1],s[2])}};p.pan=function(t,e,r,n){e=e||0;r=r||0;n=n||0;this.recalcMatrix(t);var a=this.computedMatrix;var i=Math.exp(this.computedRadius[0]);var o=a[1];var s=a[5];var l=a[9];var c=u(o,s,l);o/=c;s/=c;l/=c;var f=a[0];var h=a[4];var p=a[8];var d=f*o+h*s+p*l;f-=o*d;h-=s*d;p-=l*d;var v=u(f,h,p);f/=v;h/=v;p/=v;var g=f*e+o*r;var m=h*e+s*r;var y=p*e+l*r;this.center.move(t,g,m,y);var x=Math.exp(this.computedRadius[0]);x=Math.max(1e-4,x+n);this.radius.set(t,Math.log(x))};p.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)};p.setMatrix=function(t,e,r,n){var i=1;if(typeof r==="number"){i=r|0}if(i<0||i>3){i=1}var o=(i+2)%3;var s=(i+1)%3;if(!e){this.recalcMatrix(t);e=this.computedMatrix}var l=e[i];var f=e[i+4];var h=e[i+8];if(!n){var p=u(l,f,h);l/=p;f/=p;h/=p}else{var d=Math.abs(l);var v=Math.abs(f);var g=Math.abs(h);var m=Math.max(d,v,g);if(d===m){l=l<0?-1:1;f=h=0}else if(g===m){h=h<0?-1:1;l=f=0}else{f=f<0?-1:1;l=h=0}}var y=e[o];var x=e[o+4];var b=e[o+8];var _=y*l+x*f+b*h;y-=l*_;x-=f*_;b-=h*_;var w=u(y,x,b);y/=w;x/=w;b/=w;var k=f*b-h*x;var M=h*y-l*b;var A=l*x-f*y;var T=u(k,M,A);k/=T;M/=T;A/=T;this.center.jump(t,G,W,Y);this.radius.idle(t);this.up.jump(t,l,f,h);this.right.jump(t,y,x,b);var S,E;if(i===2){var C=e[1];var L=e[5];var I=e[9];var z=C*y+L*x+I*b;var P=C*k+L*M+I*A;if(B<0){S=-Math.PI/2}else{S=Math.PI/2}E=Math.atan2(P,z)}else{var O=e[2];var D=e[6];var R=e[10];var B=O*l+D*f+R*h;var F=O*y+D*x+R*b;var N=O*k+D*M+R*A;S=Math.asin(c(B));E=Math.atan2(N,F)}this.angle.jump(t,E,S);this.recalcMatrix(t);var j=e[2];var V=e[6];var U=e[10];var q=this.computedMatrix;a(q,e);var H=q[15];var G=q[12]/H;var W=q[13]/H;var Y=q[14]/H;var X=Math.exp(this.computedRadius[0]);this.center.jump(t,G-j*X,W-V*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){if(e>0){this.radius.set(t,Math.log(e))}};p.lookAt=function(t,e,r,n){this.recalcMatrix(t);e=e||this.computedEye;r=r||this.computedCenter;n=n||this.computedUp;var a=n[0];var i=n[1];var o=n[2];var s=u(a,i,o);if(s<1e-6){return}a/=s;i/=s;o/=s;var l=e[0]-r[0];var f=e[1]-r[1];var h=e[2]-r[2];var p=u(l,f,h);if(p<1e-6){return}l/=p;f/=p;h/=p;var d=this.computedRight;var v=d[0];var g=d[1];var m=d[2];var y=a*v+i*g+o*m;v-=y*a;g-=y*i;m-=y*o;var x=u(v,g,m);if(x<.01){v=i*h-o*f;g=o*l-a*h;m=a*f-i*l;x=u(v,g,m);if(x<1e-6){return}}v/=x;g/=x;m/=x;this.up.set(t,a,i,o);this.right.set(t,v,g,m);this.center.set(t,r[0],r[1],r[2]);this.radius.set(t,Math.log(p));var b=i*m-o*g;var _=o*v-a*m;var w=a*g-i*v;var k=u(b,_,w);b/=k;_/=k;w/=k;var M=a*l+i*f+o*h;var A=v*l+g*f+m*h;var T=b*l+_*f+w*h;var S=Math.asin(c(M));var E=Math.atan2(T,A);var C=this.angle._state;var L=C[C.length-1];var I=C[C.length-2];L=L%(2*Math.PI);var z=Math.abs(L+2*Math.PI-E);var P=Math.abs(L-E);var O=Math.abs(L-2*Math.PI-E);if(z0){return r.pop()}return new ArrayBuffer(t)}r.mallocArrayBuffer=h;function p(t){return new Uint8Array(h(t),0,t)}r.mallocUint8=p;function d(t){return new Uint16Array(h(2*t),0,t)}r.mallocUint16=d;function v(t){return new Uint32Array(h(4*t),0,t)}r.mallocUint32=v;function g(t){return new Int8Array(h(t),0,t)}r.mallocInt8=g;function m(t){return new Int16Array(h(2*t),0,t)}r.mallocInt16=m;function y(t){return new Int32Array(h(4*t),0,t)}r.mallocInt32=y;function x(t){return new Float32Array(h(4*t),0,t)}r.mallocFloat32=r.mallocFloat=x;function b(t){return new Float64Array(h(8*t),0,t)}r.mallocFloat64=r.mallocDouble=b;function _(t){if(o){return new Uint8ClampedArray(h(t),0,t)}else{return p(t)}}r.mallocUint8Clamped=_;function w(t){return new DataView(h(t),0,t)}r.mallocDataView=w;function k(t){t=a.nextPow2(t);var e=a.log2(t);var r=u[e];if(r.length>0){return r.pop()}return new n(t)}r.mallocBuffer=k;r.clearCache=function t(){for(var e=0;e<32;++e){s.UINT8[e].length=0;s.UINT16[e].length=0;s.UINT32[e].length=0;s.INT8[e].length=0;s.INT16[e].length=0;s.INT32[e].length=0;s.FLOAT[e].length=0;s.DOUBLE[e].length=0;s.UINT8C[e].length=0;l[e].length=0;u[e].length=0}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},t("buffer").Buffer)},{"bit-twiddle":80,buffer:92,dup:154}],508:[function(t,e,r){"use strict";"use restrict";e.exports=n;function n(t){this.roots=new Array(t);this.ranks=new Array(t);for(var e=0;e=i)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}});for(var l=n[r];r=3)n.depth=arguments[2];if(arguments.length>=4)n.colors=arguments[3];if(y(e)){n.showHidden=e}else if(e){r._extend(n,e)}if(M(n.showHidden))n.showHidden=false;if(M(n.depth))n.depth=2;if(M(n.colors))n.colors=false;if(M(n.customInspect))n.customInspect=true;if(n.colors)n.stylize=l;return f(n,t,n.depth)}r.inspect=s;s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function l(t,e){var r=s.styles[e];if(r){return"\x1b["+s.colors[r][0]+"m"+t+"\x1b["+s.colors[r][1]+"m"}else{return t}}function u(t,e){return t}function c(t){var e={};t.forEach(function(t,r){e[t]=true});return e}function f(t,e,n){if(t.customInspect&&e&&C(e.inspect)&&e.inspect!==r.inspect&&!(e.constructor&&e.constructor.prototype===e)){var a=e.inspect(n,t);if(!w(a)){a=f(t,a,n)}return a}var i=h(t,e);if(i){return i}var o=Object.keys(e);var s=c(o);if(t.showHidden){o=Object.getOwnPropertyNames(e)}if(E(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0)){return p(e)}if(o.length===0){if(C(e)){var l=e.name?": "+e.name:"";return t.stylize("[Function"+l+"]","special")}if(A(e)){return t.stylize(RegExp.prototype.toString.call(e),"regexp")}if(S(e)){return t.stylize(Date.prototype.toString.call(e),"date")}if(E(e)){return p(e)}}var u="",y=false,x=["{","}"];if(m(e)){y=true;x=["[","]"]}if(C(e)){var b=e.name?": "+e.name:"";u=" [Function"+b+"]"}if(A(e)){u=" "+RegExp.prototype.toString.call(e)}if(S(e)){u=" "+Date.prototype.toUTCString.call(e)}if(E(e)){u=" "+p(e)}if(o.length===0&&(!y||e.length==0)){return x[0]+u+x[1]}if(n<0){if(A(e)){return t.stylize(RegExp.prototype.toString.call(e),"regexp")}else{return t.stylize("[Object]","special")}}t.seen.push(e);var _;if(y){_=d(t,e,n,s,o)}else{_=o.map(function(r){return v(t,e,n,s,r,y)})}t.seen.pop();return g(_,u,x)}function h(t,e){if(M(e))return t.stylize("undefined","undefined");if(w(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(_(e))return t.stylize(""+e,"number");if(y(e))return t.stylize(""+e,"boolean");if(x(e))return t.stylize("null","null")}function p(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,n,a){var i=[];for(var o=0,s=e.length;o-1){if(i){s=s.split("\n").map(function(t){return" "+t}).join("\n").substr(2)}else{s="\n"+s.split("\n").map(function(t){return" "+t}).join("\n")}}}else{s=t.stylize("[Circular]","special")}}if(M(o)){if(i&&a.match(/^\d+$/)){return s}o=JSON.stringify(""+a);if(o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){o=o.substr(1,o.length-2);o=t.stylize(o,"name")}else{o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");o=t.stylize(o,"string")}}return o+": "+s}function g(t,e,r){var n=0;var a=t.reduce(function(t,e){n++;if(e.indexOf("\n")>=0)n++;return t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(a>60){return r[0]+(e===""?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]}return r[0]+e+" "+t.join(", ")+" "+r[1]}function m(t){return Array.isArray(t)}r.isArray=m;function y(t){return typeof t==="boolean"}r.isBoolean=y;function x(t){return t===null}r.isNull=x;function b(t){return t==null}r.isNullOrUndefined=b;function _(t){return typeof t==="number"}r.isNumber=_;function w(t){return typeof t==="string"}r.isString=w;function k(t){return typeof t==="symbol"}r.isSymbol=k;function M(t){return t===void 0}r.isUndefined=M;function A(t){return T(t)&&I(t)==="[object RegExp]"}r.isRegExp=A;function T(t){return typeof t==="object"&&t!==null}r.isObject=T;function S(t){return T(t)&&I(t)==="[object Date]"}r.isDate=S;function E(t){return T(t)&&(I(t)==="[object Error]"||t instanceof Error)}r.isError=E;function C(t){return typeof t==="function"}r.isFunction=C;function L(t){return t===null||typeof t==="boolean"||typeof t==="number"||typeof t==="string"||typeof t==="symbol"||typeof t==="undefined"}r.isPrimitive=L;r.isBuffer=t("./support/isBuffer");function I(t){return Object.prototype.toString.call(t)}function z(t){return t<10?"0"+t.toString(10):t.toString(10)}var P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function O(){var t=new Date;var e=[z(t.getHours()),z(t.getMinutes()),z(t.getSeconds())].join(":");return[t.getDate(),P[t.getMonth()],e].join(" ")}r.log=function(){console.log("%s - %s",O(),r.format.apply(r,arguments))};r.inherits=t("inherits");r._extend=function(t,e){if(!e||!T(e))return t;var r=Object.keys(e);var n=r.length;while(n--){t[r[n]]=e[r[n]]}return t};function D(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}).call(this,t("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":513,_process:449,inherits:512}],515:[function(t,e,r){"use strict";e.exports=o;var n=t("./lib/vtext");var a=null;var i=null;if(typeof document!=="undefined"){a=document.createElement("canvas");a.width=8192;a.height=1024;i=a.getContext("2d")}function o(t,e){if(typeof e!=="object"||e===null){e={}}return n(t,e.canvas||a,e.context||i,e)}},{"./lib/vtext":516}],516:[function(t,e,r){"use strict";e.exports=d;e.exports.processPixels=p;var n=t("surface-nets");var a=t("ndarray");var i=t("simplify-planar-graph");var o=t("clean-pslg");var s=t("cdt2d");var l=t("planar-graph-to-polyline");function u(t,e,r){var n=e.textAlign||"start";var a=e.textBaseline||"alphabetic";var i=[1<<30,1<<30];var o=[0,0];var s=t.length;for(var l=0;l8192){throw new Error("vectorize-text: String too long (sorry, this will get fixed later)")}var o=3*n;if(t.height=0?e[i]:a}}function a(e){var n=m(e);if(n){return r in n}else{return t.indexOf(e)>=0}}function i(n,a){var i;var o=m(n);if(o){o[r]=a}else{i=t.indexOf(n);if(i>=0){e[i]=a}else{i=t.length;e[i]=a;t[i]=n}}return this}function o(n){var a=m(n);var i,o;if(a){return r in a&&delete a[r]}else{i=t.indexOf(n);if(i<0){return false}o=t.length-1;t[i]=void 0;e[i]=e[o];t[i]=t[o];t.length=o;e.length=o;return true}}return Object.create(w.prototype,{get___:{value:y(n)},has___:{value:y(a)},set___:{value:y(i)},delete___:{value:y(o)}})};w.prototype=Object.create(Object.prototype,{get:{value:function t(e,r){return this.get___(e,r)},writable:true,configurable:true},has:{value:function t(e){return this.has___(e)},writable:true,configurable:true},set:{value:function t(e,r){return this.set___(e,r)},writable:true,configurable:true},delete:{value:function t(e){return this.delete___(e)},writable:true,configurable:true}});if(typeof a==="function"){(function(){if(n&&typeof Proxy!=="undefined"){Proxy=undefined}function t(){if(!(this instanceof w)){b()}var t=new a;var e=undefined;var i=false;function o(r,n){if(e){return t.has(r)?t.get(r):e.get___(r,n)}else{return t.get(r,n)}}function s(r){return t.has(r)||(e?e.has___(r):false)}var l;if(n){l=function(r,n){t.set(r,n);if(!t.has(r)){if(!e){e=new w}e.set(r,n)}return this}}else{l=function(r,n){if(i){try{t.set(r,n)}catch(t){if(!e){e=new w}e.set___(r,n)}}else{t.set(r,n)}return this}}function u(r){var n=!!t["delete"](r);if(e){return e.delete___(r)||n}return n}return Object.create(w.prototype,{get___:{value:y(o)},has___:{value:y(s)},set___:{value:y(l)},delete___:{value:y(u)},permitHostObjects___:{value:y(function(t){if(t===r){i=true}else{throw new Error("bogus call to permitHostObjects___")}})}})}t.prototype=w.prototype;e.exports=t;Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:false,configurable:true,writable:true})})()}else{if(typeof Proxy!=="undefined"){Proxy=undefined}e.exports=w}})()},{}],518:[function(t,e,r){var n=t("./hidden-store.js");e.exports=a;function a(){var t={};return function(e){if((typeof e!=="object"||e===null)&&typeof e!=="function"){throw new Error("Weakmap-shim: Key must be object")}var r=e.valueOf(t);return r&&r.identity===t?r:n(e,t)}}},{"./hidden-store.js":519}],519:[function(t,e,r){e.exports=n;function n(t,e){var r={identity:e};var n=t.valueOf;Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:true});return r}},{}],520:[function(t,e,r){var n=t("./create-store.js");e.exports=a;function a(){var t=n();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r;return this},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}},{"./create-store.js":518}],521:[function(t,e,r){var n=t("get-canvas-context");e.exports=function t(e){return n("webgl",e)}},{"get-canvas-context":221}],522:[function(t,e,r){var n=t("../main");var a=t("object-assign");var i=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar;a(o.prototype,{name:"Chinese",jdEpoch:1721425.5,hasYearZero:false,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(t,e){if(typeof t==="string"){var r=t.match(l);return r?r[0]:""}var n=this._validateYear(t);var a=t.month();var i=""+this.toChineseMonth(n,a);if(e&&i.length<2){i="0"+i}if(this.isIntercalaryMonth(n,a)){i+="i"}return i},monthNames:function(t){if(typeof t==="string"){var e=t.match(u);return e?e[0]:""}var r=this._validateYear(t);var n=t.month();var a=this.toChineseMonth(r,n);var i=["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708"][a-1];if(this.isIntercalaryMonth(r,n)){i="\u95f0"+i}return i},monthNamesShort:function(t){if(typeof t==="string"){var e=t.match(c);return e?e[0]:""}var r=this._validateYear(t);var n=t.month();var a=this.toChineseMonth(r,n);var i=["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"][a-1];if(this.isIntercalaryMonth(r,n)){i="\u95f0"+i}return i},parseMonth:function(t,e){t=this._validateYear(t);var r=parseInt(e);var n;if(!isNaN(r)){var a=e[e.length-1];n=a==="i"||a==="I"}else{if(e[0]==="\u95f0"){n=true;e=e.substring(1)}if(e[e.length-1]==="\u6708"){e=e.substring(0,e.length-1)}r=1+["\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u5341\u4e00","\u5341\u4e8c"].indexOf(e)}var i=this.toMonthIndex(t,r,n);return i},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:false}},_validateYear:function(t,e){if(t.year){t=t.year()}if(typeof t!=="number"||t<1888||t>2111){throw e.replace(/\{0\}/,this.local.name)}return t},toMonthIndex:function(t,e,r){var a=this.intercalaryMonth(t);var i=r&&e!==a;if(i||e<1||e>12){throw n.local.invalidMonth.replace(/\{0\}/,this.local.name)}var o;if(!a){o=e-1}else if(!r&&e<=a){o=e-1}else{o=e}return o},toChineseMonth:function(t,e){if(t.year){t=t.year();e=t.month()}var r=this.intercalaryMonth(t);var a=r?12:11;if(e<0||e>a){throw n.local.invalidMonth.replace(/\{0\}/,this.local.name)}var i;if(!r){i=e+1}else if(e>13;return r},isIntercalaryMonth:function(t,e){if(t.year){t=t.year();e=t.month()}var r=this.intercalaryMonth(t);return!!r&&r===e},leapYear:function(t){return this.intercalaryMonth(t)!==0},weekOfYear:function(t,e,r){var a=this._validateYear(t,n.local.invalidyear);var o=h[a-h[0]];var s=o>>9&4095;var l=o>>5&15;var u=o&31;var c;c=i.newDate(s,l,u);c.add(4-(c.dayOfWeek()||7),"d");var f=this.toJD(t,e,r)-c.toJD();return 1+Math.floor(f/7)},monthsInYear:function(t){return this.leapYear(t)?13:12},daysInMonth:function(t,e){if(t.year){e=t.month();t=t.year()}t=this._validateYear(t);var r=f[t-f[0]];var a=r>>13;var i=a?12:11;if(e>i){throw n.local.invalidMonth.replace(/\{0\}/,this.local.name)}var o=r&1<<12-e?30:29;return o},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,s,r,n.local.invalidDate);t=this._validateYear(a.year());e=a.month();r=a.day();var o=this.isIntercalaryMonth(t,e);var s=this.toChineseMonth(t,e);var l=d(t,s,r,o);return i.toJD(l.year,l.month,l.day)},fromJD:function(t){var e=i.fromJD(t);var r=p(e.year(),e.month(),e.day());var n=this.toMonthIndex(r.year,r.month,r.isIntercalary);return this.newDate(r.year,n,r.day)},fromString:function(t){var e=t.match(s);var r=this._validateYear(+e[1]);var n=+e[2];var a=!!e[3];var i=this.toMonthIndex(r,n,a);var o=+e[4];return this.newDate(r,i,o)},add:function(t,e,r){var n=t.year();var a=t.month();var i=this.isIntercalaryMonth(n,a);var s=this.toChineseMonth(n,a);var l=Object.getPrototypeOf(o.prototype).add.call(this,t,e,r);if(r==="y"){var u=l.year();var c=l.month();var f=this.isIntercalaryMonth(u,s);var h=i&&f?this.toMonthIndex(u,s,true):this.toMonthIndex(u,s,false);if(h!==c){l.month(h)}}return l}});var s=/^\s*(-?\d\d\d\d|\d\d)[-/](\d?\d)([iI]?)[-/](\d?\d)/m;var l=/^\d?\d[iI]?/m;var u=/^\u95f0?\u5341?[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]?\u6708/m;var c=/^\u95f0?\u5341?[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]?/m;n.calendars.chinese=o;var f=[1887,5780,5802,19157,2742,50359,1198,2646,46378,7466,3412,30122,5482,67949,2396,5294,43597,6732,6954,36181,2772,4954,18781,2396,54427,5274,6730,47781,5800,6868,21210,4790,59703,2350,5270,46667,3402,3496,38325,1388,4782,18735,2350,52374,6804,7498,44457,2906,1388,29294,4700,63789,6442,6804,56138,5802,2772,38235,1210,4698,22827,5418,63125,3476,5802,43701,2484,5302,27223,2646,70954,7466,3412,54698,5482,2412,38062,5294,2636,32038,6954,60245,2772,4826,43357,2394,5274,39501,6730,72357,5800,5844,53978,4790,2358,38039,5270,87627,3402,3496,54708,5484,4782,43311,2350,3222,27978,7498,68965,2904,5484,45677,4700,6444,39573,6804,6986,19285,2772,62811,1210,4698,47403,5418,5780,38570,5546,76469,2420,5302,51799,2646,5414,36501,3412,5546,18869,2412,54446,5276,6732,48422,6822,2900,28010,4826,92509,2394,5274,55883,6730,6820,47956,5812,2778,18779,2358,62615,5270,5450,46757,3492,5556,27318,4718,67887,2350,3222,52554,7498,3428,38252,5468,4700,31022,6444,64149,6804,6986,43861,2772,5338,35421,2650,70955,5418,5780,54954,5546,2740,38074,5302,2646,29991,3366,61011,3412,5546,43445,2412,5294,35406,6732,72998,6820,6996,52586,2778,2396,38045,5274,6698,23333,6820,64338,5812,2746,43355,2358,5270,39499,5450,79525,3492,5548];var h=[1887,966732,967231,967733,968265,968766,969297,969798,970298,970829,971330,971830,972362,972863,973395,973896,974397,974928,975428,975929,976461,976962,977462,977994,978494,979026,979526,980026,980558,981059,981559,982091,982593,983124,983624,984124,984656,985157,985656,986189,986690,987191,987722,988222,988753,989254,989754,990286,990788,991288,991819,992319,992851,993352,993851,994383,994885,995385,995917,996418,996918,997450,997949,998481,998982,999483,1000014,1000515,1001016,1001548,1002047,1002578,1003080,1003580,1004111,1004613,1005113,1005645,1006146,1006645,1007177,1007678,1008209,1008710,1009211,1009743,1010243,1010743,1011275,1011775,1012306,1012807,1013308,1013840,1014341,1014841,1015373,1015874,1016404,1016905,1017405,1017937,1018438,1018939,1019471,1019972,1020471,1021002,1021503,1022035,1022535,1023036,1023568,1024069,1024568,1025100,1025601,1026102,1026633,1027133,1027666,1028167,1028666,1029198,1029699,1030199,1030730,1031231,1031763,1032264,1032764,1033296,1033797,1034297,1034828,1035329,1035830,1036362,1036861,1037393,1037894,1038394,1038925,1039427,1039927,1040459,1040959,1041491,1041992,1042492,1043023,1043524,1044024,1044556,1045057,1045558,1046090,1046590,1047121,1047622,1048122,1048654,1049154,1049655,1050187,1050689,1051219,1051720,1052220,1052751,1053252,1053752,1054284,1054786,1055285,1055817,1056317,1056849,1057349,1057850,1058382,1058883,1059383,1059915,1060415,1060947,1061447,1061947,1062479,1062981,1063480,1064012,1064514,1065014,1065545,1066045,1066577,1067078,1067578,1068110,1068611,1069112,1069642,1070142,1070674,1071175,1071675,1072207,1072709,1073209,1073740,1074241,1074741,1075273,1075773,1076305,1076807,1077308,1077839,1078340,1078840,1079372,1079871,1080403,1080904];function p(t,e,r,n){var a;var i;if(typeof t==="object"){a=t;i=e||{}}else{var o=typeof t==="number"&&t>=1888&&t<=2111;if(!o)throw new Error("Solar year outside range 1888-2111");var s=typeof e==="number"&&e>=1&&e<=12;if(!s)throw new Error("Solar month outside range 1 - 12");var l=typeof r==="number"&&r>=1&&r<=31;if(!l)throw new Error("Solar day outside range 1 - 31");a={year:t,month:e,day:r};i=n||{}}var u=h[a.year-h[0]];var c=a.year<<9|a.month<<5|a.day;i.year=c>=u?a.year:a.year-1;u=h[i.year-h[0]];var p=u>>9&4095;var d=u>>5&15;var v=u&31;var g;var m=new Date(p,d-1,v);var y=new Date(a.year,a.month-1,a.day);g=Math.round((y-m)/(24*3600*1e3));var x=f[i.year-f[0]];var b;for(b=0;b<13;b++){var _=x&1<<12-b?30:29;if(g<_){break}g-=_}var w=x>>13;if(!w||b=1888&&t<=2111;if(!s)throw new Error("Lunar year outside range 1888-2111");var l=typeof e==="number"&&e>=1&&e<=12;if(!l)throw new Error("Lunar month outside range 1 - 12");var u=typeof r==="number"&&r>=1&&r<=30;if(!u)throw new Error("Lunar day outside range 1 - 30");var c;if(typeof n==="object"){c=false;i=n}else{c=!!n;i=a||{}}o={year:t,month:e,day:r,isIntercalary:c}}var p;p=o.day-1;var d=f[o.year-f[0]];var v=d>>13;var g;if(!v){g=o.month-1}else if(o.month>v){g=o.month}else if(o.isIntercalary){g=o.month}else{g=o.month-1}for(var m=0;m>9&4095;var _=x>>5&15;var w=x&31;var k=new Date(b,_-1,w+p);i.year=k.getFullYear();i.month=1+k.getMonth();i.day=k.getDate();return i}},{"../main":536,"object-assign":421}],523:[function(t,e,r){var n=t("../main");var a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar;a(i.prototype,{name:"Coptic",jdEpoch:1825029.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:false,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Coptic",epochs:["BAM","AM"],monthNames:["Thout","Paopi","Hathor","Koiak","Tobi","Meshir","Paremhat","Paremoude","Pashons","Paoni","Epip","Mesori","Pi Kogi Enavot"],monthNamesShort:["Tho","Pao","Hath","Koi","Tob","Mesh","Pat","Pad","Pash","Pao","Epi","Meso","PiK"],dayNames:["Tkyriaka","Pesnau","Pshoment","Peftoou","Ptiou","Psoou","Psabbaton"],dayNamesShort:["Tky","Pes","Psh","Pef","Pti","Pso","Psa"],dayNamesMin:["Tk","Pes","Psh","Pef","Pt","Pso","Psa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:false}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);var t=e.year()+(e.year()<0?1:0);return t%4===3||t%4===-1},monthsInYear:function(t){this._validate(t,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return 13},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);n.add(-n.dayOfWeek(),"d");return Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(r.month()===13&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=a.year();if(t<0){t++}return a.day()+(a.month()-1)*30+(t-1)*365+Math.floor(t/4)+this.jdEpoch-1},fromJD:function(t){var e=Math.floor(t)+.5-this.jdEpoch;var r=Math.floor((e-Math.floor((e+366)/1461))/365)+1;if(r<=0){r--}e=Math.floor(t)+.5-this.newDate(r,1,1).toJD();var n=Math.floor(e/30)+1;var a=e-(n-1)*30+1;return this.newDate(r,n,a)}});n.calendars.coptic=i},{"../main":536,"object-assign":421}],524:[function(t,e,r){var n=t("../main");var a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar;a(i.prototype,{name:"Discworld",jdEpoch:1721425.5,daysPerMonth:[16,32,32,32,32,32,32,32,32,32,32,32,32],hasYearZero:false,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Discworld",epochs:["BUC","UC"],monthNames:["Ick","Offle","February","March","April","May","June","Grune","August","Spune","Sektober","Ember","December"],monthNamesShort:["Ick","Off","Feb","Mar","Apr","May","Jun","Gru","Aug","Spu","Sek","Emb","Dec"],dayNames:["Sunday","Octeday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Oct","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Oc","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:2,isRTL:false}},leapYear:function(t){this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return false},monthsInYear:function(t){this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return 13},daysInYear:function(t){this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return 400},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);n.add(-n.dayOfWeek(),"d");return Math.floor((n.dayOfYear()-1)/8)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]},daysInWeek:function(){return 8},dayOfWeek:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return(a.day()+1)%8},weekDay:function(t,e,r){var n=this.dayOfWeek(t,e,r);return n>=2&&n<=6},extraInfo:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return{century:o[Math.floor((a.year()-1)/100)+1]||""}},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=a.year()+(a.year()<0?1:0);e=a.month();r=a.day();return r+(e>1?16:0)+(e>2?(e-2)*32:0)+(t-1)*400+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t+.5)-Math.floor(this.jdEpoch)-1;var e=Math.floor(t/400)+1;t-=(e-1)*400;t+=t>15?16:0;var r=Math.floor(t/32)+1;var n=t-(r-1)*32+1;return this.newDate(e<=0?e-1:e,r,n)}});var o={20:"Fruitbat",21:"Anchovy"};n.calendars.discworld=i},{"../main":536,"object-assign":421}],525:[function(t,e,r){var n=t("../main");var a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar;a(i.prototype,{name:"Ethiopian",jdEpoch:1724220.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:false,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:false}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);var t=e.year()+(e.year()<0?1:0);return t%4===3||t%4===-1},monthsInYear:function(t){this._validate(t,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return 13},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);n.add(-n.dayOfWeek(),"d");return Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(r.month()===13&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=a.year();if(t<0){t++}return a.day()+(a.month()-1)*30+(t-1)*365+Math.floor(t/4)+this.jdEpoch-1},fromJD:function(t){var e=Math.floor(t)+.5-this.jdEpoch;var r=Math.floor((e-Math.floor((e+366)/1461))/365)+1;if(r<=0){r--}e=Math.floor(t)+.5-this.newDate(r,1,1).toJD();var n=Math.floor(e/30)+1;var a=e-(n-1)*30+1;return this.newDate(r,n,a)}});n.calendars.ethiopian=i},{"../main":536,"object-assign":421}],526:[function(t,e,r){var n=t("../main");var a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar;a(i.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:false,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:false}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return this._leapYear(e.year())},_leapYear:function(t){t=t<0?t+1:t;return o(t*7+1,19)<7},monthsInYear:function(t){this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return this._leapYear(t.year?t.year():t)?13:12},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);n.add(-n.dayOfWeek(),"d");return Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=e.year();return this.toJD(t===-1?+1:t+1,7,1)-this.toJD(t,7,1)},daysInMonth:function(t,e){if(t.year){e=t.month();t=t.year()}this._validate(t,e,this.minDay,n.local.invalidMonth);return e===12&&this.leapYear(t)?30:e===8&&o(this.daysInYear(t),10)===5?30:e===9&&o(this.daysInYear(t),10)===3?29:this.daysPerMonth[e-1]},weekDay:function(t,e,r){return this.dayOfWeek(t,e,r)!==6},extraInfo:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return{yearType:(this.leapYear(a)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(a)%10-3]}},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=a.year();e=a.month();r=a.day();var i=t<=0?t+1:t;var o=this.jdEpoch+this._delay1(i)+this._delay2(i)+r+1;if(e<7){for(var s=7;s<=this.monthsInYear(t);s++){o+=this.daysInMonth(t,s)}for(var s=1;s=this.toJD(e===-1?+1:e+1,7,1)){e++}var r=tthis.toJD(e,r,this.daysInMonth(e,r))){r++}var n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}});function o(t,e){return t-e*Math.floor(t/e)}n.calendars.hebrew=i},{"../main":536,"object-assign":421}],527:[function(t,e,r){var n=t("../main");var a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar;a(i.prototype,{name:"Islamic",jdEpoch:1948439.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:false,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-kham\u012bs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:false}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return(e.year()*11+14)%30<11},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);n.add(-n.dayOfWeek(),"d");return Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return this.leapYear(t)?355:354},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(r.month()===12&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return this.dayOfWeek(t,e,r)!==5},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=a.year();e=a.month();r=a.day();t=t<=0?t+1:t;return r+Math.ceil(29.5*(e-1))+(t-1)*354+Math.floor((3+11*t)/30)+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t)+.5;var e=Math.floor((30*(t-this.jdEpoch)+10646)/10631);e=e<=0?e-1:e;var r=Math.min(12,Math.ceil((t-29-this.toJD(e,1,1))/29.5)+1);var n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}});n.calendars.islamic=i},{"../main":536,"object-assign":421}],528:[function(t,e,r){var n=t("../main");var a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar;a(i.prototype,{name:"Julian",jdEpoch:1721423.5,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:false,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:false}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);var t=e.year()<0?e.year()+1:e.year();return t%4===0},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);n.add(4-(n.dayOfWeek()||7),"d");return Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(r.month()===2&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=a.year();e=a.month();r=a.day();if(t<0){t++}if(e<=2){t--;e+=12}return Math.floor(365.25*(t+4716))+Math.floor(30.6001*(e+1))+r-1524.5},fromJD:function(t){var e=Math.floor(t+.5);var r=e+1524;var n=Math.floor((r-122.1)/365.25);var a=Math.floor(365.25*n);var i=Math.floor((r-a)/30.6001);var o=i-Math.floor(i<14?1:13);var s=n-Math.floor(o>2?4716:4715);var l=r-a-Math.floor(30.6001*i);if(s<=0){s--}return this.newDate(s,o,l)}});n.calendars.julian=i},{"../main":536,"object-assign":421}],529:[function(t,e,r){var n=t("../main");var a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar;a(i.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:true,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:false,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(t){this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return false},formatYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=e.year();var r=Math.floor(t/400);t=t%400;t+=t<0?400:0;var a=Math.floor(t/20);return r+"."+a+"."+t%20},forYear:function(t){t=t.split(".");if(t.length<3){throw"Invalid Mayan year"}var e=0;for(var r=0;r19||r>0&&n<0){throw"Invalid Mayan year"}e=e*20+n}return e},monthsInYear:function(t){this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return 18},weekOfYear:function(t,e,r){this._validate(t,e,r,n.local.invalidDate);return 0},daysInYear:function(t){this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return 360},daysInMonth:function(t,e){this._validate(t,e,this.minDay,n.local.invalidMonth);return 20},daysInWeek:function(){return 5},dayOfWeek:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return a.day()},weekDay:function(t,e,r){this._validate(t,e,r,n.local.invalidDate);return true},extraInfo:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);var i=a.toJD();var o=this._toHaab(i);var s=this._toTzolkin(i);return{haabMonthName:this.local.haabMonths[o[0]-1],haabMonth:o[0],haabDay:o[1],tzolkinDayName:this.local.tzolkinMonths[s[0]-1],tzolkinDay:s[0],tzolkinTrecena:s[1]}},_toHaab:function(t){t-=this.jdEpoch;var e=o(t+8+(18-1)*20,365);return[Math.floor(e/20)+1,o(e,20)]},_toTzolkin:function(t){t-=this.jdEpoch;return[s(t+20,20),s(t+4,13)]},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);return a.day()+a.month()*20+a.year()*360+this.jdEpoch},fromJD:function(t){t=Math.floor(t)+.5-this.jdEpoch;var e=Math.floor(t/360);t=t%360;t+=t<0?360:0;var r=Math.floor(t/20);var n=t%20;return this.newDate(e,r,n)}});function o(t,e){return t-e*Math.floor(t/e)}function s(t,e){return o(t-1,e)+1}n.calendars.mayan=i},{"../main":536,"object-assign":421}],530:[function(t,e,r){var n=t("../main");var a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar;var o=n.instance("gregorian");a(i.prototype,{name:"Nanakshahi",jdEpoch:2257673.5,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:false,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:false}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return o.leapYear(e.year()+(e.year()<1?1:0)+1469)},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);n.add(1-(n.dayOfWeek()||7),"d");return Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(r.month()===12&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidMonth);var t=a.year();if(t<0){t++}var i=a.day();for(var s=1;s=this.toJD(e+1,1,1)){e++}var r=t-Math.floor(this.toJD(e,1,1)+.5)+1;var n=1;while(r>this.daysInMonth(e,n)){r-=this.daysInMonth(e,n);n++}return this.newDate(e,n,r)}});n.calendars.nanakshahi=i},{"../main":536,"object-assign":421}],531:[function(t,e,r){var n=t("../main");var a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar;a(i.prototype,{name:"Nepali",jdEpoch:1700709.5,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:false,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:false}},leapYear:function(t){return this.daysInYear(t)!==this.daysPerYear},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);n.add(-n.dayOfWeek(),"d");return Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);t=e.year();if(typeof this.NEPALI_CALENDAR_DATA[t]==="undefined"){return this.daysPerYear}var r=0;for(var a=this.minMonth;a<=12;a++){r+=this.NEPALI_CALENDAR_DATA[t][a]}return r},daysInMonth:function(t,e){if(t.year){e=t.month();t=t.year()}this._validate(t,e,this.minDay,n.local.invalidMonth);return typeof this.NEPALI_CALENDAR_DATA[t]==="undefined"?this.daysPerMonth[e-1]:this.NEPALI_CALENDAR_DATA[t][e]},weekDay:function(t,e,r){return this.dayOfWeek(t,e,r)!==6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=a.year();e=a.month();r=a.day();var i=n.instance();var o=0;var s=e;var l=t;this._createMissingCalendarData(t);var u=t-(s>9||s===9&&r>=this.NEPALI_CALENDAR_DATA[l][0]?56:57);if(e!==9){o=r;s--}while(s!==9){if(s<=0){s=12;l--}o+=this.NEPALI_CALENDAR_DATA[l][s];s--}if(e===9){o+=r-this.NEPALI_CALENDAR_DATA[l][0];if(o<0){o+=i.daysInYear(u)}}else{o+=this.NEPALI_CALENDAR_DATA[l][9]-this.NEPALI_CALENDAR_DATA[l][0]}return i.newDate(u,1,1).add(o,"d").toJD()},fromJD:function(t){var e=n.instance();var r=e.fromJD(t);var a=r.year();var i=r.dayOfYear();var o=a+56;this._createMissingCalendarData(o);var s=9;var l=this.NEPALI_CALENDAR_DATA[o][0];var u=this.NEPALI_CALENDAR_DATA[o][s]-l+1;while(i>u){s++;if(s>12){s=1;o++}u+=this.NEPALI_CALENDAR_DATA[o][s]}var c=this.NEPALI_CALENDAR_DATA[o][s]-(u-i);return this.newDate(o,s,c)},_createMissingCalendarData:function(t){var e=this.daysPerMonth.slice(0);e.unshift(17);for(var r=t-1;r0?474:473))%2820+474+38)*682%2816<682},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);n.add(-((n.dayOfWeek()+1)%7),"d");return Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(r.month()===12&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return this.dayOfWeek(t,e,r)!==5},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);t=a.year();e=a.month();r=a.day();var i=t-(t>=0?474:473);var s=474+o(i,2820);return r+(e<=7?(e-1)*31:(e-1)*30+6)+Math.floor((s*682-110)/2816)+(s-1)*365+Math.floor(i/2820)*1029983+this.jdEpoch-1},fromJD:function(t){t=Math.floor(t)+.5;var e=t-this.toJD(475,1,1);var r=Math.floor(e/1029983);var n=o(e,1029983);var a=2820;if(n!==1029982){var i=Math.floor(n/366);var s=o(n,366);a=Math.floor((2134*i+2816*s+2815)/1028522)+i+1}var l=a+2820*r+474;l=l<=0?l-1:l;var u=t-this.toJD(l,1,1)+1;var c=u<=186?Math.ceil(u/31):Math.ceil((u-6)/30);var f=t-this.toJD(l,c,1)+1;return this.newDate(l,c,f)}});function o(t,e){return t-e*Math.floor(t/e)}n.calendars.persian=i;n.calendars.jalali=i},{"../main":536,"object-assign":421}],533:[function(t,e,r){var n=t("../main");var a=t("object-assign");var i=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar;a(o.prototype,{name:"Taiwan",jdEpoch:2419402.5,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:false,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:false}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);var t=this._t2gYear(e.year());return i.leapYear(t)},weekOfYear:function(t,e,r){var a=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);var t=this._t2gYear(a.year());return i.weekOfYear(t,a.month(),a.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(r.month()===2&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);var t=this._t2gYear(a.year());return i.toJD(t,a.month(),a.day())},fromJD:function(t){var e=i.fromJD(t);var r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)},_g2tYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)}});n.calendars.taiwan=o},{"../main":536,"object-assign":421}],534:[function(t,e,r){var n=t("../main");var a=t("object-assign");var i=n.instance();function o(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}o.prototype=new n.baseCalendar;a(o.prototype,{name:"Thai",jdEpoch:1523098.5,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:false,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:false}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);var t=this._t2gYear(e.year());return i.leapYear(t)},weekOfYear:function(t,e,r){var a=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);var t=this._t2gYear(a.year());return i.weekOfYear(t,a.month(),a.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);return this.daysPerMonth[r.month()-1]+(r.month()===2&&this.leapYear(r.year())?1:0)},weekDay:function(t,e,r){return(this.dayOfWeek(t,e,r)||7)<6},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);var t=this._t2gYear(a.year());return i.toJD(t,a.month(),a.day())},fromJD:function(t){var e=i.fromJD(t);var r=this._g2tYear(e.year());return this.newDate(r,e.month(),e.day())},_t2gYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset?1:0)},_g2tYear:function(t){return t+this.yearsOffset+(t>=-this.yearsOffset&&t<=-1?1:0)}});n.calendars.thai=o},{"../main":536,"object-assign":421}],535:[function(t,e,r){var n=t("../main");var a=t("object-assign");function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new n.baseCalendar;a(i.prototype,{name:"UmmAlQura",hasYearZero:false,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thal\u0101th\u0101\u2019","Yawm al-Arba\u2018\u0101\u2019","Yawm al-Kham\u012bs","Yawm al-Jum\u2018a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:true}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,n.local.invalidYear);return this.daysInYear(e.year())===355},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);n.add(-n.dayOfWeek(),"d");return Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){var e=0;for(var r=1;r<=12;r++){e+=this.daysInMonth(t,r)}return e},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,n.local.invalidMonth);var a=r.toJD()-24e5+.5;var i=0;for(var s=0;sa){return o[i]-o[i-1]}i++}return 30},weekDay:function(t,e,r){return this.dayOfWeek(t,e,r)!==5},toJD:function(t,e,r){var a=this._validate(t,e,r,n.local.invalidDate);var i=12*(a.year()-1)+a.month()-15292;var s=a.day()+o[i-1]-1;return s+24e5-.5},fromJD:function(t){var e=t-24e5+.5;var r=0;for(var n=0;ne)break;r++}var a=r+15292;var i=Math.floor((a-1)/12);var s=i+1;var l=a-12*i;var u=e-o[r-1]+1;return this.newDate(s,l,u)},isValid:function(t,e,r){var a=n.baseCalendar.prototype.isValid.apply(this,arguments);if(a){t=t.year!=null?t.year:t;a=t>=1276&&t<=1500}return a},_validate:function(t,e,r,a){var i=n.baseCalendar.prototype._validate.apply(this,arguments);if(i.year<1276||i.year>1500){throw a.replace(/\{0\}/,this.local.name)}return i}});n.calendars.ummalqura=i;var o=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]},{"../main":536,"object-assign":421}],536:[function(t,e,r){var n=t("object-assign");function a(){this.regionalOptions=[];this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"};this.local=this.regionalOptions[""];this.calendars={};this._localCals={}}n(a.prototype,{instance:function(t,e){t=(t||"gregorian").toLowerCase();e=e||"";var r=this._localCals[t+"-"+e];if(!r&&this.calendars[t]){r=new this.calendars[t](e);this._localCals[t+"-"+e]=r}if(!r){throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,t)}return r},newDate:function(t,e,r,n,a){n=(t!=null&&t.year?t.calendar():typeof n==="string"?this.instance(n,a):n)||this.instance();return n.newDate(t,e,r)},substituteDigits:function(t){return function(e){return(e+"").replace(/[0-9]/g,function(e){return t[e]})}},substituteChineseDigits:function(t,e){return function(r){var n="";var a=0;while(r>0){var i=r%10;n=(i===0?"":t[i]+e[a])+n;a++;r=Math.floor(r/10)}if(n.indexOf(t[1]+e[1])===0){n=n.substr(1)}return n||t[0]}}});function i(t,e,r,n){this._calendar=t;this._year=e;this._month=r;this._day=n;if(this._calendar._validateLevel===0&&!this._calendar.isValid(this._year,this._month,this._day)){throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}}function o(t,e){t=""+t;return"000000".substring(0,e-t.length)+t}n(i.prototype,{newDate:function(t,e,r){return this._calendar.newDate(t==null?this:t,e,r)},year:function(t){return arguments.length===0?this._year:this.set(t,"y")},month:function(t){return arguments.length===0?this._month:this.set(t,"m")},day:function(t){return arguments.length===0?this._day:this.set(t,"d")},date:function(t,e,r){if(!this._calendar.isValid(t,e,r)){throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}this._year=t;this._month=e;this._day=r;return this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(t,e){return this._calendar.add(this,t,e)},set:function(t,e){return this._calendar.set(this,t,e)},compareTo:function(t){if(this._calendar.name!==t._calendar.name){throw(u.local.differentCalendars||u.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,t._calendar.local.name)}var e=this._year!==t._year?this._year-t._year:this._month!==t._month?this.monthOfYear()-t.monthOfYear():this._day-t._day;return e===0?0:e<0?-1:+1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(t){return this._calendar.fromJD(t)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(t){return this._calendar.fromJSDate(t)},toString:function(){return(this.year()<0?"-":"")+o(Math.abs(this.year()),4)+"-"+o(this.month(),2)+"-"+o(this.day(),2)}});function s(){this.shortYearCutoff="+10"}n(s.prototype,{_validateLevel:0,newDate:function(t,e,r){if(t==null){return this.today()}if(t.year){this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate);r=t.day();e=t.month();t=t.year()}return new i(this,t,e,r)},today:function(){return this.fromJSDate(new Date)},epoch:function(t){var e=this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return e.year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return(e.year()<0?"-":"")+o(Math.abs(e.year()),4)},monthsInYear:function(t){this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return 12},monthOfYear:function(t,e){var r=this._validate(t,e,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth);return(r.month()+this.monthsInYear(r)-this.firstMonth)%this.monthsInYear(r)+this.minMonth},fromMonthOfYear:function(t,e){var r=(e+this.firstMonth-2*this.minMonth)%this.monthsInYear(t)+this.minMonth;this._validate(t,r,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth);return r},daysInYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return this.leapYear(e)?366:365},dayOfYear:function(t,e,r){var n=this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate);return n.toJD()-this.newDate(n.year(),this.fromMonthOfYear(n.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(t,e,r){var n=this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(n))+2)%this.daysInWeek()},extraInfo:function(t,e,r){this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate);return{}},add:function(t,e,r){this._validate(t,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate);return this._correctAdd(t,this._add(t,e,r),e,r)},_add:function(t,e,r){this._validateLevel++;if(r==="d"||r==="w"){var n=t.toJD()+e*(r==="w"?this.daysInWeek():1);var a=t.calendar().fromJD(n);this._validateLevel--;return[a.year(),a.month(),a.day()]}try{var i=t.year()+(r==="y"?e:0);var o=t.monthOfYear()+(r==="m"?e:0);var a=t.day();var s=function(t){while(oe-1+t.minMonth){i++;o-=e;e=t.monthsInYear(i)}};if(r==="y"){if(t.month()!==this.fromMonthOfYear(i,o)){o=this.newDate(i,t.month(),this.minDay).monthOfYear()}o=Math.min(o,this.monthsInYear(i));a=Math.min(a,this.daysInMonth(i,this.fromMonthOfYear(i,o)))}else if(r==="m"){s(this);a=Math.min(a,this.daysInMonth(i,this.fromMonthOfYear(i,o)))}var l=[i,this.fromMonthOfYear(i,o),a];this._validateLevel--;return l}catch(t){this._validateLevel--;throw t}},_correctAdd:function(t,e,r,n){if(!this.hasYearZero&&(n==="y"||n==="m")){if(e[0]===0||t.year()>0!==e[0]>0){var a={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[n];var i=r<0?-1:+1;e=this._add(t,r*a[0]+i*a[1],a[2])}}return t.date(e[0],e[1],e[2])},set:function(t,e,r){this._validate(t,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate);var n=r==="y"?e:t.year();var a=r==="m"?e:t.month();var i=r==="d"?e:t.day();if(r==="y"||r==="m"){i=Math.min(i,this.daysInMonth(n,a))}return t.date(n,a,i)},isValid:function(t,e,r){this._validateLevel++;var n=this.hasYearZero||t!==0;if(n){var a=this.newDate(t,e,this.minDay);n=e>=this.minMonth&&e-this.minMonth=this.minDay&&r-this.minDay13.5?13:1);var u=a-(l>2.5?4716:4715);if(u<=0){u--}return this.newDate(u,l,s)},toJSDate:function(t,e,r){var n=this._validate(t,e,r,u.local.invalidDate||u.regionalOptions[""].invalidDate);var a=new Date(n.year(),n.month()-1,n.day());a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);a.setHours(a.getHours()>12?a.getHours()+2:0);return a},fromJSDate:function(t){return this.newDate(t.getFullYear(),t.getMonth()+1,t.getDate())}});var u=e.exports=new a;u.cdate=i;u.baseCalendar=s;u.calendars.gregorian=l},{"object-assign":421}],537:[function(t,e,r){var n=t("object-assign");var a=t("./main");n(a.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"});a.local=a.regionalOptions[""];n(a.cdate.prototype,{formatDate:function(t,e){if(typeof t!=="string"){e=t;t=""}return this._calendar.formatDate(t||"",this,e)}});n(a.baseCalendar.prototype,{UNIX_EPOCH:a.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:24*60*60,TICKS_EPOCH:a.instance().jdEpoch,TICKS_PER_DAY:24*60*60*1e7,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(t,e,r){if(typeof t!=="string"){r=e;e=t;t=""}if(!e){return""}if(e.calendar()!==this){throw a.local.invalidFormat||a.regionalOptions[""].invalidFormat}t=t||this.local.dateFormat;r=r||{};var n=r.dayNamesShort||this.local.dayNamesShort;var i=r.dayNames||this.local.dayNames;var o=r.monthNumbers||this.local.monthNumbers;var s=r.monthNamesShort||this.local.monthNamesShort;var l=r.monthNames||this.local.monthNames;var u=r.calculateWeek||this.local.calculateWeek;var c=function(e,r){var n=1;while(b+n1};var f=function(t,e,r,n){var a=""+e;if(c(t,n)){while(a.length1};var x=function(t,r){var n=y(t,r);var i=[2,3,n?4:2,n?4:2,10,11,20]["oyYJ@!".indexOf(t)+1];var o=new RegExp("^-?\\d{1,"+i+"}");var s=e.substring(A).match(o);if(!s){throw(a.local.missingNumberAt||a.regionalOptions[""].missingNumberAt).replace(/\{0\}/,A)}A+=s[0].length;return parseInt(s[0],10)};var b=this;var _=function(){if(typeof l==="function"){y("m");var t=l.call(b,e.substring(A));A+=t.length;return t}return x("m")};var w=function(t,r,n,i){var o=y(t,i)?n:r;for(var s=0;s-1){p=1;d=v;for(var E=this.daysInMonth(h,p);d>E;E=this.daysInMonth(h,p)){p++;d-=E}}return f>-1?this.fromJD(f):this.newDate(h,p,d)},determineDate:function(t,e,r,n,a){if(r&&typeof r!=="object"){a=n;n=r;r=null}if(typeof n!=="string"){a=n;n=""}var i=this;var o=function(t){try{return i.parseDate(n,t,a)}catch(t){}t=t.toLowerCase();var e=(t.match(/^c/)&&r?r.newDate():null)||i.today();var o=/([+-]?[0-9]+)\s*(d|w|m|y)?/g;var s=o.exec(t);while(s){e.add(parseInt(s[1],10),s[2]||"d");s=o.exec(t)}return e};e=e?e.newDate():null;t=t==null?e:typeof t==="string"?o(t):typeof t==="number"?isNaN(t)||t===Infinity||t===-Infinity?e:i.today().add(t,"d"):i.newDate(t);return t}})},{"./main":536,"object-assign":421}],538:[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:false,rvalue:true,count:1},{name:"_inline_1_arg1_",lvalue:false,rvalue:true,count:1},{name:"_inline_1_arg2_",lvalue:false,rvalue:true,count:1},{name:"_inline_1_arg3_",lvalue:false,rvalue:true,count:2},{name:"_inline_1_arg4_",lvalue:false,rvalue:true,count:1}],thisVars:[],localVars:["_inline_1_da","_inline_1_db"]},funcName:"zeroCrossings"})},{"cwise-compiler":133}],539:[function(t,e,r){"use strict";e.exports=a;var n=t("./lib/zc-core");function a(t,e){var r=[];e=+e||0;n(t.hi(t.shape[0]-1),r,e);return r}},{"./lib/zc-core":538}],540:[function(t,e,r){"use strict";e.exports=[{path:"",backoff:0},{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,noRotate:true},{path:"M2,2V-2H-2V2Z",backoff:0,noRotate:true}]},{}],541:[function(t,e,r){"use strict";var n=t("./arrow_paths");var a=t("../../plots/font_attributes");var i=t("../../plots/cartesian/constants");var o=t("../../plot_api/plot_template").templatedArray;e.exports=o("annotation",{visible:{valType:"boolean",dflt:true,editType:"calcIfAutorange+arraydraw"},text:{valType:"string",editType:"calcIfAutorange+arraydraw"},textangle:{valType:"angle",dflt:0,editType:"calcIfAutorange+arraydraw"},font:a({editType:"calcIfAutorange+arraydraw",colorEditType:"arraydraw"}),width:{valType:"number",min:1,dflt:null,editType:"calcIfAutorange+arraydraw"},height:{valType:"number",min:1,dflt:null,editType:"calcIfAutorange+arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},align:{valType:"enumerated",values:["left","center","right"],dflt:"center",editType:"arraydraw"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",editType:"arraydraw"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},borderpad:{valType:"number",min:0,dflt:1,editType:"calcIfAutorange+arraydraw"},borderwidth:{valType:"number",min:0,dflt:1,editType:"calcIfAutorange+arraydraw"},showarrow:{valType:"boolean",dflt:true,editType:"calcIfAutorange+arraydraw"},arrowcolor:{valType:"color",editType:"arraydraw"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},startarrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},arrowside:{valType:"flaglist",flags:["end","start"],extras:["none"],dflt:"end",editType:"arraydraw"},arrowsize:{valType:"number",min:.3,dflt:1,editType:"calcIfAutorange+arraydraw"},startarrowsize:{valType:"number",min:.3,dflt:1,editType:"calcIfAutorange+arraydraw"},arrowwidth:{valType:"number",min:.1,editType:"calcIfAutorange+arraydraw"},standoff:{valType:"number",min:0,dflt:0,editType:"calcIfAutorange+arraydraw"},startstandoff:{valType:"number",min:0,dflt:0,editType:"calcIfAutorange+arraydraw"},ax:{valType:"any",editType:"calcIfAutorange+arraydraw"},ay:{valType:"any",editType:"calcIfAutorange+arraydraw"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",i.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",i.idRegex.x.toString()],editType:"calc"},x:{valType:"any",editType:"calcIfAutorange+arraydraw"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",editType:"calcIfAutorange+arraydraw"},xshift:{valType:"number",dflt:0,editType:"calcIfAutorange+arraydraw"},yref:{valType:"enumerated",values:["paper",i.idRegex.y.toString()],editType:"calc"},y:{valType:"any",editType:"calcIfAutorange+arraydraw"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"calcIfAutorange+arraydraw"},yshift:{valType:"number",dflt:0,editType:"calcIfAutorange+arraydraw"},clicktoshow:{valType:"enumerated",values:[false,"onoff","onout"],dflt:false,editType:"arraydraw"},xclick:{valType:"any",editType:"arraydraw"},yclick:{valType:"any",editType:"arraydraw"},hovertext:{valType:"string",editType:"arraydraw"},hoverlabel:{bgcolor:{valType:"color",editType:"arraydraw"},bordercolor:{valType:"color",editType:"arraydraw"},font:a({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}})},{"../../plot_api/plot_template":722,"../../plots/cartesian/constants":737,"../../plots/font_attributes":758,"./arrow_paths":540}],542:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("../../plots/cartesian/axes");var i=t("./draw").draw;e.exports=function t(e){var r=e._fullLayout,s=n.filterVisible(r.annotations);if(!s.length||!e._fullData.length)return;var l={};s.forEach(function(t){l[t.xref]=1;l[t.yref]=1});for(var u in l){var c=a.getFromId(e,u);if(c&&c.autorange){return n.syncOrAsync([i,o],e)}}};function o(t){var e=t._fullLayout;n.filterVisible(e.annotations).forEach(function(e){var r=a.getFromId(t,e.xref),n=a.getFromId(t,e.yref),i=3*e.arrowsize*e.arrowwidth||0,o=3*e.startarrowsize*e.arrowwidth||0;var s,l,u,c;if(r&&r.autorange){s=i+e.xshift;l=i-e.xshift;u=o+e.xshift;c=o-e.xshift;if(e.axref===e.xref){a.expand(r,[r.r2c(e.x)],{ppadplus:s,ppadminus:l});a.expand(r,[r.r2c(e.ax)],{ppadplus:Math.max(e._xpadplus,u),ppadminus:Math.max(e._xpadminus,c)})}else{u=e.ax?u+e.ax:u;c=e.ax?c-e.ax:c;a.expand(r,[r.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,s,u),ppadminus:Math.max(e._xpadminus,l,c)})}}if(n&&n.autorange){s=i-e.yshift;l=i+e.yshift;u=o-e.yshift;c=o+e.yshift;if(e.ayref===e.yref){a.expand(n,[n.r2c(e.y)],{ppadplus:s,ppadminus:l});a.expand(n,[n.r2c(e.ay)],{ppadplus:Math.max(e._ypadplus,u),ppadminus:Math.max(e._ypadminus,c)})}else{u=e.ay?u+e.ay:u;c=e.ay?c-e.ay:c;a.expand(n,[n.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,s,u),ppadminus:Math.max(e._ypadminus,l,c)})}}})}},{"../../lib":684,"../../plots/cartesian/axes":732,"./draw":547}],543:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("../../registry");var i=t("../../plot_api/plot_template").arrayEditor;e.exports={hasClickToShow:o,onClick:s};function o(t,e){var r=l(t,e);return r.on.length>0||r.explicitOff.length>0}function s(t,e){var r=l(t,e);var o=r.on;var s=r.off.concat(r.explicitOff);var u={};var c=t._fullLayout.annotations;var f,h;if(!(o.length||s.length))return;for(f=0;f2/3)e="right";else e="center"}return{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var H=false;var G=["x","y"];for(var W=0;W1)){if(Z===X){ut=$.r2fraction(e["a"+Y]);if(ut<0||ut>1){H=true}}else{H=true}if(H)continue}at=$._offset+$.r2p(e[Y]);st=.5}else{if(Y==="x"){ot=e[Y];at=y.l+y.w*ot}else{ot=1-e[Y];at=y.t+y.h*ot}st=e.showarrow?.5:ot}if(e.showarrow){nt.head=at;var ct=e["a"+Y];lt=K*q(.5,e.xanchor)-Q*q(.5,e.yanchor);if(Z===X){nt.tail=$._offset+$.r2p(ct);it=lt}else{nt.tail=at+ct;it=lt+ct}nt.text=nt.tail+lt;var ft=m[Y==="x"?"width":"height"];if(X==="paper"){nt.head=o.constrain(nt.head,1,ft-1)}if(Z==="pixel"){var ht=-Math.max(nt.tail-3,nt.text),pt=Math.min(nt.tail+3,nt.text)-ft;if(ht>0){nt.tail+=ht;nt.text+=ht}else if(pt>0){nt.tail-=pt;nt.text-=pt}}nt.tail+=rt;nt.head+=rt}else{lt=tt*q(st,et);it=lt;nt.text=at+lt}nt.text+=rt;lt+=rt;it+=rt;e["_"+Y+"padplus"]=tt/2+it;e["_"+Y+"padminus"]=tt/2-it;e["_"+Y+"size"]=tt;e["_"+Y+"shift"]=lt}if(H){P.remove();return}var dt=0;var vt=0;if(e.align!=="left"){dt=(z-_)*(e.align==="center"?.5:1)}if(e.valign!=="top"){vt=(D-w)*(e.valign==="middle"?.5:1)}if(d){c.select("svg").attr({x:R+dt-1,y:R+vt}).call(u.setClipUrl,F?T:null)}else{var gt=R+vt-b.top;var mt=R+dt-b.left;V.call(f.positionText,mt,gt).call(u.setClipUrl,F?T:null)}N.select("rect").call(u.setRect,R,R,z,D);B.call(u.setRect,O/2,O/2,j-O,U-O);P.call(u.setTranslate,Math.round(S.x.text-j/2),Math.round(S.y.text-U/2));L.attr({transform:"rotate("+E+","+S.x.text+","+S.y.text+")"});var yt=function(r,n){C.selectAll(".annotation-arrow-g").remove();var c=S.x.head,f=S.y.head,h=S.x.tail+r,d=S.y.tail+n,m=S.x.text+r,b=S.y.text+n,_=o.rotationXYMatrix(E,m,b),w=o.apply2DTransform(_),T=o.apply2DTransform2(_),I=+B.attr("width"),z=+B.attr("height"),O=m-.5*I,D=O+I,R=b-.5*z,F=R+z,N=[[O,R,O,F],[O,F,D,F],[D,F,D,R],[D,R,O,R]].map(T);if(N.reduce(function(t,e){return t^!!o.segmentsIntersect(c,f,c+1e6,f+1e6,e[0],e[1],e[2],e[3])},false)){return}N.forEach(function(t){var e=o.segmentsIntersect(h,d,c,f,t[0],t[1],t[2],t[3]);if(e){h=e.x;d=e.y}});var j=e.arrowwidth,V=e.arrowcolor,U=e.arrowside;var q=C.append("g").style({opacity:l.opacity(V)}).classed("annotation-arrow-g",true);var H=q.append("path").attr("d","M"+h+","+d+"L"+c+","+f).style("stroke-width",j+"px").call(l.stroke,l.rgb(V));v(H,U,e);if(x.annotationPosition&&H.node().parentNode&&!i){var G=c;var W=f;if(e.standoff){var Y=Math.sqrt(Math.pow(c-h,2)+Math.pow(f-d,2));G+=e.standoff*(h-c)/Y;W+=e.standoff*(d-f)/Y}var X=q.append("path").classed("annotation-arrow",true).classed("anndrag",true).classed("cursor-move",true).attr({d:"M3,3H-3V-3H3ZM0,0L"+(h-G)+","+(d-W),transform:"translate("+G+","+W+")"}).style("stroke-width",j+6+"px").call(l.stroke,"rgba(0,0,0,0)").call(l.fill,"rgba(0,0,0,0)");var Z,$;p.init({element:X.node(),gd:t,prepFn:function(){var t=u.getTranslate(P);Z=t.x;$=t.y;if(s&&s.autorange){k(s._name+".autorange",true)}if(g&&g.autorange){k(g._name+".autorange",true)}},moveFn:function(t,r){var n=w(Z,$),a=n[0]+t,i=n[1]+r;P.call(u.setTranslate,a,i);M("x",s?s.p2r(s.r2p(e.x)+t):e.x+t/y.w);M("y",g?g.p2r(g.r2p(e.y)+r):e.y-r/y.h);if(e.axref===e.xref){M("ax",s.p2r(s.r2p(e.ax)+t))}if(e.ayref===e.yref){M("ay",g.p2r(g.r2p(e.ay)+r))}q.attr("transform","translate("+t+","+r+")");L.attr({transform:"rotate("+E+","+a+","+i+")"})},doneFn:function(){a.call("relayout",t,A());var e=document.querySelector(".js-notes-box-panel");if(e)e.redraw(e.selectedObj)}})}};if(e.showarrow)yt(0,0);if(I){var xt;p.init({element:P.node(),gd:t,prepFn:function(){xt=L.attr("transform")},moveFn:function(t,r){var n="pointer";if(e.showarrow){if(e.axref===e.xref){M("ax",s.p2r(s.r2p(e.ax)+t))}else{M("ax",e.ax+t)}if(e.ayref===e.yref){M("ay",g.p2r(g.r2p(e.ay)+r))}else{M("ay",e.ay+r)}yt(t,r)}else if(!i){var a,o;if(s){a=s.p2r(s.r2p(e.x)+t)}else{var l=e._xsize/y.w,u=e.x+(e._xshift-e.xshift)/y.w-l/2;a=p.align(u+t/y.w,l,0,1,e.xanchor)}if(g){o=g.p2r(g.r2p(e.y)+r)}else{var c=e._ysize/y.h,f=e.y-(e._yshift+e.yshift)/y.h-c/2;o=p.align(f-r/y.h,c,0,1,e.yanchor)}M("x",a);M("y",o);if(!s||!g){n=p.getCursor(s?.5:a,g?.5:o,e.xanchor,e.yanchor)}}else return;L.attr({transform:"translate("+t+","+r+")"+xt});h(P,n)},doneFn:function(){h(P);a.call("relayout",t,A());var e=document.querySelector(".js-notes-box-panel");if(e)e.redraw(e.selectedObj)}})}}if(x.annotationText){V.call(f.makeEditable,{delegate:P,gd:t}).call(U).on("edit",function(r){e.text=r;this.call(U);M("text",r);if(s&&s.autorange){k(s._name+".autorange",true)}if(g&&g.autorange){k(g._name+".autorange",true)}a.call("relayout",t,A())})}else V.call(U)}},{"../../lib":684,"../../lib/setcursor":704,"../../lib/svg_text_utils":708,"../../plot_api/plot_template":722,"../../plots/cartesian/axes":732,"../../plots/plots":795,"../../registry":817,"../color":558,"../dragelement":580,"../drawing":583,"../fx":600,"./draw_arrow_head":548,d3:147}],548:[function(t,e,r){"use strict";var n=t("d3");var a=t("../color");var i=t("./arrow_paths");e.exports=function t(e,r,o){var s=e.node();var l=i[o.arrowhead||0];var u=i[o.startarrowhead||0];var c=(o.arrowwidth||1)*(o.arrowsize||1);var f=(o.arrowwidth||1)*(o.startarrowsize||1);var h=r.indexOf("start")>=0;var p=r.indexOf("end")>=0;var d=l.backoff*c+o.standoff;var v=u.backoff*f+o.startstandoff;var g,m,y,x;if(s.nodeName==="line"){g={x:+e.attr("x1"),y:+e.attr("y1")};m={x:+e.attr("x2"),y:+e.attr("y2")};var b=g.x-m.x;var _=g.y-m.y;y=Math.atan2(_,b);x=y+Math.PI;if(d&&v){if(d+v>Math.sqrt(b*b+_*_)){P();return}}if(d){if(d*d>b*b+_*_){P();return}var w=d*Math.cos(y),k=d*Math.sin(y);m.x+=w;m.y+=k;e.attr({x2:m.x,y2:m.y})}if(v){if(v*v>b*b+_*_){P();return}var M=v*Math.cos(y),A=v*Math.sin(y);g.x-=M;g.y-=A;e.attr({x1:g.x,y1:g.y})}}else if(s.nodeName==="path"){var T=s.getTotalLength(),S="";if(T1){c=true;break}}if(c){e.fullLayout._infolayer.select(".annotation-"+e.id+'[data-index="'+l+'"]').remove()}else{u._pdata=a(e.glplot.cameraParams,[r.xaxis.r2l(u.x)*o[0],r.yaxis.r2l(u.y)*o[1],r.zaxis.r2l(u.z)*o[2]]);n(e.graphDiv,u,l,e.id,u._xa,u._ya)}}}},{"../../plots/gl3d/project":783,"../annotations/draw":547}],554:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("../../lib");e.exports={moduleType:"component",name:"annotations3d",schema:{subplots:{scene:{annotations:t("./attributes")}}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),includeBasePlot:i,convert:t("./convert"),draw:t("./draw")};function i(t,e){var r=n.subplotsRegistry.gl3d;if(!r)return;var i=r.attrRegex;var o=Object.keys(t);for(var s=0;s=0))return t;if(o===3){if(n[o]>1)n[o]=1}else if(n[o]>=1)return t}var s=Math.round(n[0]*255)+", "+Math.round(n[1]*255)+", "+Math.round(n[2]*255);if(i)return"rgba("+s+", "+n[3]+")";return"rgb("+s+")"}},{"./attributes":557,"fast-isnumeric":214,tinycolor2:499}],559:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/layout_attributes");var a=t("../../plots/font_attributes");var i=t("../../lib/extend").extendFlat;var o=t("../../plot_api/edit_types").overrideAll;e.exports=o({thicknessmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"pixels"},thickness:{valType:"number",min:0,dflt:30},lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",dflt:1.02,min:-2,max:3},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},xpad:{valType:"number",min:0,dflt:10},y:{valType:"number",dflt:.5,min:-2,max:3},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},ypad:{valType:"number",min:0,dflt:10},outlinecolor:n.linecolor,outlinewidth:n.linewidth,bordercolor:n.linecolor,borderwidth:{valType:"number",min:0,dflt:0},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:i({},n.ticks,{dflt:""}),ticklen:n.ticklen,tickwidth:n.tickwidth,tickcolor:n.tickcolor,showticklabels:n.showticklabels,tickfont:a({}),tickangle:n.tickangle,tickformat:n.tickformat,tickformatstops:n.tickformatstops,tickprefix:n.tickprefix,showtickprefix:n.showtickprefix,ticksuffix:n.ticksuffix,showticksuffix:n.showticksuffix,separatethousands:n.separatethousands,exponentformat:n.exponentformat,showexponent:n.showexponent,title:{valType:"string"},titlefont:a({}),titleside:{valType:"enumerated",values:["right","top","bottom"],dflt:"top"}},"colorbars","from-root")},{"../../lib/extend":673,"../../plot_api/edit_types":715,"../../plots/cartesian/layout_attributes":744,"../../plots/font_attributes":758}],560:[function(t,e,r){"use strict";var n=t("../colorscale");var a=t("./draw");e.exports=function t(e,r,i){if(typeof i==="function")return i(e,r);var o=r[0].trace;var s="cb"+o.uid;var l=i.container;var u=l?o[l]:o;e._fullLayout._infolayer.selectAll("."+s).remove();if(!u||!u.showscale)return;var c=u[i.min];var f=u[i.max];var h=r[0].t.cb=a(e,s);var p=n.makeColorScaleFunc(n.extractScale(u.colorscale,c,f),{noNumericCheck:true});h.fillcolor(p).filllevels({start:c,end:f,size:(f-c)/254}).options(u.colorbar)()}},{"../colorscale":573,"./draw":563}],561:[function(t,e,r){"use strict";e.exports={cn:{colorbar:"colorbar",cbbg:"cbbg",cbfill:"cbfill",cbfills:"cbfills",cbline:"cbline",cblines:"cblines",cbaxis:"cbaxis",cbtitleunshift:"cbtitleunshift",cbtitle:"cbtitle",cboutline:"cboutline",crisp:"crisp",jsPlaceholder:"js-placeholder"}}},{}],562:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("../../plot_api/plot_template");var i=t("../../plots/cartesian/tick_value_defaults");var o=t("../../plots/cartesian/tick_mark_defaults");var s=t("../../plots/cartesian/tick_label_defaults");var l=t("./attributes");e.exports=function t(e,r,u){var c=a.newContainer(r,"colorbar"),f=e.colorbar||{};function h(t,e){return n.coerce(f,c,l,t,e)}var p=h("thicknessmode");h("thickness",p==="fraction"?30/(u.width-u.margin.l-u.margin.r):30);var d=h("lenmode");h("len",d==="fraction"?1:u.height-u.margin.t-u.margin.b);h("x");h("xanchor");h("xpad");h("y");h("yanchor");h("ypad");n.noneOrAll(f,c,["x","y"]);h("outlinecolor");h("outlinewidth");h("bordercolor");h("borderwidth");h("bgcolor");i(f,c,h,"linear");var v={outerTicks:false,font:u.font};s(f,c,h,"linear",v);o(f,c,h,"linear",v);h("title",u._dfltTitle.colorbar);n.coerceFont(h,"titlefont",u.font);h("titleside")}},{"../../lib":684,"../../plot_api/plot_template":722,"../../plots/cartesian/tick_label_defaults":751,"../../plots/cartesian/tick_mark_defaults":752,"../../plots/cartesian/tick_value_defaults":753,"./attributes":559}],563:[function(t,e,r){"use strict";var n=t("d3");var a=t("tinycolor2");var i=t("../../plots/plots");var o=t("../../registry");var s=t("../../plots/cartesian/axes");var l=t("../dragelement");var u=t("../../lib");var c=t("../../lib/extend").extendFlat;var f=t("../../lib/setcursor");var h=t("../drawing");var p=t("../color");var d=t("../titles");var v=t("../../lib/svg_text_utils");var g=t("../../constants/alignment");var m=g.LINE_SPACING;var y=g.FROM_TL;var x=g.FROM_BR;var b=t("../../plots/cartesian/axis_defaults");var _=t("../../plots/cartesian/position_defaults");var w=t("../../plots/cartesian/layout_attributes");var k=t("./attributes");var M=t("./constants").cn;e.exports=function t(e,r){var g={};Object.keys(k).forEach(function(t){g[t]=null});g.fillcolor=null;g.line={color:null,width:null,dash:null};g.levels={start:null,end:null,size:null};g.filllevels=null;function A(){var t=e._fullLayout,k=t._size;if(typeof g.fillcolor!=="function"&&typeof g.line.color!=="function"){t._infolayer.selectAll("g."+r).remove();return}var S=n.extent((typeof g.fillcolor==="function"?g.fillcolor:g.line.color).domain());var E=[];var C=[];var L=typeof g.line.color==="function"?g.line.color:function(){return g.line.color};var I=typeof g.fillcolor==="function"?g.fillcolor:function(){return g.fillcolor};var z;var P;var O=g.levels.end+g.levels.size/100,D=g.levels.size,R=1.001*S[0]-.001*S[1],B=1.001*S[1]-.001*S[0];for(P=0;P<1e5;P++){z=g.levels.start+P*D;if(D>0?z>=O:z<=O)break;if(z>R&&z0?z>=O:z<=O)break;if(z>S[0]&&z1){var ot=Math.pow(10,Math.floor(Math.log(it)/Math.LN10));nt*=ot*u.roundUp(it/ot,[2,5,10]);if((Math.abs(g.levels.start)/g.levels.size+1e-6)%1<2e-6){tt.tick0=0}}tt.dtick=nt}tt.domain=[Z+W,Z+q-W];tt.setScale();var st=u.ensureSingle(t._infolayer,"g",r,function(t){t.classed(M.colorbar,true).each(function(){var t=n.select(this);t.append("rect").classed(M.cbbg,true);t.append("g").classed(M.cbfills,true);t.append("g").classed(M.cblines,true);t.append("g").classed(M.cbaxis,true).classed(M.crisp,true);t.append("g").classed(M.cbtitleunshift,true).append("g").classed(M.cbtitle,true);t.append("rect").classed(M.cboutline,true);t.select(".cbtitle").datum(0)})});st.attr("transform","translate("+Math.round(k.l)+","+Math.round(k.t)+")");var lt=st.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(k.l)+",-"+Math.round(k.t)+")");tt._axislayer=st.select(".cbaxis");var ut=0;if(["top","bottom"].indexOf(g.titleside)!==-1){var ct=k.l+(g.x+H)*k.w,ft=tt.titlefont.size,ht;if(g.titleside==="top"){ht=(1-(Z+q-W))*k.h+k.t+3+ft*.75}else{ht=(1-(Z+W))*k.h+k.t-3-ft*.25}dt(tt._id+"title",{attributes:{x:ct,y:ht,"text-anchor":"start"}})}function pt(){if(["top","bottom"].indexOf(g.titleside)!==-1){var r=st.select(".cbtitle"),i=r.select("text"),o=[-g.outlinewidth/2,g.outlinewidth/2],l=r.select(".h"+tt._id+"title-math-group").node(),c=15.6;if(i.node()){c=parseInt(i.node().style.fontSize,10)*m}if(l){ut=h.bBox(l).height;if(ut>c){o[1]-=(ut-c)/2}}else if(i.node()&&!i.classed(M.jsPlaceholder)){ut=h.bBox(i.node()).height}if(ut){ut+=5;if(g.titleside==="top"){tt.domain[1]-=ut/k.h;o[1]*=-1}else{tt.domain[0]+=ut/k.h;var f=v.lineCount(i);o[1]+=(1-f)*c}r.attr("transform","translate("+o+")");tt.setScale()}}st.selectAll(".cbfills,.cblines").attr("transform","translate(0,"+Math.round(k.h*(1-tt.domain[1]))+")");tt._axislayer.attr("transform","translate(0,"+Math.round(-k.t)+")");var p=st.select(".cbfills").selectAll("rect.cbfill").data(C);p.enter().append("rect").classed(M.cbfill,true).style("stroke","none");p.exit().remove();p.each(function(t,e){var r=[e===0?S[0]:(C[e]+C[e-1])/2,e===C.length-1?S[1]:(C[e]+C[e+1])/2].map(tt.c2p).map(Math.round);if(e!==C.length-1){r[1]+=r[1]>r[0]?1:-1}var i=I(t).replace("e-",""),o=a(i).toHexString();n.select(this).attr({x:Y,width:Math.max(j,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var d=st.select(".cblines").selectAll("path.cbline").data(g.line.color&&g.line.width?E:[]);d.enter().append("path").classed(M.cbline,true);d.exit().remove();d.each(function(t){n.select(this).attr("d","M"+Y+","+(Math.round(tt.c2p(t))+g.line.width/2%1)+"h"+j).call(h.lineGroupStyle,g.line.width,L(t),g.line.dash)});tt._axislayer.selectAll("g."+tt._id+"tick,path").remove();tt._pos=Y+j+(g.outlinewidth||0)/2-(g.ticks==="outside"?1:0);tt.side="right";return u.syncOrAsync([function(){return s.doTicksSingle(e,tt,true)},function(){if(["top","bottom"].indexOf(g.titleside)===-1){var r=tt.titlefont.size,a=tt._offset+tt._length/2,i=k.l+(tt.position||0)*k.w+(tt.side==="right"?10+r*(tt.showticklabels?1:.5):-10-r*(tt.showticklabels?.5:0));dt("h"+tt._id+"title",{avoid:{selection:n.select(e).selectAll("g."+tt._id+"tick"),side:g.titleside,offsetLeft:k.l,offsetTop:0,maxShift:t.width},attributes:{x:i,y:a,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])}function dt(r,n){var a=T();var i="colorbar.title";var o=a._module.colorbar.container;if(o)i=o+"."+i;var s={propContainer:tt,propName:i,traceIndex:a.index,placeholder:t._dfltTitle.colorbar,containerGroup:st.select(".cbtitle")};var l=r.charAt(0)==="h"?r.substr(1):"h"+r;st.selectAll("."+l+",."+l+"-math-group").remove();d.draw(e,r,c(s,n||{}))}function vt(){var t=j+g.outlinewidth/2+h.bBox(tt._axislayer.node()).width;K=lt.select("text");if(K.node()&&!K.classed(M.jsPlaceholder)){var n=lt.select(".h"+tt._id+"title-math-group").node(),a;if(n&&["top","bottom"].indexOf(g.titleside)!==-1){a=h.bBox(n).width}else{a=h.bBox(lt.node()).right-Y-k.l}t=Math.max(t,a)}var o=2*g.xpad+t+g.borderwidth+g.outlinewidth/2,s=$-J;st.select(".cbbg").attr({x:Y-g.xpad-(g.borderwidth+g.outlinewidth)/2,y:J-G,width:Math.max(o,2),height:Math.max(s+2*G,2)}).call(p.fill,g.bgcolor).call(p.stroke,g.bordercolor).style({"stroke-width":g.borderwidth});st.selectAll(".cboutline").attr({x:Y,y:J+g.ypad+(g.titleside==="top"?ut:0),width:Math.max(j,2),height:Math.max(s-2*g.ypad-ut,2)}).call(p.stroke,g.outlinecolor).style({fill:"None","stroke-width":g.outlinewidth});var l=({center:.5,right:1}[g.xanchor]||0)*o;st.attr("transform","translate("+(k.l-l)+","+k.t+")");var u={};var c=y[g.yanchor];var f=x[g.yanchor];if(g.lenmode==="pixels"){u.y=g.y;u.t=s*c;u.b=s*f}else{u.t=u.b=0;u.yt=g.y+g.len*c;u.yb=g.y-g.len*f}var d=y[g.xanchor];var v=x[g.xanchor];if(g.thicknessmode==="pixels"){u.x=g.x;u.l=o*d;u.r=o*v}else{var m=o-j;u.l=m*d;u.r=m*v;u.xl=g.x-g.thickness*d;u.xr=g.x+g.thickness*v}i.autoMargin(e,r,u)}var gt=u.syncOrAsync([i.previousPromises,pt,i.previousPromises,vt],e);if(gt&>.then)(e._promises||[]).push(gt);if(e._context.edits.colorbarPosition){var mt,yt,xt;l.init({element:st.node(),gd:e,prepFn:function(){mt=st.attr("transform");f(st)},moveFn:function(t,e){st.attr("transform",mt+" "+"translate("+t+","+e+")");yt=l.align(X+t/k.w,V,0,1,g.xanchor);xt=l.align(Z-e/k.h,q,0,1,g.yanchor);var r=l.getCursor(yt,xt,g.xanchor,g.yanchor);f(st,r)},doneFn:function(){f(st);if(yt!==undefined&&xt!==undefined){o.call("restyle",e,{"colorbar.x":yt,"colorbar.y":xt},T().index)}}})}return gt}function T(){var t=r.substr(2),n,a;for(n=0;n=0)x=a.Reds;else x=a.Blues;h("colorscale",x,l.reversescale?i(x):x);if(!u.autocolorscale){h("autocolorscale",false)}}}},{"../../lib":684,"./flip_scale":570,"./scales":577}],567:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":577}],568:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("../../lib");var i=t("../colorbar/has_colorbar");var o=t("../colorbar/defaults");var s=t("./is_valid_scale");var l=t("./flip_scale");e.exports=function t(e,r,u,c,f){var h=f.prefix,p=f.cLetter,d=h.slice(0,h.length-1),v=h?a.nestedProperty(e,d).get()||{}:e,g=h?a.nestedProperty(r,d).get()||{}:r,m=v[p+"min"],y=v[p+"max"],x=v.colorscale;var b=n(m)&&n(y)&&m=0;i--,o++){a=e[i];n[o]=[1-a[0],a[1]]}return n}},{}],571:[function(t,e,r){"use strict";var n=t("./scales");var a=t("./default_scale");var i=t("./is_valid_scale_array");e.exports=function t(e,r){if(!r)r=a;if(!e)return r;function o(){try{e=n[e]||JSON.parse(e)}catch(t){e=r}}if(typeof e==="string"){o();if(typeof e==="string")o()}if(!i(e))return r;return e}},{"./default_scale":567,"./is_valid_scale_array":575,"./scales":577}],572:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("../../lib");var i=t("./is_valid_scale");e.exports=function t(e,r){var o=r?a.nestedProperty(e,r).get()||{}:e;var s=o.color;var l=false;if(a.isArrayOrTypedArray(s)){for(var u=0;u4/3-l)return s;return l}},{}],579:[function(t,e,r){"use strict";var n=t("../../lib");var a=[["sw-resize","s-resize","se-resize"],["w-resize","move","e-resize"],["nw-resize","n-resize","ne-resize"]];e.exports=function t(e,r,i,o){if(i==="left")e=0;else if(i==="center")e=1;else if(i==="right")e=2;else e=n.constrain(Math.floor(e*3),0,2);if(o==="bottom")r=0;else if(o==="middle")r=1;else if(o==="top")r=2;else r=n.constrain(Math.floor(r*3),0,2);return a[r][e]}},{"../../lib":684}],580:[function(t,e,r){"use strict";var n=t("mouse-event-offset");var a=t("has-hover");var i=t("has-passive-events");var o=t("../../registry");var s=t("../../lib");var l=t("../../plots/cartesian/constants");var u=t("../../constants/interactions");var c=e.exports={};c.align=t("./align");c.getCursor=t("./cursor");var f=t("./unhover");c.unhover=f.wrapped;c.unhoverRaw=f.raw;c.init=function t(e){var r=e.gd;var n=1;var o=u.DBLCLICKDELAY;var f=e.element;var v,g,m,y,x,b,_,w;if(!r._mouseDownTime)r._mouseDownTime=0;f.style.pointerEvents="all";f.onmousedown=A;if(!i){f.ontouchstart=A}else{if(f._ontouchstart){f.removeEventListener("touchstart",f._ontouchstart)}f._ontouchstart=A;f.addEventListener("touchstart",A,{passive:false})}function k(t,e,r){if(Math.abs(t)o){n=Math.max(n-1,1)}if(r._dragged){if(e.doneFn)e.doneFn()}else{if(e.clickFn)e.clickFn(n,b);if(!w){var i;try{i=new MouseEvent("click",t)}catch(e){var l=d(t);i=document.createEvent("MouseEvents");i.initMouseEvent("click",t.bubbles,t.cancelable,t.view,t.detail,t.screenX,t.screenY,l[0],l[1],t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,t.button,t.relatedTarget)}_.dispatchEvent(i)}}p(r);r._dragged=false;return}};function h(){var t=document.createElement("div");t.className="dragcover";var e=t.style;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);return t}c.coverSlip=h;function p(t){t._dragging=false;if(t._replotPending)o.call("plot",t)}function d(t){return n(t.changedTouches?t.changedTouches[0]:t,document.body)}},{"../../constants/interactions":660,"../../lib":684,"../../plots/cartesian/constants":737,"../../registry":817,"./align":578,"./cursor":579,"./unhover":581,"has-hover":378,"has-passive-events":379,"mouse-event-offset":403}],581:[function(t,e,r){"use strict";var n=t("../../lib/events");var a=t("../../lib/throttle");var i=t("../../lib/get_graph_div");var o=t("../fx/constants");var s=e.exports={};s.wrapped=function(t,e,r){t=i(t);if(t._fullLayout){a.clear(t._fullLayout._uid+o.HOVERID)}s.raw(t,e,r)};s.raw=function t(e,r){var a=e._fullLayout;var i=e._hoverdata;if(!r)r={};if(r.target&&n.triggerHandler(e,"plotly_beforehover",r)===false){return}a._hoverlayer.selectAll("g").remove();a._hoverlayer.selectAll("line").remove();a._hoverlayer.selectAll("circle").remove();e._hoverdata=undefined;if(r.target&&i){e.emit("plotly_unhover",{event:r,points:i})}}},{"../../lib/events":672,"../../lib/get_graph_div":679,"../../lib/throttle":709,"../fx/constants":595}],582:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],583:[function(t,e,r){"use strict";var n=t("d3");var a=t("fast-isnumeric");var i=t("tinycolor2");var o=t("../../registry");var s=t("../color");var l=t("../colorscale");var u=t("../../lib");var c=t("../../lib/svg_text_utils");var f=t("../../constants/xmlns_namespaces");var h=t("../../constants/alignment");var p=h.LINE_SPACING;var d=t("../../constants/interactions").DESELECTDIM;var v=t("../../traces/scatter/subtypes");var g=t("../../traces/scatter/make_bubble_size_func");var m=e.exports={};m.font=function(t,e,r,n){if(u.isPlainObject(e)){n=e.color;r=e.size;e=e.family}if(e)t.style("font-family",e);if(r+1)t.style("font-size",r+"px");if(n)t.call(s.fill,n)};m.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)};m.setSize=function(t,e,r){t.attr("width",e).attr("height",r)};m.setRect=function(t,e,r,n,a){t.call(m.setPosition,e,r).call(m.setSize,n,a)};m.translatePoint=function(t,e,r,n){var i=r.c2p(t.x);var o=n.c2p(t.y);if(a(i)&&a(o)&&e.node()){if(e.node().nodeName==="text"){e.attr("x",i).attr("y",o)}else{e.attr("transform","translate("+i+","+o+")")}}else{return false}return true};m.translatePoints=function(t,e,r){t.each(function(t){var a=n.select(this);m.translatePoint(t,a,e,r)})};m.hideOutsideRangePoint=function(t,e,r,n,a,i){e.attr("display",r.isPtWithinRange(t,a)&&n.isPtWithinRange(t,i)?null:"none")};m.hideOutsideRangePoints=function(t,e){if(!e._hasClipOnAxisFalse)return;var r=e.xaxis;var a=e.yaxis;t.each(function(e){var i=e[0].trace;var o=i.xcalendar;var s=i.ycalendar;var l=i.type==="bar"?".bartext":".point,.textpoint";t.selectAll(l).each(function(t){m.hideOutsideRangePoint(t,n.select(this),r,a,o,s)})})};m.crispRound=function(t,e,r){if(!e||!a(e))return r||0;if(t._context.staticPlot)return e;if(e<1)return 1;return Math.round(e)};m.singleLineStyle=function(t,e,r,n,a){e.style("fill","none");var i=(((t||[])[0]||{}).trace||{}).line||{},o=r||i.width||0,l=a||i.dash||"";s.stroke(e,n||i.color);m.dashLine(e,l,o)};m.lineGroupStyle=function(t,e,r,a){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},o=e||i.width||0,l=a||i.dash||"";n.select(this).call(s.stroke,r||i.color).call(m.dashLine,l,o)})};m.dashLine=function(t,e,r){r=+r||0;e=m.dashStyle(e,r);t.style({"stroke-dasharray":e,"stroke-width":r+"px"})};m.dashStyle=function(t,e){e=+e||1;var r=Math.max(e,3);if(t==="solid")t="";else if(t==="dot")t=r+"px,"+r+"px";else if(t==="dash")t=3*r+"px,"+3*r+"px";else if(t==="longdash")t=5*r+"px,"+5*r+"px";else if(t==="dashdot"){t=3*r+"px,"+r+"px,"+r+"px,"+r+"px"}else if(t==="longdashdot"){t=5*r+"px,"+2*r+"px,"+r+"px,"+2*r+"px"}return t};m.singleFillStyle=function(t){var e=n.select(t.node());var r=e.data();var a=(((r[0]||[])[0]||{}).trace||{}).fillcolor;if(a){t.call(s.fill,a)}};m.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=n.select(this);try{r.call(s.fill,e[0].trace.fillcolor)}catch(e){u.error(e,t);r.remove()}})};var y=t("./symbol_defs");m.symbolNames=[];m.symbolFuncs=[];m.symbolNeedLines={};m.symbolNoDot={};m.symbolNoFill={};m.symbolList=[];Object.keys(y).forEach(function(t){var e=y[t];m.symbolList=m.symbolList.concat([e.n,t,e.n+100,t+"-open"]);m.symbolNames[e.n]=t;m.symbolFuncs[e.n]=e.f;if(e.needLine){m.symbolNeedLines[e.n]=true}if(e.noDot){m.symbolNoDot[e.n]=true}else{m.symbolList=m.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])}if(e.noFill){m.symbolNoFill[e.n]=true}});var x=m.symbolNames.length,b="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";m.symbolNumber=function(t){if(typeof t==="string"){var e=0;if(t.indexOf("-open")>0){e=100;t=t.replace("-open","")}if(t.indexOf("-dot")>0){e+=200;t=t.replace("-dot","")}t=m.symbolNames.indexOf(t);if(t>=0){t+=e}}if(t%100>=x||t>=400){return 0}return Math.floor(Math.max(t,0))};function _(t,e){var r=t%100;return m.symbolFuncs[r](e)+(t>=200?b:"")}var w={x1:1,x2:0,y1:0,y2:0};var k={x1:0,x2:0,y1:1,y2:0};m.gradient=function(t,e,r,a,o,l){var c=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([a+o+l],u.identity);c.exit().remove();c.enter().append(a==="radial"?"radialGradient":"linearGradient").each(function(){var t=n.select(this);if(a==="horizontal")t.attr(w);else if(a==="vertical")t.attr(k);t.attr("id",r);var e=i(o);var u=i(l);t.append("stop").attr({offset:"0%","stop-color":s.tinyRGB(u),"stop-opacity":u.getAlpha()});t.append("stop").attr({offset:"100%","stop-color":s.tinyRGB(e),"stop-opacity":e.getAlpha()})});t.style({fill:"url(#"+r+")","fill-opacity":null})};m.initGradients=function(t){var e=u.ensureSingle(t._fullLayout._defs,"g","gradients");e.selectAll("linearGradient,radialGradient").remove()};m.pointStyle=function(t,e,r){if(!t.size())return;var a=m.makePointStyleFns(e);t.each(function(t){m.singlePointStyle(t,n.select(this),e,a,r)})};m.singlePointStyle=function(t,e,r,n,a){var i=r.marker;var o=i.line;e.style("opacity",n.selectedOpacityFn?n.selectedOpacityFn(t):t.mo===undefined?i.opacity:t.mo);if(n.ms2mrc){var l;if(t.ms==="various"||i.size==="various"){l=3}else{l=n.ms2mrc(t.ms)}t.mrc=l;if(n.selectedSizeFn){l=t.mrc=n.selectedSizeFn(t)}var c=m.symbolNumber(t.mx||i.symbol)||0;t.om=c%200>=100;e.attr("d",_(c,l))}var f=false;var h,p,d;if(t.so){d=o.outlierwidth;p=o.outliercolor;h=i.outliercolor}else{var v=(o||{}).width;d=(t.mlw+1||v+1||(t.trace?(t.trace.marker.line||{}).width:0)+1)-1||0;if("mlc"in t)p=t.mlcc=n.lineScale(t.mlc);else if(u.isArrayOrTypedArray(o.color))p=s.defaultLine;else p=o.color;if(u.isArrayOrTypedArray(i.color)){h=s.defaultLine;f=true}if("mc"in t){h=t.mcc=n.markerScale(t.mc)}else{h=i.color||"rgba(0,0,0,0)"}if(n.selectedColorFn){h=n.selectedColorFn(t)}}if(t.om){e.call(s.stroke,h).style({"stroke-width":(d||1)+"px",fill:"none"})}else{e.style("stroke-width",d+"px");var g=i.gradient;var y=t.mgt;if(y)f=true;else y=g&&g.type;if(y&&y!=="none"){var x=t.mgc;if(x)f=true;else x=g.color;var b="g"+a._fullLayout._uid+"-"+r.uid;if(f)b+="-"+t.i;e.call(m.gradient,a,b,y,h,x)}else{e.call(s.fill,h)}if(d){e.call(s.stroke,p)}}};m.makePointStyleFns=function(t){var e={};var r=t.marker;e.markerScale=m.tryColorscale(r,"");e.lineScale=m.tryColorscale(r,"line");if(o.traceIs(t,"symbols")){e.ms2mrc=v.isBubble(t)?g(t):function(){return(r.size||6)/2}}if(t.selectedpoints){u.extendFlat(e,m.makeSelectedPointStyleFns(t))}return e};m.makeSelectedPointStyleFns=function(t){var e={};var r=t.selected||{};var n=t.unselected||{};var a=t.marker||{};var i=r.marker||{};var s=n.marker||{};var l=a.opacity;var c=i.opacity;var f=s.opacity;var h=c!==undefined;var p=f!==undefined;if(u.isArrayOrTypedArray(l)||h||p){e.selectedOpacityFn=function(t){var e=t.mo===undefined?a.opacity:t.mo;if(t.selected){return h?c:e}else{return p?f:d*e}}}var v=a.color;var g=i.color;var m=s.color;if(g||m){e.selectedColorFn=function(t){var e=t.mcc||v;if(t.selected){return g||e}else{return m||e}}}var y=a.size;var x=i.size;var b=s.size;var _=x!==undefined;var w=b!==undefined;if(o.traceIs(t,"symbols")&&(_||w)){e.selectedSizeFn=function(t){var e=t.mrc||y/2;if(t.selected){return _?x/2:e}else{return w?b/2:e}}}return e};m.makeSelectedTextStyleFns=function(t){var e={};var r=t.selected||{};var n=t.unselected||{};var a=t.textfont||{};var i=r.textfont||{};var o=n.textfont||{};var l=a.color;var u=i.color;var c=o.color;e.selectedTextColorFn=function(t){var e=t.tc||l;if(t.selected){return u||e}else{if(c)return c;else return u?e:s.addOpacity(e,d)}};return e};m.selectedPointStyle=function(t,e){if(!t.size()||!e.selectedpoints)return;var r=m.makeSelectedPointStyleFns(e);var a=e.marker||{};var i=[];if(r.selectedOpacityFn){i.push(function(t,e){t.style("opacity",r.selectedOpacityFn(e))})}if(r.selectedColorFn){i.push(function(t,e){s.fill(t,r.selectedColorFn(e))})}if(r.selectedSizeFn){i.push(function(t,e){var n=e.mx||a.symbol||0;var i=r.selectedSizeFn(e);t.attr("d",_(m.symbolNumber(n),i));e.mrc2=i})}if(i.length){t.each(function(t){var e=n.select(this);for(var r=0;r0?r:0}m.textPointStyle=function(t,e,r){if(!t.size())return;var a;if(e.selectedpoints){var i=m.makeSelectedTextStyleFns(e);a=i.selectedTextColorFn}t.each(function(t){var i=n.select(this);var o=u.extractOption(t,e,"tx","text");if(!o&&o!==0){i.remove();return}var s=t.tp||e.textposition;var l=T(t,e);var f=a?a(t):t.tc||e.textfont.color;i.call(m.font,t.tf||e.textfont.family,l,f).text(o).call(c.convertToTspans,r).call(A,s,l,t.mrc)})};m.selectedTextStyle=function(t,e){if(!t.size()||!e.selectedpoints)return;var r=m.makeSelectedTextStyleFns(e);t.each(function(t){var a=n.select(this);var i=r.selectedTextColorFn(t);var o=t.tp||e.textposition;var l=T(t,e);s.fill(a,i);A(a,o,l,t.mrc2||t.mrc)})};var S=.5;m.smoothopen=function(t,e){if(t.length<3){return"M"+t.join("L")}var r="M"+t[0],n=[],a;for(a=1;a=z){m.savedBBoxes={};I=0}if(r)m.savedBBoxes[r]=g;I++;return u.extendFlat({},g)};function P(t){var e=t.getAttribute("data-unformatted");if(e===null)return;return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}m.setClipUrl=function(t,e){if(!e){t.attr("clip-path",null);return}if(m.baseUrl===undefined){var r=n.select("base");if(r.size()&&r.attr("href")){m.baseUrl=window.location.href.split("#")[0]}else{m.baseUrl=""}}t.attr("clip-path","url("+m.baseUrl+"#"+e+")")};m.getTranslate=function(t){var e=/.*\btranslate\((-?\d*\.?\d*)[^-\d]*(-?\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"";var a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||0,y:+a[1]||0}};m.setTranslate=function(t,e,r){var n=/(\btranslate\(.*?\);?)/,a=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",o=t[a]("transform")||"";e=e||0;r=r||0;o=o.replace(n,"").trim();o+=" translate("+e+", "+r+")";o=o.trim();t[i]("transform",o);return o};m.getScale=function(t){var e=/.*\bscale\((\d*\.?\d*)[^\d]*(\d*\.?\d*)[^\d].*/,r=t.attr?"attr":"getAttribute",n=t[r]("transform")||"";var a=n.replace(e,function(t,e,r){return[e,r].join(" ")}).split(" ");return{x:+a[0]||1,y:+a[1]||1}};m.setScale=function(t,e,r){var n=/(\bscale\(.*?\);?)/,a=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",o=t[a]("transform")||"";e=e||1;r=r||1;o=o.replace(n,"").trim();o+=" scale("+e+", "+r+")";o=o.trim();t[i]("transform",o);return o};var O=/\s*sc.*/;m.setPointGroupScale=function(t,e,r){e=e||1;r=r||1;if(!t)return;var n=e===1&&r===1?"":" scale("+e+","+r+")";t.each(function(){var t=(this.getAttribute("transform")||"").replace(O,"");t+=n;t=t.trim();this.setAttribute("transform",t)})};var D=/translate\([^)]*\)\s*$/;m.setTextPointsScale=function(t,e,r){if(!t)return;t.each(function(){var t;var a=n.select(this);var i=a.select("text");if(!i.node())return;var o=parseFloat(i.attr("x")||0);var s=parseFloat(i.attr("y")||0);var l=(a.attr("transform")||"").match(D);if(e===1&&r===1){t=[]}else{t=["translate("+o+","+s+")","scale("+e+","+r+")","translate("+-o+","+-s+")"]}if(l){t.push(l)}a.attr("transform",t.join(" "))})}},{"../../constants/alignment":656,"../../constants/interactions":660,"../../constants/xmlns_namespaces":663,"../../lib":684,"../../lib/svg_text_utils":708,"../../registry":817,"../../traces/scatter/make_bubble_size_func":1031,"../../traces/scatter/subtypes":1037,"../color":558,"../colorscale":573,"./symbol_defs":584,d3:147,"fast-isnumeric":214,tinycolor2:499}],584:[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(t*1.3,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(t*.4,2),r=n.round(t*1.2,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(t*.8/Math.sqrt(2),2),r="l"+e+","+e,a="l"+e+",-"+e,i="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+a+i+a+i+o+i+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(t*2/Math.sqrt(3),2),r=n.round(t/2,2),a=n.round(t,2);return"M-"+e+","+r+"H"+e+"L0,-"+a+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(t*2/Math.sqrt(3),2),r=n.round(t/2,2),a=n.round(t,2);return"M-"+e+",-"+r+"H"+e+"L0,"+a+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(t*2/Math.sqrt(3),2),r=n.round(t/2,2),a=n.round(t,2);return"M"+r+",-"+e+"V"+e+"L-"+a+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(t*2/Math.sqrt(3),2),r=n.round(t/2,2),a=n.round(t,2);return"M-"+r+",-"+e+"V"+e+"L"+a+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(t*.6,2),r=n.round(t*1.2,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(t*.6,2),r=n.round(t*1.2,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(t*.6,2),r=n.round(t*1.2,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(t*.6,2),r=n.round(t*1.2,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(t*.951,2),r=n.round(t*.588,2),a=n.round(-t,2),i=n.round(t*-.309,2),o=n.round(t*.809,2);return"M"+e+","+i+"L"+r+","+o+"H-"+r+"L-"+e+","+i+"L0,"+a+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M"+a+",-"+r+"V"+r+"L0,"+e+"L-"+a+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),a=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+a+"H"+r+"L"+e+",0L"+r+",-"+a+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(t*.924,2),r=n.round(t*.383,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=t*1.4,r=n.round(e*.225,2),a=n.round(e*.951,2),i=n.round(e*.363,2),o=n.round(e*.588,2),s=n.round(-e,2),l=n.round(e*-.309,2),u=n.round(e*.118,2),c=n.round(e*.809,2),f=n.round(e*.382,2);return"M"+r+","+l+"H"+a+"L"+i+","+u+"L"+o+","+c+"L0,"+f+"L-"+o+","+c+"L-"+i+","+u+"L-"+a+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(t*.66,2),r=n.round(t*.38,2),a=n.round(t*.76,2);return"M-"+a+",0l-"+r+",-"+e+"h"+a+"l"+r+",-"+e+"l"+r+","+e+"h"+a+"l-"+r+","+e+"l"+r+","+e+"h-"+a+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+a+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(t*.8,2),a=n.round(t*1.6,2),i=n.round(t*4,2),o="A "+i+","+i+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+a+o+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(t*.8,2),a=n.round(t*1.6,2),i=n.round(t*4,2),o="A "+i+","+i+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+a+o+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(t*1.1,2),r=n.round(t*2,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+a+"-"+e+","+e+a+e+","+e+a+e+",-"+e+a+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(t*1.4,2),r=n.round(t*1.9,2),a="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+a+"0,"+e+a+e+",0"+a+"0,-"+e+a+"-"+e+",0"+"Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(t*.7,2),r=n.round(t*1.4,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(t*1.4,2),r=n.round(t*.7,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:true},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:true},"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:true,noDot:true},"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:true,noDot:true},"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:true,noDot:true},"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:true,noDot:true},"diamond-cross":{n:31,f:function(t){var e=n.round(t*1.3,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"+"M0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:true,noDot:true},"diamond-x":{n:32,f:function(t){var e=n.round(t*1.3,2),r=n.round(t*.65,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"+"M-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:true,noDot:true},"cross-thin":{n:33,f:function(t){var e=n.round(t*1.4,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:true,noDot:true,noFill:true},"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:true,noDot:true,noFill:true},asterisk:{n:35,f:function(t){var e=n.round(t*1.2,2);var r=n.round(t*.85,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:true,noDot:true,noFill:true},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:true,noFill:true},"y-up":{n:37,f:function(t){var e=n.round(t*1.2,2),r=n.round(t*1.6,2),a=n.round(t*.8,2);return"M-"+e+","+a+"L0,0M"+e+","+a+"L0,0M0,-"+r+"L0,0"},needLine:true,noDot:true,noFill:true},"y-down":{n:38,f:function(t){var e=n.round(t*1.2,2),r=n.round(t*1.6,2),a=n.round(t*.8,2);return"M-"+e+",-"+a+"L0,0M"+e+",-"+a+"L0,0M0,"+r+"L0,0"},needLine:true,noDot:true,noFill:true},"y-left":{n:39,f:function(t){var e=n.round(t*1.2,2),r=n.round(t*1.6,2),a=n.round(t*.8,2);return"M"+a+","+e+"L0,0M"+a+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:true,noDot:true,noFill:true},"y-right":{n:40,f:function(t){var e=n.round(t*1.2,2),r=n.round(t*1.6,2),a=n.round(t*.8,2);return"M-"+a+","+e+"L0,0M-"+a+",-"+e+"L0,0M"+r+",0L0,0"},needLine:true,noDot:true,noFill:true},"line-ew":{n:41,f:function(t){var e=n.round(t*1.4,2);return"M"+e+",0H-"+e},needLine:true,noDot:true,noFill:true},"line-ns":{n:42,f:function(t){var e=n.round(t*1.4,2);return"M0,"+e+"V-"+e},needLine:true,noDot:true,noFill:true},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:true,noDot:true,noFill:true},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:true,noDot:true,noFill:true}}},{d3:147}],585:[function(t,e,r){"use strict";e.exports={visible:{valType:"boolean",editType:"calc"},type:{valType:"enumerated",values:["percent","constant","sqrt","data"],editType:"calc"},symmetric:{valType:"boolean",editType:"calc"},array:{valType:"data_array",editType:"calc"},arrayminus:{valType:"data_array",editType:"calc"},value:{valType:"number",min:0,dflt:10,editType:"calc"},valueminus:{valType:"number",min:0,dflt:10,editType:"calc"},traceref:{valType:"integer",min:0,dflt:0,editType:"style"},tracerefminus:{valType:"integer",min:0,dflt:0,editType:"style"},copy_ystyle:{valType:"boolean",editType:"plot"},copy_zstyle:{valType:"boolean",editType:"style"},color:{valType:"color",editType:"style"},thickness:{valType:"number",min:0,dflt:2,editType:"style"},width:{valType:"number",min:0,editType:"plot"},editType:"calc",_deprecated:{opacity:{valType:"number",editType:"style"}}}},{}],586:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("../../registry");var i=t("../../plots/cartesian/axes");var o=t("./compute_error");e.exports=function t(e){var r=e.calcdata;for(var n=0;n0;e.each(function(t){var e=t[0].trace,p=e.error_x||{},d=e.error_y||{};var v;if(e.ids){v=function(t){return t.id}}var g=o.hasMarkers(e)&&e.marker.maxdisplayed>0;if(!d.visible&&!p.visible)t=[];var m=n.select(this).selectAll("g.errorbar").data(t,v);m.exit().remove();if(!t.length)return;if(!p.visible)m.selectAll("path.xerror").remove();if(!d.visible)m.selectAll("path.yerror").remove();m.style("opacity",1);var y=m.enter().append("g").classed("errorbar",true);if(h){y.style("opacity",0).transition().duration(l.duration).style("opacity",1)}i.setClipUrl(m,r.layerClipId);m.each(function(t){var e=n.select(this);var r=s(t,c,f);if(g&&!t.vis)return;var i;var o=e.select("path.yerror");if(d.visible&&a(r.x)&&a(r.yh)&&a(r.ys)){var v=d.width;i="M"+(r.x-v)+","+r.yh+"h"+2*v+"m-"+v+",0V"+r.ys;if(!r.noYS)i+="m-"+v+",0h"+2*v;u=!o.size();if(u){o=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",true)}else if(h){o=o.transition().duration(l.duration).ease(l.easing)}o.attr("d",i)}else o.remove();var m=e.select("path.xerror");if(p.visible&&a(r.y)&&a(r.xh)&&a(r.xs)){var y=(p.copy_ystyle?d:p).width;i="M"+r.xh+","+(r.y-y)+"v"+2*y+"m0,-"+y+"H"+r.xs;if(!r.noXS)i+="m0,-"+y+"v"+2*y;u=!m.size();if(u){m=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",true)}else if(h){m=m.transition().duration(l.duration).ease(l.easing)}m.attr("d",i)}else m.remove()})})};function s(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};if(t.yh!==undefined){n.yh=r.c2p(t.yh);n.ys=r.c2p(t.ys);if(!a(n.ys)){n.noYS=true;n.ys=r.c2p(t.ys,true)}}if(t.xh!==undefined){n.xh=e.c2p(t.xh);n.xs=e.c2p(t.xs);if(!a(n.xs)){n.noXS=true;n.xs=e.c2p(t.xs,true)}}return n}},{"../../traces/scatter/subtypes":1037,"../drawing":583,d3:147,"fast-isnumeric":214}],591:[function(t,e,r){"use strict";var n=t("d3");var a=t("../color");e.exports=function t(e){e.each(function(t){var e=t[0].trace,r=e.error_y||{},i=e.error_x||{};var o=n.select(this);o.selectAll("path.yerror").style("stroke-width",r.thickness+"px").call(a.stroke,r.color);if(i.copy_ystyle)i=r;o.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(a.stroke,i.color)})}},{"../color":558,d3:147}],592:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:true,editType:"none"},bordercolor:{valType:"color",arrayOk:true,editType:"none"},font:n({arrayOk:true,editType:"none"}),namelength:{valType:"integer",min:-1,arrayOk:true,editType:"none"},editType:"calc"}}},{"../../plots/font_attributes":758}],593:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("../../registry");e.exports=function t(e){var r=e.calcdata;var o=e._fullLayout;function s(t){return function(e){return n.coerceHoverinfo({hoverinfo:e},{_module:t._module},o)}}for(var l=0;l=0&&n.index_[0]._length||rt<0||rt>w[0]._length){return h.unhoverRaw(t,e)}}e.pointerX=et+_[0]._offset;e.pointerY=rt+w[0]._offset;if("xval"in e)j=v.flat(l,e.xval);else j=v.p2c(_,et);if("yval"in e)V=v.flat(l,e.yval);else V=v.p2c(w,rt);if(!a(j[0])||!a(V[0])){o.warn("Fx.hover failed",e,t);return h.unhoverRaw(t,e)}}var at=Infinity;for(q=0;qK){F.splice(0,K);at=F[0].distance}if(y&&B!==0){if(F.length===0){J.distance=B;J.index=false;var ut=G._module.hoverPoints(J,Z,$,"closest",c._hoverlayer);if(ut){ut=ut.filter(function(t){return t.spikeDistance<=B})}if(ut&&ut.length){var ct;var ft=ut.filter(function(t){return t.xa.showspikes});if(ft.length){var ht=ft[0];if(a(ht.x0)&&a(ht.y0)){ct=gt(ht);if(!Q.vLinePoint||Q.vLinePoint.spikeDistance>ct.spikeDistance){Q.vLinePoint=ct}}}var pt=ut.filter(function(t){return t.ya.showspikes});if(pt.length){var dt=pt[0];if(a(dt.x0)&&a(dt.y0)){ct=gt(dt);if(!Q.hLinePoint||Q.hLinePoint.spikeDistance>ct.spikeDistance){Q.hLinePoint=ct}}}}}}}function vt(t,e){var r=null;var n=Infinity;var a;for(var i=0;i1;var Ct=f.combine(c.plot_bgcolor||f.background,c.paper_bgcolor);var Lt={hovermode:D,rotateLabels:Et,bgColor:Ct,container:c._hoverlayer,outerContainer:c._paperdiv,commonLabelOpts:c.hoverlabel,hoverdistance:c.hoverdistance};var It=A(F,Lt,t);T(F,Et?"xa":"ya",c);S(It,Et);if(e.target&&e.target.tagName){var zt=d.getComponentMethod("annotations","hasClickToShow")(t,Tt);u(n.select(e.target),zt?"pointer":"")}if(!e.target||i||!L(t,e,At))return;if(At){t.emit("plotly_unhover",{event:e,points:At})}t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:_,yaxes:w,xvals:j,yvals:V})}function A(t,e,r){var a=e.hovermode;var i=e.rotateLabels;var s=e.bgColor;var u=e.container;var h=e.outerContainer;var p=e.commonLabelOpts||{};var d=e.fontFamily||g.HOVERFONT;var v=e.fontSize||g.HOVERFONTSIZE;var y=t[0];var x=y.xa;var b=y.ya;var _=a==="y"?"yLabel":"xLabel";var M=y[_];var A=(String(M)||"").split(" ")[0];var T=h.node().getBoundingClientRect();var S=T.top;var E=T.width;var C=T.height;var L=M!==undefined&&y.distance<=e.hoverdistance&&(a==="x"||a==="y");if(L){var I,z;var P=true;for(I=0;I-1&&o.length>y){if(y>3)o=o.substr(0,y-3)+"...";else o=o.substr(0,y)}}if(t.zLabel!==undefined){if(t.xLabel!==undefined)u+="x: "+t.xLabel+"
";if(t.yLabel!==undefined)u+="y: "+t.yLabel+"
";u+=(u?"z: ":"")+t.zLabel}else if(L&&t[a+"Label"]===M){u=t[(a==="x"?"y":"x")+"Label"]||""}else if(t.xLabel===undefined){if(t.yLabel!==undefined)u=t.yLabel}else if(t.yLabel===undefined)u=t.xLabel;else u="("+t.xLabel+", "+t.yLabel+")";if((t.text||t.text===0)&&!Array.isArray(t.text)){u+=(u?"
":"")+t.text}if(t.extraText!==undefined)u+=(u?"
":"")+t.extraText;if(u===""){if(o==="")e.remove();u=o}var x=e.select("text.nums").call(c.font,t.fontFamily||d,t.fontSize||v,t.fontColor||g).text(u).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r);var b=e.select("text.name"),_=0;if(o&&o!==u){b.call(c.font,t.fontFamily||d,t.fontSize||v,p).text(o).attr("data-notex",1).call(l.positionText,0,0).call(l.convertToTspans,r);_=b.node().getBoundingClientRect().width+2*k}else{b.remove();e.select("rect").remove()}e.select("path").style({fill:p,stroke:g});var A=x.node().getBoundingClientRect(),T=t.xa._offset+(t.x0+t.x1)/2,I=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),P=Math.abs(t.y1-t.y0),O=A.width+w+k+_,D,R;t.ty0=S-A.top;t.bx=A.width+2*k;t.by=A.height+2*k;t.anchor="start";t.txwidth=A.width;t.tx2width=_;t.offset=0;if(i){t.pos=T;D=I+P/2+O<=C;R=I-P/2-O>=0;if((t.idealAlign==="top"||!D)&&R){I-=P/2;t.anchor="end"}else if(D){I+=P/2;t.anchor="start"}else t.anchor="middle"}else{t.pos=I;D=T+z/2+O<=E;R=T-z/2-O>=0;if((t.idealAlign==="left"||!D)&&R){T-=z/2;t.anchor="end"}else if(D){T+=z/2;t.anchor="start"}else t.anchor="middle"}x.attr("text-anchor",t.anchor);if(_)b.attr("text-anchor",t.anchor);e.attr("transform","translate("+T+","+I+")"+(i?"rotate("+m+")":""))});return R}function T(t,e,r){var n=0,a=t.map(function(t,n){var a=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*(a._id.charAt(0)==="x"?x:1)/2,pmin:0,pmax:a._id.charAt(0)==="x"?r.width:r.height}]}).sort(function(t,e){return t[0].posref-e[0].posref}),i,o,s,l,u,c,f;function h(t){var e=t[0],r=t[t.length-1];o=e.pmin-e.pos-e.dp+e.size;s=r.pos+r.dp+r.size-e.pmax;if(o>.01){for(u=t.length-1;u>=0;u--)t[u].dp+=o;i=false}if(s<.01)return;if(o<-.01){for(u=t.length-1;u>=0;u--)t[u].dp-=s;i=false}if(!i)return;var n=0;for(l=0;le.pmax)n++}for(l=t.length-1;l>=0;l--){if(n<=0)break;c=t[l];if(c.pos>e.pmax-1){c.del=true;n--}}for(l=0;l=0;u--)t[u].dp-=s}}for(l=t.length-1;l>=0;l--){if(n<=0)break;c=t[l];if(c.pos+c.dp+c.size>e.pmax){c.del=true;n--}}}while(!i&&n<=t.length){n++;i=true;l=0;while(l.01&&v.pmin===g.pmin&&v.pmax===g.pmax){for(u=d.length-1;u>=0;u--)d[u].dp+=o;p.push.apply(p,d);a.splice(l+1,1);f=0;for(u=p.length-1;u>=0;u--)f+=p[u].dp;s=f/p.length;for(u=p.length-1;u>=0;u--)p[u].dp-=s;i=false}else l++}a.forEach(h)}for(l=a.length-1;l>=0;l--){var m=a[l];for(u=m.length-1;u>=0;u--){var y=m[u],b=t[y.i];b.offset=y.dp;b.del=y.del}}}function S(t,e){t.each(function(t){var r=n.select(this);if(t.del){r.remove();return}var a=t.anchor==="end"?-1:1,i=r.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],s=o*(w+k),u=s+o*(t.txwidth+k),f=0,h=t.offset;if(t.anchor==="middle"){s-=t.tx2width/2;u+=t.txwidth/2+k}if(e){h*=-_;f=t.offset*b}r.select("path").attr("d",t.anchor==="middle"?"M-"+(t.bx/2+t.tx2width/2)+","+(h-t.by/2)+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(a*w+f)+","+(w+h)+"v"+(t.by/2-w)+"h"+a*t.bx+"v-"+t.by+"H"+(a*w+f)+"V"+(h-w)+"Z");i.call(l.positionText,s+f,h+t.ty0-t.by/2+k);if(t.tx2width){r.select("text.name").call(l.positionText,u+o*k+f,h+t.ty0-t.by/2+k);r.select("rect").call(c.setRect,u+(o-1)*t.tx2width/2+f,h-t.by/2-1,t.tx2width,t.by+2)}})}function E(t,e){var r=t.index;var n=t.trace||{};var a=t.cd[0];var i=t.cd[r]||{};var s=Array.isArray(r)?function(t,e){return o.castOption(a,r,t)||o.extractOption({},n,"",e)}:function(t,e){return o.extractOption(i,n,t,e)};function l(e,r,n){var a=s(r,n);if(a)t[e]=a}l("hoverinfo","hi","hoverinfo");l("color","hbg","hoverlabel.bgcolor");l("borderColor","hbc","hoverlabel.bordercolor");l("fontFamily","htf","hoverlabel.font.family");l("fontSize","hts","hoverlabel.font.size");l("fontColor","htc","hoverlabel.font.color");l("nameLength","hnl","hoverlabel.namelength");t.posref=e==="y"?t.xa._offset+(t.x0+t.x1)/2:t.ya._offset+(t.y0+t.y1)/2;t.x0=o.constrain(t.x0,0,t.xa._length);t.x1=o.constrain(t.x1,0,t.xa._length);t.y0=o.constrain(t.y0,0,t.ya._length);t.y1=o.constrain(t.y1,0,t.ya._length);if(t.xLabelVal!==undefined){t.xLabel="xLabel"in t?t.xLabel:p.hoverLabelText(t.xa,t.xLabelVal);t.xVal=t.xa.c2d(t.xLabelVal)}if(t.yLabelVal!==undefined){t.yLabel="yLabel"in t?t.yLabel:p.hoverLabelText(t.ya,t.yLabelVal);t.yVal=t.ya.c2d(t.yLabelVal)}if(t.zLabelVal!==undefined&&t.zLabel===undefined){t.zLabel=String(t.zLabelVal)}if(!isNaN(t.xerr)&&!(t.xa.type==="log"&&t.xerr<=0)){var u=p.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;if(t.xerrneg!==undefined){t.xLabel+=" +"+u+" / -"+p.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text}else t.xLabel+=" \xb1 "+u;if(e==="x")t.distance+=1}if(!isNaN(t.yerr)&&!(t.ya.type==="log"&&t.yerr<=0)){var c=p.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;if(t.yerrneg!==undefined){t.yLabel+=" +"+c+" / -"+p.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text}else t.yLabel+=" \xb1 "+c;if(e==="y")t.distance+=1}var f=t.hoverinfo||t.trace.hoverinfo;if(f!=="all"){f=Array.isArray(f)?f:f.split("+");if(f.indexOf("x")===-1)t.xLabel=undefined;if(f.indexOf("y")===-1)t.yLabel=undefined;if(f.indexOf("z")===-1)t.zLabel=undefined;if(f.indexOf("text")===-1)t.text=undefined;if(f.indexOf("name")===-1)t.name=undefined}return t}function C(t,e){var r=e.container;var n=e.fullLayout;var a=e.event;var o,s;var l=!!t.hLinePoint;var u=!!t.vLinePoint;r.selectAll(".spikeline").remove();if(!(u||l))return;var h=f.combine(n.plot_bgcolor,n.paper_bgcolor);if(l){var p=t.hLinePoint,d,v;o=p&&p.xa;s=p&&p.ya;var g=s.spikesnap;if(g==="cursor"){d=a.pointerX;v=a.pointerY}else{d=o._offset+p.x;v=s._offset+p.y}var m=i.readability(p.color,h)<1.5?f.contrast(h):p.color;var y=s.spikemode,x=s.spikethickness,b=s.spikecolor||m,_=s._boundingBox,w=(_.left+_.right)/2=0;n--){var a=r[n],i=t._hoverdata[n];if(a.curveNumber!==i.curveNumber||String(a.pointNumber)!==String(i.pointNumber)){return true}}return false}function I(t,e){if(!e)return true;if(e.vLinePoint!==t._spikepoints.vLinePoint||e.hLinePoint!==t._spikepoints.hLinePoint)return true;return false}},{"../../lib":684,"../../lib/events":672,"../../lib/override_cursor":695,"../../lib/svg_text_utils":708,"../../plots/cartesian/axes":732,"../../registry":817,"../color":558,"../dragelement":580,"../drawing":583,"./constants":595,"./helpers":597,d3:147,"fast-isnumeric":214,tinycolor2:499}],599:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function t(e,r,a,i){i=i||{};a("hoverlabel.bgcolor",i.bgcolor);a("hoverlabel.bordercolor",i.bordercolor);a("hoverlabel.namelength",i.namelength);n.coerceFont(a,"hoverlabel.font",i.font)}},{"../../lib":684}],600:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../lib");var i=t("../dragelement");var o=t("./helpers");var s=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:s},attributes:t("./attributes"),layoutAttributes:s,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:o.getDistanceFunction,getClosest:o.getClosest,inbox:o.inbox,quadrature:o.quadrature,appendArrayPointValue:o.appendArrayPointValue,castHoverOption:u,castHoverinfo:c,hover:t("./hover").hover,unhover:i.unhover,loneHover:t("./hover").loneHover,loneUnhover:l,click:t("./click")};function l(t){var e=a.isD3Selection(t)?t:n.select(t);e.selectAll("g.hovertext").remove();e.selectAll(".spikeline").remove()}function u(t,e,r){return a.castOption(t,e,"hoverlabel."+r)}function c(t,e,r){function n(r){return a.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)}return a.castOption(t,r,"hoverinfo",n)}},{"../../lib":684,"../dragelement":580,"./attributes":592,"./calc":593,"./click":594,"./constants":595,"./defaults":596,"./helpers":597,"./hover":598,"./layout_attributes":601,"./layout_defaults":602,"./layout_global_defaults":603,d3:147}],601:[function(t,e,r){"use strict";var n=t("./constants");var a=t("../../plots/font_attributes")({editType:"none"});a.family.dflt=n.HOVERFONT;a.size.dflt=n.HOVERFONTSIZE;e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom",editType:"modebar"},hovermode:{valType:"enumerated",values:["x","y","closest",false],editType:"modebar"},hoverdistance:{valType:"integer",min:-1,dflt:20,editType:"none"},spikedistance:{valType:"integer",min:-1,dflt:20,editType:"none"},hoverlabel:{bgcolor:{valType:"color",editType:"none"},bordercolor:{valType:"color",editType:"none"},font:a,namelength:{valType:"integer",min:-1,dflt:15,editType:"none"},editType:"none"},selectdirection:{valType:"enumerated",values:["h","v","d","any"],dflt:"any",editType:"none"}}},{"../../plots/font_attributes":758,"./constants":595}],602:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("./layout_attributes");e.exports=function t(e,r,o){function s(t,i){return n.coerce(e,r,a,t,i)}var l=s("dragmode");if(l==="select")s("selectdirection");var u;if(r._has("cartesian")){r._isHoriz=i(o);u=r._isHoriz?"y":"x"}else u="closest";var c=s("hovermode",u);if(c){s("hoverdistance");s("spikedistance")}var f=r._has("mapbox");var h=r._has("geo");var p=r._basePlotModules.length;if(r.dragmode==="zoom"&&((f||h)&&p===1||f&&h&&p===2)){r.dragmode="pan"}};function i(t){var e=true;for(var r=0;r1)){delete e.grid;return}if(!o&&!c&&!h){var b=m("pattern")==="independent";if(b)o=true}g._hasSubplotGrid=o;var _=m("roworder");var w=_==="top to bottom";var k=o?.2:.1;var M=o?.3:.1;var A,T;if(p&&e._splomGridDflt){A=e._splomGridDflt.xside;T=e._splomGridDflt.yside}g._domains={x:f("x",m,k,A,x),y:f("y",m,M,T,y,w)}}function f(t,e,r,n,a,i){var o=e(t+"gap",r);var s=e("domain."+t);e(t+"side",n);var l=new Array(a);var u=s[0];var c=(s[1]-u)/(a-o);var f=c*(1-o);for(var h=0;h=2/3};r.isCenterAnchor=function t(e){return e.xanchor==="center"||e.xanchor==="auto"&&e.x>1/3&&e.x<2/3};r.isBottomAnchor=function t(e){return e.yanchor==="bottom"||e.yanchor==="auto"&&e.y<=1/3};r.isMiddleAnchor=function t(e){return e.yanchor==="middle"||e.yanchor==="auto"&&e.y>1/3&&e.y<2/3}},{}],611:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes");var a=t("../color/attributes");e.exports={bgcolor:{valType:"color",editType:"legend"},bordercolor:{valType:"color",dflt:a.defaultLine,editType:"legend"},borderwidth:{valType:"number",min:0,dflt:0,editType:"legend"},font:n({editType:"legend"}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v",editType:"legend"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"],editType:"legend"},tracegroupgap:{valType:"number",min:0,dflt:10,editType:"legend"},x:{valType:"number",min:-2,max:3,dflt:1.02,editType:"legend"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left",editType:"legend"},y:{valType:"number",min:-2,max:3,dflt:1,editType:"legend"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"legend"},editType:"legend"}},{"../../plots/font_attributes":758,"../color/attributes":557}],612:[function(t,e,r){"use strict";e.exports={scrollBarWidth:6,scrollBarMinHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],613:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("../../lib");var i=t("../../plot_api/plot_template");var o=t("./attributes");var s=t("../../plots/layout_attributes");var l=t("./helpers");e.exports=function t(e,r,u){var c=e.legend||{};var f=0;var h="normal";var p,d,v,g;for(var m=0;m1);if(x===false)return;var b=i.newContainer(r,"legend");function _(t,e){return a.coerce(c,b,o,t,e)}_("bgcolor",r.paper_bgcolor);_("bordercolor");_("borderwidth");a.coerceFont(_,"font",r.font);_("orientation");if(b.orientation==="h"){var w=e.xaxis;if(w&&w.rangeslider&&w.rangeslider.visible){p=0;v="left";d=1.1;g="bottom"}else{p=0;v="left";d=-.1;g="top"}}_("traceorder",h);if(l.isGrouped(r.legend))_("tracegroupgap");_("x",p);_("xanchor",v);_("y",d);_("yanchor",g);a.noneOrAll(c,b,["x","y"])}},{"../../lib":684,"../../plot_api/plot_template":722,"../../plots/layout_attributes":786,"../../registry":817,"./attributes":611,"./helpers":617}],614:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../lib");var i=t("../../plots/plots");var o=t("../../registry");var s=t("../../lib/events");var l=t("../dragelement");var u=t("../drawing");var c=t("../color");var f=t("../../lib/svg_text_utils");var h=t("./handle_click");var p=t("./constants");var d=t("../../constants/interactions");var v=t("../../constants/alignment");var g=v.LINE_SPACING;var m=v.FROM_TL;var y=v.FROM_BR;var x=t("./get_legend_data");var b=t("./style");var _=t("./helpers");var w=t("./anchor_utils");var k=d.DBLCLICKDELAY;e.exports=function t(e){var r=e._fullLayout;var s="legend"+r._uid;if(!r._infolayer||!e.calcdata)return;if(!e._legendMouseDownTime)e._legendMouseDownTime=0;var f=r.legend;var h=r.showlegend&&x(e.calcdata,f);var d=r.hiddenlabels||[];if(!r.showlegend||!h.length){r._infolayer.selectAll(".legend").remove();r._topdefs.select("#"+s).remove();i.autoMargin(e,"legend");return}var v=0;for(var g=0;gU){I(e)}else{L(e)}var q=r._size,H=q.l+q.w*f.x,G=q.t+q.h*(1-f.y);if(w.isRightAnchor(f)){H-=f._width}else if(w.isCenterAnchor(f)){H-=f._width/2}if(w.isBottomAnchor(f)){G-=f._height}else if(w.isMiddleAnchor(f)){G-=f._height/2}var W=f._width,Y=q.w;if(W>Y){H=q.l;W=Y}else{if(H+W>j)H=j-W;if(HZ){G=q.t;X=Z}else{if(G+X>U)G=U-X;if(G=t.left&&n.clientX<=t.right&&n.clientY>=t.top&&n.clientY<=t.bottom});if(a.size()>0){M(e,z,a,t,n)}}})}};function M(t,e,r,n,a){var i=r.data()[0][0].trace;var o={event:a,node:r.node(),curveNumber:i.index,expandedIndex:i._expandedIndex,data:t.data,layout:t.layout,frames:t._transitionData._frames,config:t._context,fullData:t._fullData,fullLayout:t._fullLayout};if(i._group){o.group=i._group}if(i.type==="pie"){o.label=r.datum()[0].label}var l=s.triggerHandler(t,"plotly_legendclick",o);if(l===false)return;if(n===1){e._clickTimeout=setTimeout(function(){h(r,t,n)},k)}else if(n===2){if(e._clickTimeout)clearTimeout(e._clickTimeout);t._legendMouseDownTime=0;var u=s.triggerHandler(t,"plotly_legenddoubleclick",o);if(u!==false)h(r,t,n)}}function A(t,e,r){var n=t.data()[0][0];var i=e._fullLayout;var s=n.trace;var l=o.traceIs(s,"pie");var c=s.index;var h=l?n.label:s.name;var p=e._context.edits.legendText&&!l;var d=a.ensureSingle(t,"text","legendtext");d.attr("text-anchor","start").classed("user-select-none",true).call(u.font,i.legend.font).text(p?T(h,r):h);function v(r){f.convertToTspans(r,e,function(){E(t,e)})}if(p){d.call(f.makeEditable,{gd:e,text:h}).call(v).on("edit",function(t){this.text(T(t,r)).call(v);var i=n.trace._fullInput||{};var s={};if(o.hasTransform(i,"groupby")){var l=o.getTransformIndices(i,"groupby");var u=l[l.length-1];var f=a.keyedContainer(i,"transforms["+u+"].styles","target","value.name");f.set(n.trace._group,t);s=f.constructUpdate()}else{s.name=t}return o.call("restyle",e,s,c)})}else{v(d)}}function T(t,e){var r=Math.max(4,e);if(t&&t.trim().length>=r/2)return t;t=t||"";for(var n=r-t.length;n>0;n--)t+=" ";return t}function S(t,e){var r,i=1;var o=a.ensureSingle(t,"rect","legendtoggle",function(t){t.style("cursor","pointer").attr("pointer-events","all").call(c.fill,"rgba(0,0,0,0)")});o.on("mousedown",function(){r=(new Date).getTime();if(r-e._legendMouseDownTimek){i=Math.max(i-1,1)}M(e,r,t,i,n.event)})}function E(t,e){var r=t.data()[0][0];if(!r.trace.showlegend){t.remove();return}var n=t.select("g[class*=math-group]");var a=n.node();var i=e._fullLayout.legend;var o=i.font.size*g;var s,l;if(a){var c=u.bBox(a);s=c.height;l=c.width;u.setTranslate(n,0,s/4)}else{var h=t.select(".legendtext");var p=f.lineCount(h);var d=h.node();s=o*p;l=d?u.bBox(d).width:0;var v=o*(.3+(1-p)/2);f.positionText(h,40,v)}s=Math.max(s,16)+3;r.height=s;r.width=l}function C(t,e,r){var a=t._fullLayout;var i=a.legend;var o=i.borderwidth;var s=_.isGrouped(i);var l=0;i._width=0;i._height=0;if(_.isVertical(i)){if(s){e.each(function(t,e){u.setTranslate(this,0,e*i.tracegroupgap)})}r.each(function(t){var e=t[0],r=e.height,n=e.width;u.setTranslate(this,o,5+o+i._height+r/2);i._height+=r;i._width=Math.max(i._width,n)});i._width+=45+o*2;i._height+=10+o*2;if(s){i._height+=(i._lgroupsLength-1)*i.tracegroupgap}l=40}else if(s){var c=[i._width],f=e.data();for(var h=0,p=f.length;ho+b-w;r.each(function(t){var e=t[0],r=k?40+t[0].width:y;if(o+x+w+r>a.width-(a.margin.r+a.margin.l)){x=0;g=g+m;i._height=i._height+m;m=0}u.setTranslate(this,o+x,5+o+e.height/2+g);i._width+=w+r;i._height=Math.max(i._height,e.height);x+=w+r;m=Math.max(e.height,m)});i._width+=o*2;i._height+=10+o*2}i._width=Math.ceil(i._width);i._height=Math.ceil(i._height);r.each(function(e){var r=e[0],a=n.select(this).select(".legendtoggle");u.setRect(a,0,-r.height/2,(t._context.edits.legendText?0:i._width)+l,r.height)})}function L(t){var e=t._fullLayout,r=e.legend;var n="left";if(w.isRightAnchor(r)){n="right"}else if(w.isCenterAnchor(r)){n="center"}var a="top";if(w.isBottomAnchor(r)){a="bottom"}else if(w.isMiddleAnchor(r)){a="middle"}i.autoMargin(t,"legend",{x:r.x,y:r.y,l:r._width*m[n],r:r._width*y[n],b:r._height*y[a],t:r._height*m[a]})}function I(t){var e=t._fullLayout,r=e.legend;var n="left";if(w.isRightAnchor(r)){n="right"}else if(w.isCenterAnchor(r)){n="center"}i.autoMargin(t,"legend",{x:r.x,y:.5,l:r._width*m[n],r:r._width*y[n],b:0,t:0})}},{"../../constants/alignment":656,"../../constants/interactions":660,"../../lib":684,"../../lib/events":672,"../../lib/svg_text_utils":708,"../../plots/plots":795,"../../registry":817,"../color":558,"../dragelement":580,"../drawing":583,"./anchor_utils":610,"./constants":612,"./get_legend_data":615,"./handle_click":616,"./helpers":617,"./style":619,d3:147}],615:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("./helpers");e.exports=function t(e,r){var i={},o=[],s=false,l={},u=0;var c,f;function h(t,e){if(t===""||!a.isGrouped(r)){var n="~~i"+u;o.push(n);i[n]=[[e]];u++}else if(o.indexOf(t)===-1){o.push(t);s=true;i[t]=[[e]]}else i[t].push([e])}for(c=0;cr[1])return r[1]}return o}function d(t){return t[0]}if(s||u||c){var v={};var g={};if(s){v.mc=p("marker.color",d);v.mo=p("marker.opacity",i.mean,[.2,1]);v.ms=p("marker.size",i.mean,[2,16]);v.mlc=p("marker.line.color",d);v.mlw=p("marker.line.width",i.mean,[0,5]);g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}}if(c){g.line={width:p("line.width",d,[0,10])}}if(u){v.tx="Aa";v.tp=p("textposition",d);v.ts=10;v.tc=p("textfont.color",d);v.tf=p("textfont.family",d)}f=[i.minExtend(e,v)];h=i.minExtend(a,g);h.selectedpoints=null}var m=n.select(this).select("g.legendpoints");var y=m.selectAll("path.scatterpts").data(s?f:[]);y.enter().append("path").classed("scatterpts",true).attr("transform","translate(20,0)");y.exit().remove();y.call(o.pointStyle,h,r);if(s)f[0].mrc=3;var x=m.selectAll("g.pointtext").data(u?f:[]);x.enter().append("g").classed("pointtext",true).append("text").attr("transform","translate(20,0)");x.exit().remove();x.selectAll("text").call(o.textPointStyle,h,r)}function h(t){var e=t[0].trace,r=e.marker||{},i=r.line||{},o=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(a.traceIs(e,"bar")?[t]:[]);o.enter().append("path").classed("legendbar",true).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)");o.exit().remove();o.each(function(t){var e=n.select(this),a=t[0],o=(a.mlw+1||i.width+1)-1;e.style("stroke-width",o+"px").call(s.fill,a.mc||r.color);if(o){e.call(s.stroke,a.mlc||i.color)}})}function p(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(a.traceIs(e,"box-violin")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",true).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)");r.exit().remove();r.each(function(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(s.fill,e.fillcolor);if(t){s.stroke(r,e.line.color)}})}function d(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendcandle").data(e.type==="candlestick"&&e.visible?[t,t]:[]);r.enter().append("path").classed("legendcandle",true).attr("d",function(t,e){if(e)return"M-15,0H-8M-8,6V-6H8Z";return"M15,0H8M8,-6V6H-8Z"}).attr("transform","translate(20,0)").style("stroke-miterlimit",1);r.exit().remove();r.each(function(t,r){var a=e[r?"increasing":"decreasing"];var i=a.line.width,o=n.select(this);o.style("stroke-width",i+"px").call(s.fill,a.fillcolor);if(i){s.stroke(o,a.line.color)}})}function v(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendohlc").data(e.type==="ohlc"&&e.visible?[t,t]:[]);r.enter().append("path").classed("legendohlc",true).attr("d",function(t,e){if(e)return"M-15,0H0M-8,-6V0";return"M15,0H0M8,6V0"}).attr("transform","translate(20,0)").style("stroke-miterlimit",1);r.exit().remove();r.each(function(t,r){var a=e[r?"increasing":"decreasing"];var i=a.line.width,l=n.select(this);l.style("fill","none").call(o.dashLine,a.line.dash,i);if(i){s.stroke(l,a.line.color)}})}function g(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(a.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",true).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)");r.exit().remove();if(r.size())r.call(u,t[0],e)}}},{"../../lib":684,"../../registry":817,"../../traces/pie/style_one":1001,"../../traces/scatter/subtypes":1037,"../color":558,"../drawing":583,d3:147}],620:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("../../plots/plots");var i=t("../../plots/cartesian/axis_ids");var o=t("../../lib");var s=t("../../../build/ploticon");var l=o._;var u=e.exports={};u.toImage={name:"toImage",title:function(t){var e=t._context.toImageButtonOptions||{};var r=e.format||"png";return r==="png"?l(t,"Download plot as a png"):l(t,"Download plot")},icon:s.camera,click:function(t){var e=t._context.toImageButtonOptions;var r={format:e.format||"png"};o.notifier(l(t,"Taking snapshot - this may take a few seconds"),"long");if(r.format!=="svg"&&o.isIE()){o.notifier(l(t,"IE only supports svg. Changing format to svg."),"long");r.format="svg"}["filename","width","height","scale"].forEach(function(t){if(e[t]){r[t]=e[t]}});n.call("downloadImage",t,r).then(function(e){o.notifier(l(t,"Snapshot succeeded")+" - "+e,"long")}).catch(function(){o.notifier(l(t,"Sorry, there was a problem downloading your snapshot!"),"long")})}};u.sendDataToCloud={name:"sendDataToCloud",title:function(t){return l(t,"Edit in Chart Studio")},icon:s.disk,click:function(t){a.sendDataToCloud(t)}};u.zoom2d={name:"zoom2d",title:function(t){return l(t,"Zoom")},attr:"dragmode",val:"zoom",icon:s.zoombox,click:c};u.pan2d={name:"pan2d",title:function(t){return l(t,"Pan")},attr:"dragmode",val:"pan",icon:s.pan,click:c};u.select2d={name:"select2d",title:function(t){return l(t,"Box Select")},attr:"dragmode",val:"select",icon:s.selectbox,click:c};u.lasso2d={name:"lasso2d",title:function(t){return l(t,"Lasso Select")},attr:"dragmode",val:"lasso",icon:s.lasso,click:c};u.zoomIn2d={name:"zoomIn2d",title:function(t){return l(t,"Zoom in")},attr:"zoom",val:"in",icon:s.zoom_plus,click:c};u.zoomOut2d={name:"zoomOut2d",title:function(t){return l(t,"Zoom out")},attr:"zoom",val:"out",icon:s.zoom_minus,click:c};u.autoScale2d={name:"autoScale2d",title:function(t){return l(t,"Autoscale")},attr:"zoom",val:"auto",icon:s.autoscale,click:c};u.resetScale2d={name:"resetScale2d",title:function(t){return l(t,"Reset axes")},attr:"zoom",val:"reset",icon:s.home,click:c};u.hoverClosestCartesian={name:"hoverClosestCartesian",title:function(t){return l(t,"Show closest data on hover")},attr:"hovermode",val:"closest",icon:s.tooltip_basic,gravity:"ne",click:c};u.hoverCompareCartesian={name:"hoverCompareCartesian",title:function(t){return l(t,"Compare data on hover")},attr:"hovermode",val:function(t){return t._fullLayout._isHoriz?"y":"x"},icon:s.tooltip_compare,gravity:"ne",click:c};function c(t,e){var r=e.currentTarget;var a=r.getAttribute("data-attr");var o=r.getAttribute("data-val")||true;var s=t._fullLayout;var l={};var u=i.list(t,null,true);var c="on";var f,h;if(a==="zoom"){var p=o==="in"?.5:2,d=(1+p)/2,v=(1-p)/2;var g;for(h=0;h1){_=["toggleHover"];w=["resetViews"]}else if(l){b=["zoomInGeo","zoomOutGeo"];_=["hoverClosestGeo"];w=["resetGeo"]}else if(o){_=["hoverClosest3d"];w=["resetCameraDefault3d","resetCameraLastSave3d"]}else if(v){_=["toggleHover"];w=["resetViewMapbox"]}else if(p){_=["hoverClosestGl2d"]}else if(h){_=["hoverClosestPie"]}else{_=["toggleHover"]}if(i){_=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]}if((i||p)&&!m){b=["zoomIn2d","zoomOut2d","autoScale2d"];if(w[0]!=="resetViews")w=["resetScale2d"]}if(o){k=["zoom3d","pan3d","orbitRotation","tableRotation"]}else if((i||p)&&!m||d){k=["zoom2d","pan2d"]}else if(v||l){k=["pan2d"]}else if(g){k=["zoom2d"]}if(c(a)){k.push("select2d","lasso2d")}x(k);x(b.concat(w));x(_);return f(y,r)}function u(t){var e=n.list({_fullLayout:t},null,true);for(var r=0;r0);if(y){var x=c(r,f,h);g("x",x[0]);g("y",x[1]);n.noneOrAll(e,r,["x","y"]);g("xanchor");g("yanchor");n.coerceFont(g,"font",f.font);var b=g("bgcolor");g("activecolor",a.contrast(b,l.lightAmount,l.darkAmount));g("bordercolor");g("borderwidth")}};function u(t,e,r,a){var i=a.calendar;function o(r,a){return n.coerce(t,e,s.buttons,r,a)}var l=o("visible");if(l){var u=o("step");if(u!=="all"){if(i&&i!=="gregorian"&&(u==="month"||u==="year")){e.stepmode="backward"}else{o("stepmode")}o("count")}o("label")}}function c(t,e,r){var n=r.filter(function(r){return e[r].anchor===t._id});var a=0;for(var i=0;i0?h+u:u;return{ppad:u,ppadplus:c?d:v,ppadminus:c?v:d}}else{return{ppad:u}}}function c(t,e,r,n,a){var s=t.type==="category"?t.r2c:t.d2c;if(e!==undefined)return[s(e),s(r)];if(!n)return;var l=Infinity,u=-Infinity,c=n.match(i.segmentRE),f,h,p,d,v;if(t.type==="date")s=o.decodeDate(s);for(f=0;fu)u=v}if(u>=l)return[l,u]}},{"../../lib":684,"../../plots/cartesian/axes":732,"./constants":639,"./helpers":642}],639:[function(t,e,r){"use strict";e.exports={segmentRE:/[MLHVQCTSZ][^MLHVQCTSZ]*/g,paramRE:/[^\s,]+/g,paramIsX:{M:{0:true,drawn:0},L:{0:true,drawn:0},H:{0:true,drawn:0},V:{},Q:{0:true,2:true,drawn:2},C:{0:true,2:true,4:true,drawn:4},T:{0:true,drawn:0},S:{0:true,2:true,drawn:2},Z:{}},paramIsY:{M:{1:true,drawn:1},L:{1:true,drawn:1},H:{},V:{0:true,drawn:0},Q:{1:true,3:true,drawn:3},C:{1:true,3:true,5:true,drawn:5},T:{1:true,drawn:1},S:{1:true,3:true,drawn:5},Z:{}},numParams:{M:2,L:2,H:1,V:1,Q:4,C:6,T:2,S:4,Z:0}}},{}],640:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("../../plots/cartesian/axes");var i=t("../../plots/array_container_defaults");var o=t("./attributes");var s=t("./helpers");e.exports=function t(e,r){i(e,r,{name:"shapes",handleItemDefaults:l})};function l(t,e,r){function i(r,a){return n.coerce(t,e,o,r,a)}var l=i("visible");if(!l)return;i("layer");i("opacity");i("fillcolor");i("line.color");i("line.width");i("line.dash");var u=t.path?"path":"rect",c=i("type",u),f=i("xsizemode"),h=i("ysizemode");var p=["x","y"];for(var d=0;d<2;d++){var v=p[d],g=v+"anchor",m=v==="x"?f:h,y={_fullLayout:r},x,b,_;var w=a.coerceRef(t,e,y,v,"","paper");if(w!=="paper"){x=a.getFromId(y,w);_=s.rangeToShapePosition(x);b=s.shapePositionToRange(x)}else{b=_=n.identity}if(c!=="path"){var k=.25,M=.75;var A=v+"0",T=v+"1",S=t[A],E=t[T];t[A]=b(t[A],true);t[T]=b(t[T],true);if(m==="pixel"){i(A,0);i(T,10)}else{a.coercePosition(e,y,i,w,A,k);a.coercePosition(e,y,i,w,T,M)}e[A]=_(e[A]);e[T]=_(e[T]);t[A]=S;t[T]=E}if(m==="pixel"){var C=t[g];t[g]=b(t[g],true);a.coercePosition(e,y,i,w,g,.25);e[g]=_(e[g]);t[g]=C}}if(c==="path"){i("path")}else{n.noneOrAll(t,e,["x0","x1","y0","y1"])}}},{"../../lib":684,"../../plots/array_container_defaults":728,"../../plots/cartesian/axes":732,"./attributes":637,"./helpers":642}],641:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("../../lib");var i=t("../../plots/cartesian/axes");var o=t("../color");var s=t("../drawing");var l=t("../../plot_api/plot_template").arrayEditor;var u=t("../dragelement");var c=t("../../lib/setcursor");var f=t("./constants");var h=t("./helpers");e.exports={draw:p,drawOne:d};function p(t){var e=t._fullLayout;e._shapeUpperLayer.selectAll("path").remove();e._shapeLowerLayer.selectAll("path").remove();for(var r in e._plots){var n=e._plots[r].shapelayer;if(n)n.selectAll("path").remove()}for(var a=0;at?n/2:t;a.append("circle").attr({"data-line-point":"start-point",cx:y?U(r.xanchor)+r.x0:U(r.x0),cy:b?q(r.yanchor)-r.y0:q(r.y0),r:s}).style(i).classed("cursor-grab",true);a.append("circle").attr({"data-line-point":"end-point",cx:y?U(r.xanchor)+r.x1:U(r.x1),cy:b?q(r.yanchor)-r.y1:q(r.y1),r:s}).style(i).classed("cursor-grab",true);return a}function J(t){if(_){if(t.target.tagName==="path"){X="move"}else{X=t.target.attributes["data-line-point"].value==="start-point"?"resize-over-start-point":"resize-over-end-point"}}else{var r=Y.element.getBoundingClientRect();var n=r.right-r.left,a=r.bottom-r.top,i=t.clientX-r.left,o=t.clientY-r.top,s=!w&&n>d&&a>g&&!t.shiftKey?u.getCursor(i/n,1-o/a):"move";c(e,s);X=s.split("-")[0]}}function K(n){if(y){C=U(r.xanchor)}if(b){L=q(r.yanchor)}if(r.type==="path"){N=r.path}else{A=y?r.x0:U(r.x0);T=b?r.y0:q(r.y0);S=y?r.x1:U(r.x1);E=b?r.y1:q(r.y1)}if(AE){I=T;D="y0";z=E;R="y1"}else{I=E;D="y1";z=T;R="y0"}J(n);nt(p,r);it(e,r,t);Y.moveFn=X==="move"?et:rt}function Q(){c(e);at(p);v(e,t,r);n.call("relayout",t,k.getUpdateObj())}function tt(){at(p)}function et(n,a){if(r.type==="path"){var i=function(t){return t},o=i,s=i;if(y){M("xanchor",r.xanchor=H(C+n))}else{o=function t(e){return H(U(e)+n)};if(j&&j.type==="date")o=h.encodeDate(o)}if(b){M("yanchor",r.yanchor=G(L+a))}else{s=function t(e){return G(q(e)+a)};if(V&&V.type==="date")s=h.encodeDate(s)}M("path",r.path=x(N,o,s))}else{if(y){M("xanchor",r.xanchor=H(C+n))}else{M("x0",r.x0=H(A+n));M("x1",r.x1=H(S+n))}if(b){M("yanchor",r.yanchor=G(L+a))}else{M("y0",r.y0=G(T+a));M("y1",r.y1=G(E+a))}}e.attr("d",m(t,r));nt(p,r)}function rt(n,a){if(w){var i=function(t){return t},o=i,s=i;if(y){M("xanchor",r.xanchor=H(C+n))}else{o=function t(e){return H(U(e)+n)};if(j&&j.type==="date")o=h.encodeDate(o)}if(b){M("yanchor",r.yanchor=G(L+a))}else{s=function t(e){return G(q(e)+a)};if(V&&V.type==="date")s=h.encodeDate(s)}M("path",r.path=x(N,o,s))}else if(_){if(X==="resize-over-start-point"){var l=A+n;var u=b?T-a:T+a;M("x0",r.x0=y?l:H(l));M("y0",r.y0=b?u:G(u))}else if(X==="resize-over-end-point"){var c=S+n;var f=b?E-a:E+a;M("x1",r.x1=y?c:H(c));M("y1",r.y1=b?f:G(f))}}else{var v=~X.indexOf("n")?I+a:I,k=~X.indexOf("s")?z+a:z,W=~X.indexOf("w")?P+n:P,Y=~X.indexOf("e")?O+n:O;if(~X.indexOf("n")&&b)v=I-a;if(~X.indexOf("s")&&b)k=z-a;if(!b&&k-v>g||b&&v-k>g){M(D,r[D]=b?v:G(v));M(R,r[R]=b?k:G(k))}if(Y-W>d){M(B,r[B]=y?W:H(W));M(F,r[F]=y?Y:H(Y))}}e.attr("d",m(t,r));nt(p,r)}function nt(t,e){if(y||b){r()}function r(){var r=e.type!=="path";var n=t.selectAll(".visual-cue").data([0]);var i=1;n.enter().append("path").attr({fill:"#fff","fill-rule":"evenodd",stroke:"#000","stroke-width":i}).classed("visual-cue",true);var o=U(y?e.xanchor:a.midRange(r?[e.x0,e.x1]:h.extractPathCoords(e.path,f.paramIsX)));var s=q(b?e.yanchor:a.midRange(r?[e.y0,e.y1]:h.extractPathCoords(e.path,f.paramIsY)));o=h.roundPositionForSharpStrokeRendering(o,i);s=h.roundPositionForSharpStrokeRendering(s,i);if(y&&b){var l="M"+(o-1-i)+","+(s-1-i)+"h-8v2h8 v8h2v-8 h8v-2h-8 v-8h-2 Z";n.attr("d",l)}else if(y){var u="M"+(o-1-i)+","+(s-9-i)+"v18 h2 v-18 Z";n.attr("d",u)}else{var c="M"+(o-9-i)+","+(s-1-i)+"h18 v2 h-18 Z";n.attr("d",c)}}}function at(t){t.selectAll(".visual-cue").remove()}function it(t,e,r){var n=e.xref,a=e.yref,o=i.getFromId(r,n),l=i.getFromId(r,a);var u="";if(n!=="paper"&&!o.autorange)u+=n;if(a!=="paper"&&!l.autorange)u+=a;t.call(s.setClipUrl,u?"clip"+r._fullLayout._uid+u:null)}}function m(t,e){var r=e.type,n=i.getFromId(t,e.xref),a=i.getFromId(t,e.yref),o=t._fullLayout._size,s,l,u,c,f,p,d,v;if(n){s=h.shapePositionToRange(n);l=function(t){return n._offset+n.r2p(s(t,true))}}else{l=function(t){return o.l+o.w*t}}if(a){u=h.shapePositionToRange(a);c=function(t){return a._offset+a.r2p(u(t,true))}}else{c=function(t){return o.t+o.h*(1-t)}}if(r==="path"){if(n&&n.type==="date")l=h.decodeDate(l);if(a&&a.type==="date")c=h.decodeDate(c);return y(e,l,c)}if(e.xsizemode==="pixel"){var g=l(e.xanchor);f=g+e.x0;p=g+e.x1}else{f=l(e.x0);p=l(e.x1)}if(e.ysizemode==="pixel"){var m=c(e.yanchor);d=m-e.y0;v=m-e.y1}else{d=c(e.y0);v=c(e.y1)}if(r==="line")return"M"+f+","+d+"L"+p+","+v;if(r==="rect")return"M"+f+","+d+"H"+p+"V"+v+"H"+f+"Z";var x=(f+p)/2,b=(d+v)/2,_=Math.abs(x-f),w=Math.abs(b-d),k="A"+_+","+w,M=x+_+","+b,A=x+","+(b-w);return"M"+M+k+" 0 1,1 "+A+k+" 0 0,1 "+M+"Z"}function y(t,e,r){var n=t.path,i=t.xsizemode,o=t.ysizemode,s=t.xanchor,l=t.yanchor;return n.replace(f.segmentRE,function(t){var n=0,u=t.charAt(0),c=f.paramIsX[u],h=f.paramIsY[u],p=f.numParams[u];var d=t.substr(1).replace(f.paramRE,function(t){if(c[n]){if(i==="pixel")t=e(s)+Number(t);else t=e(t)}else if(h[n]){if(o==="pixel")t=r(l)-Number(t);else t=r(t)}n++;if(n>p)t="X";return t});if(n>p){d=d.replace(/[\s,]*X.*/,"");a.log("Ignoring extra params in segment "+t)}return u+d})}function x(t,e,r){return t.replace(f.segmentRE,function(t){var n=0,a=t.charAt(0),i=f.paramIsX[a],o=f.paramIsY[a],s=f.numParams[a];var l=t.substr(1).replace(f.paramRE,function(t){if(n>=s)return t;if(i[n])t=e(t);else if(o[n])t=r(t);n++;return t});return a+l})}},{"../../lib":684,"../../lib/setcursor":704,"../../plot_api/plot_template":722,"../../plots/cartesian/axes":732,"../../registry":817,"../color":558,"../dragelement":580,"../drawing":583,"./constants":639,"./helpers":642}],642:[function(t,e,r){"use strict";var n=t("./constants");var a=t("../../lib");r.rangeToShapePosition=function(t){return t.type==="log"?t.r2d:function(t){return t}};r.shapePositionToRange=function(t){return t.type==="log"?t.d2r:function(t){return t}};r.decodeDate=function(t){return function(e){if(e.replace)e=e.replace("_"," ");return t(e)}};r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}};r.extractPathCoords=function(t,e){var r=[];var i=t.match(n.segmentRE);i.forEach(function(t){var i=e[t.charAt(0)].drawn;if(i===undefined)return;var o=t.substr(1).match(n.paramRE);if(!o||o.length0?[0]:[]);o.enter().append("g").classed(f.containerClassName,true).style("cursor","ew-resize");function s(t){if(t._commandObserver){t._commandObserver.remove();delete t._commandObserver}a.autoMargin(e,g(t))}o.exit().each(function(){n.select(this).selectAll("g."+f.groupClassName).each(s)}).remove();if(i.length===0)return;var l=o.selectAll("g."+f.groupClassName).data(i,y);l.enter().append("g").classed(f.groupClassName,true);l.exit().each(s).remove();for(var u=0;u0){s=s.transition().duration(e.transition.duration).ease(e.transition.easing)}s.attr("transform","translate("+(o-f.gripWidth*.5)+","+e._dims.currentValueTotalHeight+")")}function I(t,e){var r=t._dims;return r.inputAreaStart+f.stepInset+(r.inputAreaLength-2*f.stepInset)*Math.min(1,Math.max(0,e))}function z(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-f.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*f.stepInset-2*r.inputAreaStart)))}function P(t,e,r){var n=r._dims;var a=s.ensureSingle(t,"rect",f.railTouchRectClass,function(n){n.call(S,e,t,r).style("pointer-events","all")});a.attr({width:n.inputAreaLength,height:Math.max(n.inputAreaWidth,f.tickOffset+r.ticklen+n.labelHeight)}).call(i.fill,r.bgcolor).attr("opacity",0);o.setTranslate(a,0,n.currentValueTotalHeight)}function O(t,e){var r=e._dims;var n=r.inputAreaLength-f.railInset*2;var a=s.ensureSingle(t,"rect",f.railRectClass);a.attr({width:n,height:f.railWidth,rx:f.railRadius,ry:f.railRadius,"shape-rendering":"crispEdges"}).call(i.stroke,e.bordercolor).call(i.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px");o.setTranslate(a,f.railInset,(r.inputAreaWidth-f.railWidth)*.5+r.currentValueTotalHeight)}},{"../../constants/alignment":656,"../../lib":684,"../../lib/svg_text_utils":708,"../../plot_api/plot_template":722,"../../plots/plots":795,"../color":558,"../drawing":583,"../legend/anchor_utils":610,"./constants":645,d3:147}],648:[function(t,e,r){"use strict";var n=t("./constants");e.exports={moduleType:"component",name:n.name,layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),draw:t("./draw")}},{"./attributes":644,"./constants":645,"./defaults":646,"./draw":647}],649:[function(t,e,r){"use strict";var n=t("d3");var a=t("fast-isnumeric");var i=t("../../plots/plots");var o=t("../../registry");var s=t("../../lib");var l=t("../drawing");var u=t("../color");var c=t("../../lib/svg_text_utils");var f=t("../../constants/interactions");e.exports={draw:p};var h=/ [XY][0-9]* /;function p(t,e,r){var p=r.propContainer;var d=r.propName;var v=r.placeholder;var g=r.traceIndex;var m=r.avoid||{};var y=r.attributes;var x=r.transform;var b=r.containerGroup;var _=t._fullLayout;var w=p.titlefont||{};var k=w.family;var M=w.size;var A=w.color;var T=1;var S=false;var E=(p.title||"").trim();var C;if(d==="title")C="titleText";else if(d.indexOf("axis")!==-1)C="axisTitleText";else if(d.indexOf("colorbar"!==-1))C="colorbarTitleText";var L=t._context.edits[C];if(E==="")T=0;else if(E.replace(h," % ")===v.replace(h," % ")){T=.2;S=true;if(!L)E=""}var I=E||L;if(!b){b=s.ensureSingle(_._infolayer,"g","g-"+e)}var z=b.selectAll("text").data(I?[0]:[]);z.enter().append("text");z.text(E).attr("class",e);z.exit().remove();if(!I)return b;function P(t){s.syncOrAsync([O,D],t)}function O(e){var r;if(x){r="";if(x.rotate){r+="rotate("+[x.rotate,y.x,y.y]+")"}if(x.offset){r+="translate(0, "+x.offset+")"}}else{r=null}e.attr("transform",r);e.style({"font-family":k,"font-size":n.round(M,2)+"px",fill:u.rgb(A),opacity:T*u.opacity(A),"font-weight":i.fontWeight}).attr(y).call(c.convertToTspans,t);return i.previousPromises(t)}function D(t){var e=n.select(t.node().parentNode);if(m&&m.selection&&m.side&&E){e.attr("transform",null);var r=0;var i={left:"right",right:"left",top:"bottom",bottom:"top"}[m.side];var o=["left","top"].indexOf(m.side)!==-1?-1:1;var u=a(m.pad)?m.pad:2;var c=l.bBox(e.node());var f={left:0,top:0,right:_.width,bottom:_.height};var h=m.maxShift||(f[m.side]-c[m.side])*(m.side==="left"||m.side==="top"?-1:1);if(h<0)r=h;else{var p=m.offsetLeft||0;var d=m.offsetTop||0;c.left-=p;c.right-=p;c.top-=d;c.bottom-=d;m.selection.each(function(){var t=l.bBox(this);if(s.bBoxIntersect(c,t,u)){r=Math.max(r,o*(t[m.side]-c[i])+u)}});r=Math.min(h,r)}if(r>0||h<0){var v={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[m.side];e.attr("transform","translate("+v+")")}}}z.call(P);function R(){T=0;S=true;z.text(v).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})}if(L){if(!E)R();else z.on(".opacity",null);z.call(c.makeEditable,{gd:t}).on("edit",function(e){if(g!==undefined){o.call("restyle",t,d,e,g)}else{o.call("relayout",t,d,e)}}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(P)}).on("input",function(t){this.text(t||" ").call(c.positionText,y.x,y.y)})}z.classed("js-placeholder",S);return b}},{"../../constants/interactions":660,"../../lib":684,"../../lib/svg_text_utils":708,"../../plots/plots":795,"../../registry":817,"../color":558,"../drawing":583,d3:147,"fast-isnumeric":214}],650:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes");var a=t("../color/attributes");var i=t("../../lib/extend").extendFlat;var o=t("../../plot_api/edit_types").overrideAll;var s=t("../../plots/pad_attributes");var l=t("../../plot_api/plot_template").templatedArray;var u=l("button",{visible:{valType:"boolean"},method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:true,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:true}});e.exports=o(l("updatemenu",{_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:true},buttons:u,x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},pad:i({},s,{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:a.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}}),"arraydraw","from-root")},{"../../lib/extend":673,"../../plot_api/edit_types":715,"../../plot_api/plot_template":722,"../../plots/font_attributes":758,"../../plots/pad_attributes":794,"../color/attributes":557}],651:[function(t,e,r){"use strict";e.exports={name:"updatemenus",containerClassName:"updatemenu-container",headerGroupClassName:"updatemenu-header-group",headerClassName:"updatemenu-header",headerArrowClassName:"updatemenu-header-arrow",dropdownButtonGroupClassName:"updatemenu-dropdown-button-group",dropdownButtonClassName:"updatemenu-dropdown-button",buttonClassName:"updatemenu-button",itemRectClassName:"updatemenu-item-rect",itemTextClassName:"updatemenu-item-text",menuIndexAttrName:"updatemenu-active-index",autoMarginIdRoot:"updatemenu-",blankHeaderOpts:{label:" "},minWidth:30,minHeight:30,textPadX:24,arrowPadX:16,rx:2,ry:2,textOffsetX:12,textOffsetY:3,arrowOffsetX:4,gapButtonHeader:5,gapButton:2,activeColor:"#F4FAFF",hoverColor:"#F4FAFF",arrowSymbol:{left:"\u25c4",right:"\u25ba",up:"\u25b2",down:"\u25bc"}}},{}],652:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("../../plots/array_container_defaults");var i=t("./attributes");var o=t("./constants");var s=o.name;var l=i.buttons;e.exports=function t(e,r){var n={name:s,handleItemDefaults:u};a(e,r,n)};function u(t,e,r){function o(r,a){return n.coerce(t,e,i,r,a)}var s=a(t,e,{name:"buttons",handleItemDefaults:c});var l=o("visible",s.length>0);if(!l)return;o("active");o("direction");o("type");o("showactive");o("x");o("y");n.noneOrAll(t,e,["x","y"]);o("xanchor");o("yanchor");o("pad.t");o("pad.r");o("pad.b");o("pad.l");n.coerceFont(o,"font",r.font);o("bgcolor",r.paper_bgcolor);o("bordercolor");o("borderwidth")}function c(t,e){function r(r,a){return n.coerce(t,e,l,r,a)}var a=r("visible",t.method==="skip"||Array.isArray(t.args));if(a){r("method");r("args");r("label");r("execute")}}},{"../../lib":684,"../../plots/array_container_defaults":728,"./attributes":650,"./constants":651}],653:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../plots/plots");var i=t("../color");var o=t("../drawing");var s=t("../../lib");var l=t("../../lib/svg_text_utils");var u=t("../legend/anchor_utils");var c=t("../../plot_api/plot_template").arrayEditor;var f=t("../../constants/alignment").LINE_SPACING;var h=t("./constants");var p=t("./scrollbox");e.exports=function t(e){var r=e._fullLayout,i=s.filterVisible(r[h.name]);function o(t){a.autoMargin(e,C(t))}var l=r._menulayer.selectAll("g."+h.containerClassName).data(i.length>0?[0]:[]);l.enter().append("g").classed(h.containerClassName,true).style("cursor","pointer");l.exit().each(function(){n.select(this).selectAll("g."+h.headerGroupClassName).each(o)}).remove();if(i.length===0)return;var u=l.selectAll("g."+h.headerGroupClassName).data(i,d);u.enter().append("g").classed(h.headerGroupClassName,true);var c=s.ensureSingle(l,"g",h.dropdownButtonGroupClassName,function(t){t.style("pointer-events","all")});for(var f=0;fb,E=s.barLength+2*s.barPad,C=s.barWidth+2*s.barPad,L=f,I=p+d;if(I+C>c)I=c-C;var z=this.container.selectAll("rect.scrollbar-horizontal").data(S?[0]:[]);z.exit().on(".drag",null).remove();z.enter().append("rect").classed("scrollbar-horizontal",true).call(a.fill,s.barColor);if(S){this.hbar=z.attr({rx:s.barRadius,ry:s.barRadius,x:L,y:I,width:E,height:C});this._hbarXMin=L+E/2;this._hbarTranslateMax=b-E}else{delete this.hbar;delete this._hbarXMin;delete this._hbarTranslateMax}var P=d>_,O=s.barWidth+2*s.barPad,D=s.barLength+2*s.barPad,R=f+h,B=p;if(R+O>u)R=u-O;var F=this.container.selectAll("rect.scrollbar-vertical").data(P?[0]:[]);F.exit().on(".drag",null).remove();F.enter().append("rect").classed("scrollbar-vertical",true).call(a.fill,s.barColor);if(P){this.vbar=F.attr({rx:s.barRadius,ry:s.barRadius,x:R,y:B,width:O,height:D});this._vbarYMin=B+D/2;this._vbarTranslateMax=_-D}else{delete this.vbar;delete this._vbarYMin;delete this._vbarTranslateMax}var N=this.id,j=w-.5,V=P?k+O+.5:k+.5,U=M-.5,q=S?A+C+.5:A+.5;var H=l._topdefs.selectAll("#"+N).data(S||P?[0]:[]);H.exit().remove();H.enter().append("clipPath").attr("id",N).append("rect");if(S||P){this._clipRect=H.select("rect").attr({x:Math.floor(j),y:Math.floor(U),width:Math.ceil(V)-Math.floor(j),height:Math.ceil(q)-Math.floor(U)});this.container.call(i.setClipUrl,N);this.bg.attr({x:f,y:p,width:h,height:d})}else{this.bg.attr({width:0,height:0});this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null);delete this._clipRect}if(S||P){var G=n.behavior.drag().on("dragstart",function(){n.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(G);var W=n.behavior.drag().on("dragstart",function(){n.event.sourceEvent.preventDefault();n.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));if(S){this.hbar.on(".drag",null).call(W)}if(P){this.vbar.on(".drag",null).call(W)}}this.setTranslate(r,o)};s.prototype.disable=function t(){if(this.hbar||this.vbar){this.bg.attr({width:0,height:0});this.container.on("wheel",null).on(".drag",null).call(i.setClipUrl,null);delete this._clipRect}if(this.hbar){this.hbar.on(".drag",null);this.hbar.remove();delete this.hbar;delete this._hbarXMin;delete this._hbarTranslateMax}if(this.vbar){this.vbar.on(".drag",null);this.vbar.remove();delete this.vbar;delete this._vbarYMin;delete this._vbarTranslateMax}};s.prototype._onBoxDrag=function t(){var e=this.translateX,r=this.translateY;if(this.hbar){e-=n.event.dx}if(this.vbar){r-=n.event.dy}this.setTranslate(e,r)};s.prototype._onBoxWheel=function t(){var e=this.translateX,r=this.translateY;if(this.hbar){e+=n.event.deltaY}if(this.vbar){r+=n.event.deltaY}this.setTranslate(e,r)};s.prototype._onBarDrag=function t(){var e=this.translateX,r=this.translateY;if(this.hbar){var a=e+this._hbarXMin,i=a+this._hbarTranslateMax,s=o.constrain(n.event.x,a,i),l=(s-a)/(i-a);var u=this.position.w-this._box.w;e=l*u}if(this.vbar){var c=r+this._vbarYMin,f=c+this._vbarTranslateMax,h=o.constrain(n.event.y,c,f),p=(h-c)/(f-c);var d=this.position.h-this._box.h;r=p*d}this.setTranslate(e,r)};s.prototype.setTranslate=function t(e,r){var n=this.position.w-this._box.w,a=this.position.h-this._box.h;e=o.constrain(e||0,0,n);r=o.constrain(r||0,0,a);this.translateX=e;this.translateY=r;this.container.call(i.setTranslate,this._box.l-this.position.l-e,this._box.t-this.position.t-r);if(this._clipRect){this._clipRect.attr({x:Math.floor(this.position.l+e-.5),y:Math.floor(this.position.t+r-.5)})}if(this.hbar){var s=e/n;this.hbar.call(i.setTranslate,e+s*this._hbarTranslateMax,r)}if(this.vbar){var l=r/a;this.vbar.call(i.setTranslate,e,r+l*this._vbarTranslateMax)}}},{"../../lib":684,"../color":558,"../drawing":583,d3:147}],656:[function(t,e,r){"use strict";e.exports={FROM_BL:{left:0,center:.5,right:1,bottom:0,middle:.5,top:1},FROM_TL:{left:0,center:.5,right:1,bottom:1,middle:.5,top:0},FROM_BR:{left:1,center:.5,right:0,bottom:0,middle:.5,top:1},LINE_SPACING:1.3,MID_SHIFT:.35,OPPOSITE_SIDE:{left:"right",right:"left",top:"bottom",bottom:"top"}}},{}],657:[function(t,e,r){"use strict";e.exports={COMPARISON_OPS:["=","!=","<",">=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}}},{}],658:[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]}},{}],659:[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"}},{}],660:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],661:[function(t,e,r){"use strict";e.exports={BADNUM:undefined,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6,MINUS_SIGN:"\u2212"}},{}],662:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],663:[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}},{}],664:[function(t,e,r){"use strict";r.version="1.39.1";t("es6-promise").polyfill();t("../build/plotcss");t("./fonts/mathjax_config");var n=t("./registry");var a=r.register=n.register;var i=t("./plot_api");var o=Object.keys(i);for(var s=0;s180)t-=Math.round(t/360)*360;return t}},{}],667:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("../constants/numerical").BADNUM;var i=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function t(e){if(typeof e==="string"){e=e.replace(i,"")}if(n(e))return Number(e);return a}},{"../constants/numerical":661,"fast-isnumeric":214}],668:[function(t,e,r){"use strict";e.exports=function t(e){var r=e._fullLayout;if(r._glcanvas&&r._glcanvas.size()){r._glcanvas.each(function(t){if(t.regl)t.regl.clear({color:true,depth:true})})}}},{}],669:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("tinycolor2");var i=t("../plots/attributes");var o=t("../components/colorscale/get_scale");var s=Object.keys(t("../components/colorscale/scales"));var l=t("./nested_property");var u=t("./regex").counter;var c=t("../constants/interactions").DESELECTDIM;var f=t("./angles").wrap180;var h=t("./is_array").isArrayOrTypedArray;r.valObjectMeta={data_array:{coerceFunction:function(t,e,r){if(h(t))e.set(t);else if(r!==undefined)e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){if(n.coerceNumber)t=+t;if(n.values.indexOf(t)===-1)e.set(r);else e.set(t)},validateFunction:function(t,e){if(e.coerceNumber)t=+t;var r=e.values;for(var n=0;na.max){e.set(r)}else e.set(+t)}},integer:{coerceFunction:function(t,e,r,a){if(t%1||!n(t)||a.min!==undefined&&ta.max){e.set(r)}else e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if(typeof t!=="string"){var a=typeof t==="number";if(n.strict===true||!a)e.set(r);else e.set(String(t))}else if(n.noBlank&&!t)e.set(r);else e.set(t)}},color:{coerceFunction:function(t,e,r){if(a(t).isValid())e.set(t);else e.set(r)}},colorlist:{coerceFunction:function(t,e,r){function n(t){return a(t).isValid()}if(!Array.isArray(t)||!t.length)e.set(r);else if(t.every(n))e.set(t);else e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(o(t,r))}},angle:{coerceFunction:function(t,e,r){if(t==="auto")e.set("auto");else if(!n(t))e.set(r);else e.set(f(+t))}},subplotid:{coerceFunction:function(t,e,r,n){var a=n.regex||u(r);if(typeof t==="string"&&a.test(t)){e.set(t);return}e.set(r)},validateFunction:function(t,e){var r=e.dflt;if(t===r)return true;if(typeof t!=="string")return false;if(u(r).test(t))return true;return false}},flaglist:{coerceFunction:function(t,e,r,n){if(typeof t!=="string"){e.set(r);return}if((n.extras||[]).indexOf(t)!==-1){e.set(t);return}var a=t.split("+"),i=0;while(i=b&&t<=_)return t;return l}if(typeof t!=="string"&&typeof t!=="number")return l;t=String(t);var s=x(e);var v=t.charAt(0);if(s&&(v==="G"||v==="g")){t=t.substr(1);e=""}var w=s&&e.substr(0,7)==="chinese";var k=t.match(w?m:g);if(!k)return l;var M=k[1],A=k[3]||"1",T=Number(k[5]||1),S=Number(k[7]||0),E=Number(k[9]||0),C=Number(k[11]||0);if(s){if(M.length===2)return l;M=Number(M);var L;try{var I=d.getComponentMethod("calendars","getCal")(e);if(w){var z=A.charAt(A.length-1)==="i";A=parseInt(A,10);L=I.newDate(M,I.toMonthIndex(M,A,z),T)}else{L=I.newDate(M,Number(A),T)}}catch(t){return l}if(!L)return l;return(L.toJD()-p)*u+S*c+E*f+C*h}if(M.length===2){M=(Number(M)+2e3-y)%100+y}else M=Number(M);A-=1;var P=new Date(Date.UTC(2e3,A,T,S,E));P.setUTCFullYear(M);if(P.getUTCMonth()!==A)return l;if(P.getUTCDate()!==T)return l;return P.getTime()+C*h};b=r.MIN_MS=r.dateTime2ms("-9999");_=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999");r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==l};function w(t,e){return String(t+Math.pow(10,e)).substr(1)}var k=90*u;var M=3*c;var A=5*f;r.ms2DateTime=function(t,e,r){if(typeof t!=="number"||!(t>=b&&t<=_))return l;if(!e)e=0;var n=Math.floor(o(t+.05,1)*10),a=Math.round(t-n/10),i,s,g,m,y,w;if(x(r)){var S=Math.floor(a/u)+p,E=Math.floor(o(t,u));try{i=d.getComponentMethod("calendars","getCal")(r).fromJD(S).formatDate("yyyy-mm-dd")}catch(t){i=v("G%Y-%m-%d")(new Date(a))}if(i.charAt(0)==="-"){while(i.length<11)i="-0"+i.substr(1)}else{while(i.length<10)i="0"+i}s=e=b+u&&t<=_-u))return l;var e=Math.floor(o(t+.05,1)*10),r=new Date(Math.round(t-e/10)),a=n.time.format("%Y-%m-%d")(r),i=r.getHours(),s=r.getMinutes(),c=r.getSeconds(),f=r.getUTCMilliseconds()*10+e;return T(a,i,s,c,f)};function T(t,e,r,n,a){if(e||r||n||a){t+=" "+w(e,2)+":"+w(r,2);if(n||a){t+=":"+w(n,2);if(a){var i=4;while(a%10===0){i-=1;a/=10}t+="."+w(a,i)}}}return t}r.cleanDate=function(t,e,n){if(r.isJSDate(t)||typeof t==="number"){if(x(n)){i.error("JS Dates and milliseconds are incompatible with world calendars",t);return e}t=r.ms2DateTimeLocal(+t);if(!t&&e!==undefined)return e}else if(!r.isDateTime(t,n)){i.error("unrecognized date",t);return e}return t};var S=/%\d?f/g;function E(t,e,r,n){t=t.replace(S,function(t){var r=Math.min(+t.charAt(1)||6,6),n=(e/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0";return n});var a=new Date(Math.floor(e+.05));if(x(n)){try{t=d.getComponentMethod("calendars","worldCalFmt")(t,e,n)}catch(t){return"Invalid"}}return r(t)(a)}var C=[59,59.9,59.99,59.999,59.9999];function L(t,e){var r=o(t+.05,u);var n=w(Math.floor(r/c),2)+":"+w(o(Math.floor(r/f),60),2);if(e!=="M"){if(!a(e))e=0;var i=Math.min(o(t/h,60),C[e]);var s=(100+i).toFixed(e).substr(1);if(e>0){s=s.replace(/0+$/,"").replace(/[\.]$/,"")}n+=":"+s}return n}r.formatDate=function(t,e,r,n,a,i){a=x(a)&&a;if(!e){if(r==="y")e=i.year;else if(r==="m")e=i.month;else if(r==="d"){e=i.dayMonth+"\n"+i.year}else{return L(t,r)+"\n"+E(i.dayMonthYear,t,n,a)}}return E(e,t,n,a)};var I=3*u;r.incrementMonth=function(t,e,r){r=x(r)&&r;var n=o(t,u);t=Math.round(t-n);if(r){try{var a=Math.round(t/u)+p,s=d.getComponentMethod("calendars","getCal")(r),l=s.fromJD(a);if(e%12)s.add(l,e,"m");else s.add(l,e/12,"y");return(l.toJD()-p)*u+n}catch(e){i.error("invalid ms "+t+" in calendar "+r)}}var c=new Date(t+I);return c.setUTCMonth(c.getUTCMonth()+e)+n-I};r.findExactDates=function(t,e){var r=0,n=0,i=0,o=0,s,l;var c=x(e)&&d.getComponentMethod("calendars","getCal")(e);for(var f=0;f0){a.push(i);i=[]}}if(i.length>0){a.push(i)}return a};r.makeLine=function(t){if(t.length===1){return{type:"LineString",coordinates:t[0]}}else{return{type:"MultiLineString",coordinates:t}}};r.makePolygon=function(t){if(t.length===1){return{type:"Polygon",coordinates:t}}else{var e=new Array(t.length);for(var r=0;r1||v<0||v>1)return null;return{x:t+l*v,y:e+f*v}}r.segmentDistance=function t(e,r,n,o,s,l,u,c){if(a(e,r,n,o,s,l,u,c))return 0;var f=n-e;var h=o-r;var p=u-s;var d=c-l;var v=f*f+h*h;var g=p*p+d*d;var m=Math.min(i(f,h,v,s-e,l-r),i(f,h,v,u-e,c-r),i(p,d,g,e-s,r-l),i(p,d,g,n-s,o-l));return Math.sqrt(m)};function i(t,e,r,n,a){var i=n*t+a*e;if(i<0){return n*n+a*a}else if(i>r){var o=n-t;var s=a-e;return o*o+s*s}else{var l=n*e-a*t;return l*l/r}}var o,s,l;r.getTextLocation=function t(e,r,a,i){if(e!==s||i!==l){o={};s=e;l=i}if(o[a]){return o[a]}var u=e.getPointAtLength(n(a-i/2,r));var c=e.getPointAtLength(n(a+i/2,r));var f=Math.atan((c.y-u.y)/(c.x-u.x));var h=e.getPointAtLength(n(a,r));var p=(h.x*4+u.x+c.x)/6;var d=(h.y*4+u.y+c.y)/6;var v={x:p,y:d,theta:f};o[a]=v;return v};r.clearLocationCache=function(){s=null};r.getVisibleSegment=function t(e,r,n){var a=r.left;var i=r.right;var o=r.top;var s=r.bottom;var l=0;var u=e.getTotalLength();var c=u;var f,h;function p(t){var r=e.getPointAtLength(t);if(t===0)f=r;else if(t===u)h=r;var n=r.xi?r.x-i:0;var l=r.ys?r.y-s:0;return Math.sqrt(n*n+l*l)}var d=p(l);while(d){l+=d+n;if(l>c)return;d=p(l)}d=p(c);while(d){c-=d+n;if(l>c)return;d=p(c)}return{min:l,max:c,len:c-l,total:u,isClosed:l===0&&c===u&&Math.abs(f.x-h.x)<.1&&Math.abs(f.y-h.y)<.1}};r.findPointOnPath=function t(e,r,n,a){a=a||{};var i=a.pathLength||e.getTotalLength();var o=a.tolerance||.001;var s=a.iterationLimit||30;var l=e.getPointAtLength(0)[n]>e.getPointAtLength(i)[n]?-1:1;var u=0;var c=0;var f=i;var h;var p;var d;while(u0){f=h}else{c=h}u++}}return p}},{"./mod":691}],679:[function(t,e,r){"use strict";e.exports=function(t){var e;if(typeof t==="string"){e=document.getElementById(t);if(e===null){throw new Error("No DOM element with id '"+t+"' exists on the page.")}return e}else if(t===null||t===undefined){throw new Error("DOM element provided is null or undefined")}return t}},{}],680:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("tinycolor2");var i=t("color-normalize");var o=t("../components/colorscale");var s=t("../components/color/attributes").defaultLine;var l=t("./is_array").isArrayOrTypedArray;var u=i(s);var c=1;function f(t,e){var r=t;r[3]*=e;return r}function h(t){if(n(t))return u;var e=i(t);return e.length?e:u}function p(t){return n(t)?t:c}function d(t,e,r){var n=t.color;var a=l(n);var s=l(e);var d=[];var v,g,m,y,x;if(t.colorscale!==undefined){v=o.makeColorScaleFunc(o.extractScale(t.colorscale,t.cmin,t.cmax))}else{v=h}if(a){g=function(t,e){return t[e]===undefined?u:i(v(t[e]))}}else g=h;if(s){m=function(t,e){return t[e]===undefined?c:p(t[e])}}else m=p;if(a||s){for(var b=0;b",e))>=0){var r=t.indexOf("",e);if(r/g,"\n")}function s(t){return t.replace(/\<.*\>/g,"")}function l(t){var e=a.entityToUnicode;var r=0;while((r=t.indexOf("&",r))>=0){var n=t.indexOf(";",r);if(no)return s;return a(e)?Number(e):s};l.isIndex=function(t,e){if(e!==undefined&&t>=e)return false;return a(t)&&t>=0&&t%1===0};l.noop=t("./noop");l.identity=t("./identity");l.swapAttrs=function(t,e,r,n){if(!r)r="x";if(!n)n="y";for(var a=0;ar)return Math.max(r,Math.min(e,t));return Math.max(e,Math.min(r,t))};l.bBoxIntersect=function(t,e,r){r=r||0;return t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r};l.simpleMap=function(t,e,r,n){var a=t.length,i=new Array(a);for(var o=0;o=Math.pow(2,r)){if(a>10){l.warn("randstr failed uniqueness");return o}return t(e,r,n,(a||0)+1)}else return o};l.OptionControl=function(t,e){if(!t)t={};if(!e)e="opt";var r={};r.optionList=[];r._newoption=function(n){n[e]=t;r[n.name]=n;r.optionList.push(n)};r["_"+e]=t;return r};l.smooth=function(t,e){e=Math.round(e)||0;if(e<2)return t;var r=t.length,n=2*r,a=2*e-1,i=new Array(a),o=new Array(r),s,l,u,c;for(s=0;s=n)u-=n*Math.floor(u/n);if(u<0)u=-1-u;else if(u>=r)u=n-1-u;c+=t[u]*i[l]}o[s]=c}return o};l.syncOrAsync=function(t,e,r){var n,a;function i(){return l.syncOrAsync(t,e,r)}while(t.length){a=t.splice(0,1)[0];n=a(e);if(n&&n.then){return n.then(i).then(undefined,l.promiseError)}}return r&&r(e)};l.stripTrailingSlash=function(t){if(t.substr(-1)==="/")return t.substr(0,t.length-1);return t};l.noneOrAll=function(t,e,r){if(!t)return;var n=false,a=true,i,o;for(i=0;i1?a+o[1]:"";if(i&&(o.length>1||s.length>4||r)){while(n.test(s)){s=s.replace(n,"$1"+i+"$2")}}return s+l};var M=/%{([^\s%{}]*)}/g;var A=/^\w*$/;l.templateString=function(t,e){var r={};return t.replace(M,function(t,n){if(A.test(n)){return e[n]||""}r[n]=r[n]||l.nestedProperty(e,n).get;return r[n]()||""})};var T=48;var S=57;l.subplotSort=function(t,e){var r=Math.min(t.length,e.length)+1;var n=0;var a=0;for(var i=0;i=T&&o<=S;var u=s>=T&&s<=S;if(l)n=10*n+o-T;if(u)a=10*a+s-T;if(!l||!u){if(n!==a)return n-a;if(o!==s)return o-s}}return a-n};var E=2e9;l.seedPseudoRandom=function(){E=2e9};l.pseudoRandom=function(){var t=E;E=(69069*E+1)%4294967296;if(Math.abs(E-t)<429496729)return l.pseudoRandom();return E/4294967296}},{"../constants/numerical":661,"./angles":666,"./clean_number":667,"./coerce":669,"./dates":670,"./ensure_array":671,"./extend":673,"./filter_unique":674,"./filter_visible":675,"./geometry2d":678,"./get_graph_div":679,"./identity":683,"./is_array":685,"./is_plain_object":686,"./keyed_container":687,"./localize":688,"./loggers":689,"./matrix":690,"./mod":691,"./nested_property":692,"./noop":693,"./notifier":694,"./push_unique":698,"./regex":700,"./relative_attr":701,"./relink_private":702,"./search":703,"./stats":706,"./throttle":709,"./to_log_range":710,d3:147,"fast-isnumeric":214}],685:[function(t,e,r){"use strict";var n=typeof ArrayBuffer==="undefined"||!ArrayBuffer.isView?{isView:function(){return false}}:ArrayBuffer;var a=typeof DataView==="undefined"?function(){}:DataView;function i(t){return n.isView(t)&&!(t instanceof a)}function o(t){return Array.isArray(t)||i(t)}function s(t){return!o(t[0])}e.exports={isTypedArray:i,isArrayOrTypedArray:o,isArray1D:s}},{}],686:[function(t,e,r){"use strict";e.exports=function t(e){if(window&&window.process&&window.process.versions){return Object.prototype.toString.call(e)==="[object Object]"}return Object.prototype.toString.call(e)==="[object Object]"&&Object.getPrototypeOf(e)===Object.prototype}},{}],687:[function(t,e,r){"use strict";var n=t("./nested_property");var a=/^\w*$/;var i=0;var o=1;var s=2;var l=3;var u=4;e.exports=function t(e,r,c,f){c=c||"name";f=f||"value";var h,p,d;var v={};if(r&&r.length){d=n(e,r);p=d.get()}else{p=e}r=r||"";var g={};if(p){for(h=0;h2){v[e]=v[e]|s;return y.set(t,null)}if(m){for(h=e;h1){var t=["LOG:"];for(var e=0;e0){var t=["WARN:"];for(var e=0;e0){var t=["ERROR:"];for(var e=0;e/g);for(var o=0;oo||i===a||il){return false}if(e&&f(t))return false;return true}function p(t,e){var i=t[0],u=t[1];if(i===a||io||u===a||ul){return false}var c=r.length,f=r[0][0],h=r[0][1],p=0,d,v,g,m,y;for(d=1;dMath.max(v,f)||u>Math.max(g,h)){continue}else if(ul||Math.abs(n(h,c))>i)return true}return false};i.filter=function t(e,r){var n=[e[0]],a=0,i=0;function s(t){e.push(t);var s=n.length,l=a;n.splice(i+1);for(var u=l+1;u1){var l=e.pop();s(l)}return{addPt:s,raw:e,filtered:n}}},{"../constants/numerical":661,"./matrix":690}],697:[function(t,e,r){(function(r){"use strict";var n=t("./show_no_webgl_msg");var a=t("regl");e.exports=function t(e,i){var o=e._fullLayout;var s=true;o._glcanvas.each(function(t){if(t.regl)return;if(t.pick&&!o._has("parcoords"))return;try{t.regl=a({canvas:this,attributes:{antialias:!t.pick,preserveDrawingBuffer:true},pixelRatio:e._context.plotGlPixelRatio||r.devicePixelRatio,extensions:i||[]})}catch(t){s=false}});if(!s){n({container:o._glcontainer.node()})}return s}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./show_no_webgl_msg":705,regl:463}],698:[function(t,e,r){"use strict";e.exports=function t(e,r){if(r instanceof RegExp){var n=r.toString(),a;for(a=0;aa.queueLength){t.undoQueue.queue.shift();t.undoQueue.index--}};o.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:false};t.undoQueue.sequence=true;t.undoQueue.beginSequence=true};o.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:false};t.undoQueue.sequence=false;t.undoQueue.beginSequence=false};o.undo=function t(e){var r,n;if(e.framework&&e.framework.isPolar){e.framework.undo();return}if(e.undoQueue===undefined||isNaN(e.undoQueue.index)||e.undoQueue.index<=0){return}e.undoQueue.index--;r=e.undoQueue.queue[e.undoQueue.index];e.undoQueue.inSequence=true;for(n=0;n=e.undoQueue.queue.length){return}r=e.undoQueue.queue[e.undoQueue.index];e.undoQueue.inSequence=true;for(n=0;n1?(e[f-1]-e[0])/(f-1):1;var d,v;if(p>=0){v=r?o:s}else{v=r?u:l}t+=p*i*(r?-1:1)*(p>=0?1:-1);while(c90)a.log("Long binary search...");return c-1}};function o(t,e){return te}function u(t,e){return t>=e}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);var n=e.length-1,a=e[n]-e[0]||1,i=a/(n||1)/1e4,o=[e[0]];for(var s=0;se[s]+i){a=Math.min(a,e[s+1]-e[s]);o.push(e[s+1])}}return{vals:o,minDiff:a}};r.roundUp=function(t,e,r){var n=0,a=e.length-1,i,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;while(ni.length)o=i.length;if(!n(e))e=false;if(a(i[0])){l=new Array(o);for(s=0;st.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"./is_array":685,"fast-isnumeric":214}],707:[function(t,e,r){"use strict";var n=t("color-normalize");function a(t){if(!t)return[0,0,0,1];return n(t)}e.exports=a},{"color-normalize":107}],708:[function(t,e,r){"use strict";var n=t("d3");var a=t("../lib");var i=t("../constants/xmlns_namespaces");var o=t("../constants/string_mappings");var s=t("../constants/alignment").LINE_SPACING;function l(t,e){return t.node().getBoundingClientRect()[e]}var u=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,a){var i=t.text();var o=!t.attr("data-notex")&&typeof MathJax!=="undefined"&&i.match(u);var s=n.select(t.node().parentNode);if(s.empty())return;var c=t.attr("class")?t.attr("class").split(" ")[0]:"text";c+="-math";s.selectAll("svg."+c).remove();s.selectAll("g."+c+"-group").remove();t.style("display",null).attr({"data-unformatted":i,"data-math":"N"});function f(){if(!s.empty()){c=t.attr("class")+"-math";s.select("svg."+c).remove()}t.text("").style("white-space","pre");var e=P(t.node(),i);if(e){t.style("pointer-events","all")}r.positionText(t);if(a)a.call(t)}if(o){(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10);var n={fontSize:r};p(o[2],n,function(n,o,u){s.selectAll("svg."+c).remove();s.selectAll("g."+c+"-group").remove();var h=n&&n.select("svg");if(!h||!h.node()){f();e();return}var p=s.append("g").classed(c+"-group",true).attr({"pointer-events":"none","data-unformatted":i,"data-math":"Y"});p.node().appendChild(h.node());if(o&&o.node()){h.node().insertBefore(o.node().cloneNode(true),h.node().firstChild)}h.attr({class:c,height:u.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var d=t.node().style.fill||"black";h.select("g").attr({fill:d,stroke:d});var v=l(h,"width"),g=l(h,"height"),m=+t.attr("x")-v*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],y=r||l(t,"height"),x=-y/4;if(c[0]==="y"){p.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-v/2,x-g/2]+")"});h.attr({x:+t.attr("x"),y:+t.attr("y")})}else if(c[0]==="l"){h.attr({x:t.attr("x"),y:x-g/2})}else if(c[0]==="a"){h.attr({x:0,y:x})}else{h.attr({x:m,y:+t.attr("y")+x-g/2})}if(a)a.call(t,p);e(p)})}))}else f();return t};var c=/(<|<|<)/g;var f=/(>|>|>)/g;function h(t){return t.replace(c,"\\lt ").replace(f,"\\gt ")}function p(t,e,r){var i="math-output-"+a.randstr({},64);var o=n.select("body").append("div").attr({id:i}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(h(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,o.node()],function(){var e=n.select("body").select("#MathJax_SVG_glyphs");if(o.select(".MathJax_SVG").empty()||!o.select("svg").node()){a.log("There was an error in the tex syntax.",t);r()}else{var i=o.select("svg").node().getBoundingClientRect();r(o.select(".MathJax_SVG"),e,i)}o.remove()})}var d={sup:"font-size:70%",sub:"font-size:70%",b:"font-weight:bold",i:"font-style:italic",a:"cursor:pointer",span:"",em:"font-style:italic;font-weight:bold"};var v={sub:"0.3em",sup:"-0.6em"};var g={sub:"-0.21em",sup:"0.42em"};var m="\u200b";var y=["http:","https:","mailto:","",undefined,":"];var x=new RegExp("]*)?/?>","g");var b=Object.keys(o.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:o.entityToUnicode[t]}});var _=/(\r\n?|\n)/g;var w=/(<[^<>]*>)/;var k=/<(\/?)([^ >]*)(\s+(.*))?>/i;var M=//i;var A=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i;var T=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i;var S=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i;var E=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function C(t,e){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}var L=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(x," ")};function I(t,e){if(!t)return"";for(var r=0;r1){for(var a=1;a.",e);return}var r=o.pop();if(t!==r.type){a.log("Start tag <"+r.type+"> doesnt match end tag <"+t+">. Pretending it did match.",e)}l=o[o.length-1].node}var x=M.test(e);if(x)c();else{l=t;o=[{node:t}]}var b=e.split(w);for(var I=0;Io.ts+r){u();return}o.timer=setTimeout(function(){u();o.timer=null},r)};r.done=function(t){var e=n[t];if(!e||!e.timer)return Promise.resolve();return new Promise(function(t){var r=e.onDone;e.onDone=function n(){if(r)r();t();e.onDone=null}})};r.clear=function(t){if(t){a(n[t]);delete n[t]}else{for(var e in n)r.clear(e)}};function a(t){if(t&&t.timer!==null){clearTimeout(t.timer);t.timer=null}}},{}],710:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function t(e,r){if(e>0)return Math.log(e)/Math.LN10;var a=Math.log(Math.min(r[0],r[1]))/Math.LN10;if(!n(a))a=Math.log(Math.max(r[0],r[1]))/Math.LN10-6;return a}},{"fast-isnumeric":214}],711:[function(t,e,r){"use strict";var n=e.exports={};var a=t("../plots/geo/constants").locationmodeToLayer;var i=t("topojson-client").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=a[t.locationmode],n=e.objects[r];return i(e,n).features}},{"../plots/geo/constants":760,"topojson-client":502}],712:[function(t,e,r){"use strict";e.exports={moduleType:"locale",name:"en-US",dictionary:{"Click to enter Colorscale title":"Click to enter Colorscale title"},format:{date:"%m/%d/%Y"}}},{}],713:[function(t,e,r){"use strict";e.exports={moduleType:"locale",name:"en",dictionary:{"Click to enter Colorscale title":"Click to enter Colourscale title"},format:{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"],periods:["AM","PM"],dateTime:"%a %b %e %X %Y",date:"%d/%m/%Y",time:"%H:%M:%S",decimal:".",thousands:",",grouping:[3],currency:["$",""],year:"%Y",month:"%b %Y",dayMonth:"%b %-d",dayMonthYear:"%b %-d, %Y"}}},{}],714:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function t(e){var r=n.layoutArrayContainers,a=n.layoutArrayRegexes,i=e.split("[")[0],o,s;for(var l=0;l0){o.log("Clearing previous rejected promises from queue.")}t._promises=[]};r.cleanLayout=function(t){var e,r;if(!t)t={};if(t.xaxis1){if(!t.xaxis)t.xaxis=t.xaxis1;delete t.xaxis1}if(t.yaxis1){if(!t.yaxis)t.yaxis=t.yaxis1;delete t.yaxis1}if(t.scene1){if(!t.scene)t.scene=t.scene1;delete t.scene1}var n=(s.subplotsRegistry.cartesian||{}).attrRegex;var i=(s.subplotsRegistry.gl3d||{}).attrRegex;var l=Object.keys(t);for(e=0;e3){T.x=1.02;T.xanchor="left"}else if(T.x<-2){T.x=-.02;T.xanchor="right"}if(T.y>3){T.y=1.02;T.yanchor="bottom"}else if(T.y<-2){T.y=-.02;T.yanchor="top"}}if(t.dragmode==="rotate")t.dragmode="orbit";f.clean(t);return t};function h(t,e){var r=t[e],n=e.charAt(0);if(r&&r!=="paper"){t[e]=u(r,n)}}r.cleanData=function(t){for(var e=0;e0)return t.substr(0,e)}r.hasParent=function(t,e){var r=y(e);while(r){if(r in t)return true;r=y(r)}return false};var x=["x","y","z"];r.clearAxisTypes=function(t,e,r){for(var n=0;n1){o.warn("Full array edits are incompatible with other edits",h)}var x=a[""][""];if(c(x))r.set(null);else if(Array.isArray(x))r.set(x);else{o.warn("Unrecognized full array edit value",h,x);return true}if(g)return false;p(m,y);d(e);return true}var b=Object.keys(a).map(Number).sort(s),_=r.get(),w=_||[],k=n(y,h).get();var M=[],A=-1,T=w.length,S,E,C,L,I,z,P;for(S=0;Sw.length-(P?0:1)){o.warn("index out of range",h,C);continue}if(z!==undefined){if(I.length>1){o.warn("Insertion & removal are incompatible with edits to the same index.",h,C)}if(c(z)){M.push(C)}else if(P){if(z==="add")z={};w.splice(C,0,z);if(k)k.splice(C,0,{})}else{o.warn("Unrecognized full object edit value",h,C,z)}if(A===-1)A=C}else{for(E=0;E=0;S--){w.splice(M[S],1);if(k)k.splice(M[S],1)}if(!w.length)r.set(null);else if(!_)r.set(w);if(g)return false;p(m,y);if(v!==i){var O;if(A===-1){O=b}else{T=Math.max(w.length,T);O=[];for(S=0;S=A)break;O.push(C)}for(S=A;S=t.data.length||a<-t.data.length){throw new Error(r+" must be valid indices for gd.data.")}if(e.indexOf(a,n+1)>-1||a>=0&&e.indexOf(-t.data.length+a)>-1||a<0&&e.indexOf(t.data.length+a)>-1){throw new Error("each index in "+r+" must be unique.")}}}function D(t,e,r){if(!Array.isArray(t.data)){throw new Error("gd.data must be an array.")}if(typeof e==="undefined"){throw new Error("currentIndices is a required argument.")}else if(!Array.isArray(e)){e=[e]}O(t,e,"currentIndices");if(typeof r!=="undefined"&&!Array.isArray(r)){r=[r]}if(typeof r!=="undefined"){O(t,r,"newIndices")}if(typeof r!=="undefined"&&e.length!==r.length){throw new Error("current and new indices must be of equal length.")}}function R(t,e,r){var n,a;if(!Array.isArray(t.data)){throw new Error("gd.data must be an array.")}if(typeof e==="undefined"){throw new Error("traces must be defined.")}if(!Array.isArray(e)){e=[e]}for(n=0;n=0&&r=0&&r0&&typeof C.parts[z]!=="string")z--;var P=C.parts[z];var O=C.parts[z-1]+"."+P;var D=C.parts.slice(0,z).join(".");var R=o.nestedProperty(t.layout,D).get();var B=o.nestedProperty(n,D).get();var F=C.get();if(L===undefined)continue;y[E]=L;x[E]=P==="reverse"?L:V(F);var N=c.getLayoutValObject(n,C.parts);if(N&&N.impliedEdits&&L!==null){for(var j in N.impliedEdits){b(o.relativeAttr(E,j),N.impliedEdits[j])}}if(["width","height"].indexOf(E)!==-1&&L===null){n[E]=t._initialAutoSize[E]}else if(O.match(H)){S(O);o.nestedProperty(n,D+"._inputRange").set(null)}else if(O.match(G)){S(O);o.nestedProperty(n,D+"._inputRange").set(null);var U=o.nestedProperty(n,D).get();if(U._inputDomain){U._input.domain=U._inputDomain.slice()}}else if(O.match(W)){o.nestedProperty(n,D+"._inputDomain").set(null)}if(P==="type"){var q=R,Y=B.type==="linear"&&L==="log",$=B.type==="log"&&L==="linear";if(Y||$){if(!q||!q.range){b(D+".autorange",true)}else if(!B.autorange){var J=q.range[0],K=q.range[1];if(Y){if(J<=0&&K<=0){b(D+".autorange",true)}if(J<=0)J=K/1e6;else if(K<=0)K=J/1e6;b(D+".range[0]",Math.log(J)/Math.LN10);b(D+".range[1]",Math.log(K)/Math.LN10)}else{b(D+".range[0]",Math.pow(10,J));b(D+".range[1]",Math.pow(10,K))}}else if(Y){q.range=q.range[1]>q.range[0]?[1,2]:[2,1]}if(Array.isArray(n._subplots.polar)&&n._subplots.polar.length&&n[C.parts[0]]&&C.parts[1]==="radialaxis"){delete n[C.parts[0]]._subplot.viewInitial["radialaxis.range"]}u.getComponentMethod("annotations","convertCoords")(t,B,L,b);u.getComponentMethod("images","convertCoords")(t,B,L,b)}else{b(D+".autorange",true);b(D+".range",null)}o.nestedProperty(n,D+"._inputRange").set(null)}else if(P.match(A)){var Q=o.nestedProperty(n,E).get(),tt=(L||{}).type;if(!tt||tt==="-")tt="linear";u.getComponentMethod("annotations","convertCoords")(t,Q,tt,b);u.getComponentMethod("images","convertCoords")(t,Q,tt,b)}var et=_.containerArrayMatch(E);if(et){l=et.array;f=et.index;var rt=et.property;var nt=o.nestedProperty(r,l);var at=(nt||[])[f]||{};var it=at;var ot=N||{editType:"calc"};var st=ot.editType.indexOf("calcIfAutorange")!==-1;if(f===""){if(st)m.calc=true;else M.update(m,ot);st=false}else if(rt===""){it=L;if(_.isAddVal(L)){x[E]=null}else if(_.isRemoveVal(L)){x[E]=at;it=at}else o.warn("unrecognized full object value",e)}if(st&&(Z(t,it,"x")||Z(t,it,"y"))){m.calc=true}else{M.update(m,ot)}if(!s[l])s[l]={};var lt=s[l][f];if(!lt)lt=s[l][f]={};lt[rt]=L;delete e[E]}else if(P==="reverse"){if(R.range)R.range.reverse();else{b(D+".autorange",true);R.range=[1,0]}if(B.autorange)m.calc=true;else m.plot=true}else{if(n._has("scatter-like")&&n._has("regl")&&(E==="dragmode"&&(L==="lasso"||L==="select")&&!(F==="lasso"||F==="select"))){m.plot=true}else if(N)M.update(m,N);else m.calc=true;C.set(L)}}for(l in s){var ut=_.applyContainerArrayChanges(t,o.nestedProperty(r,l),s[l],m);if(!ut)m.plot=true}var ct=n._axisConstraintGroups||[];for(T in k){for(f=0;f=a.length){return a[0]}else{return a[t]}}else{return a}}function l(t){if(Array.isArray(i)){if(t>=i.length){return i[0]}else{return i[t]}}else{return i}}function u(t,e){var r=0;return function(){if(t&&++r===e){return t()}}}return new Promise(function(i,c){function h(){if(n._frameQueue.length===0){return}while(n._frameQueue.length){var e=n._frameQueue.pop();if(e.onInterrupt){e.onInterrupt()}}t.emit("plotly_animationinterrupted",[])}function p(e){if(e.length===0)return;for(var a=0;an._timeToNext){v()}};e()}var m=0;function y(t){if(Array.isArray(a)){if(m>=a.length){t.transitionOpts=a[m]}else{t.transitionOpts=a[0]}}else{t.transitionOpts=a}m++;return t}var x,b;var _=[];var k=e===undefined||e===null;var M=Array.isArray(e);var A=!k&&!M&&o.isPlainObject(e);if(A){_.push({type:"object",data:y(o.extendFlat({},e))})}else if(k||["string","number"].indexOf(typeof e)!==-1){for(x=0;x0&&E<_.length-1){var C=[];for(x=0;x<_.length;x++){b=_[x];if(_[x].type!=="byname"||x>E){C.push(b)}}_=C}}if(_.length>0){p(_)}else{t.emit("plotly_animated");i()}})};r.addFrames=function(t,e,r){t=o.getGraphDiv(t);if(e===null||e===undefined){return Promise.resolve()}if(!o.isPlotDiv(t)){throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed "+"to create a plot before adding frames. For more details, see "+"https://plot.ly/javascript/animations/")}var n,a,i,s;var u=t._transitionData._frames;var c=t._transitionData._frameHash;if(!Array.isArray(e)){throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e)}var h=u.length+e.length*2;var p=[];var d={};for(n=e.length-1;n>=0;n--){if(!o.isPlainObject(e[n]))continue;var v=e[n].name;var g=(c[v]||d[v]||{}).name;var m=e[n].name;var y=c[g]||d[g];if(g&&m&&typeof m==="number"&&y&&Te.index)return-1;if(t.index=0;n--){a=p[n].frame;if(typeof a.name==="number"){o.warn("Warning: addFrames accepts frames with numeric names, but the numbers are"+"implicitly cast to strings")}if(!a.name){while(c[a.name="frame "+t._transitionData._counter++]);}if(c[a.name]){for(i=0;i=0;r--){n=e[r];i.push({type:"delete",index:n});s.unshift({type:"insert",index:n,value:a[n]})}var u=f.modifyFrames,c=f.modifyFrames,h=[t,s],p=[t,i];if(l)l.add(t,u,h,c,p);return f.modifyFrames(t,i)};r.purge=function t(e){e=o.getGraphDiv(e);var r=e._fullLayout||{};var n=e._fullData||[];var a=e.calcdata||[];f.cleanPlot([],{},n,r,a);f.purge(e);s.purge(e);if(r._container)r._container.remove();delete e._context;return e};function tt(t){var e=n.select(t);var r=t._fullLayout;r._container=e.selectAll(".plot-container").data([0]);r._container.enter().insert("div",":first-child").classed("plot-container",true).classed("plotly",true);r._paperdiv=r._container.selectAll(".svg-container").data([0]);r._paperdiv.enter().append("div").classed("svg-container",true).style("position","relative");r._glcontainer=r._paperdiv.selectAll(".gl-container").data([{}]);r._glcontainer.enter().append("div").classed("gl-container",true);r._glcanvas=null;r._paperdiv.selectAll(".main-svg").remove();r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",true);r._toppaper=r._paperdiv.append("svg").classed("main-svg",true);if(!r._uid){var a={};n.selectAll("defs").each(function(){if(this.id)a[this.id.split("-")[1]]=1});r._uid=o.randstr(a)}r._paperdiv.selectAll(".main-svg").attr(y.svgAttrs);r._defs=r._paper.append("defs").attr("id","defs-"+r._uid);r._clips=r._defs.append("g").classed("clips",true);r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid);r._topclips=r._topdefs.append("g").classed("clips",true);r._bgLayer=r._paper.append("g").classed("bglayer",true);r._draggers=r._paper.append("g").classed("draglayer",true);var i=r._paper.append("g").classed("layer-below",true);r._imageLowerLayer=i.append("g").classed("imagelayer",true);r._shapeLowerLayer=i.append("g").classed("shapelayer",true);r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",true);r._polarlayer=r._paper.append("g").classed("polarlayer",true);r._ternarylayer=r._paper.append("g").classed("ternarylayer",true);r._geolayer=r._paper.append("g").classed("geolayer",true);r._pielayer=r._paper.append("g").classed("pielayer",true);r._glimages=r._paper.append("g").classed("glimages",true);var s=r._toppaper.append("g").classed("layer-above",true);r._imageUpperLayer=s.append("g").classed("imagelayer",true);r._shapeUpperLayer=s.append("g").classed("shapelayer",true);r._infolayer=r._toppaper.append("g").classed("infolayer",true);r._menulayer=r._toppaper.append("g").classed("menulayer",true);r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",true);r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",true);t.emit("plotly_framework")}},{"../components/color":558,"../components/colorbar/connect":560,"../components/drawing":583,"../constants/xmlns_namespaces":663,"../lib":684,"../lib/events":672,"../lib/queue":699,"../lib/svg_text_utils":708,"../plots/cartesian/axes":732,"../plots/cartesian/constants":737,"../plots/cartesian/graph_interact":741,"../plots/plots":795,"../plots/polar/legacy":803,"../registry":817,"./edit_types":715,"./helpers":716,"./manage_arrays":718,"./plot_config":720,"./plot_schema":721,"./subroutines":723,d3:147,"fast-isnumeric":214,"has-hover":378}],720:[function(t,e,r){"use strict";e.exports={staticPlot:false,plotlyServerURL:"https://plot.ly",editable:false,edits:{annotationPosition:false,annotationTail:false,annotationText:false,axisTitleText:false,colorbarPosition:false,colorbarTitleText:false,legendPosition:false,legendText:false,shapePosition:false,titleText:false},autosizable:false,queueLength:0,fillFrame:false,frameMargins:0,scrollZoom:false,doubleClick:"reset+autosize",showTips:true,showAxisDragHandles:true,showAxisRangeEntryBoxes:true,showLink:false,sendData:true,linkText:"Edit chart",showSources:false,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:false,toImageButtonOptions:{},displaylogo:true,plotGlPixelRatio:2,setBackground:"transparent",topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:1,globalTransforms:[],locale:"en-US",locales:{}}},{}],721:[function(t,e,r){"use strict";var n=t("../registry");var a=t("../lib");var i=t("../plots/attributes");var o=t("../plots/layout_attributes");var s=t("../plots/frame_attributes");var l=t("../plots/animation_attributes");var u=t("../plots/polar/legacy/area_attributes");var c=t("../plots/polar/legacy/axis_attributes");var f=t("./edit_types");var h=a.extendFlat;var p=a.extendDeepAll;var d=a.isPlainObject;var v="_isSubplotObj";var g="_isLinkedToArray";var m="_arrayAttrRegexps";var y="_deprecated";var x=[v,g,m,y];r.IS_SUBPLOT_OBJ=v;r.IS_LINKED_TO_ARRAY=g;r.DEPRECATED=y;r.UNDERSCORE_ATTRS=x;r.get=function(){var t={};n.allTypes.concat("area").forEach(function(e){t[e]=k(e)});var e={};Object.keys(n.transformsRegistry).forEach(function(t){e[t]=A(t)});return{defs:{valObjects:a.valObjectMeta,metaKeys:x.concat(["description","role","editType","impliedEdits"]),editType:{traces:f.traces,layout:f.layout},impliedEdits:{}},traces:t,layout:M(),transforms:e,frames:T(),animation:S(l)}};r.crawl=function(t,e,n,a){var i=n||0;a=a||"";Object.keys(t).forEach(function(n){var o=t[n];if(x.indexOf(n)!==-1)return;var s=(a?a+".":"")+n;e(o,n,t,i,s);if(r.isValObject(o))return;if(d(o)&&n!=="impliedEdits"){r.crawl(o,e,i+1,s)}})};r.isValObject=function(t){return t&&t.valType!==undefined};r.findArrayAttributes=function(t){var e=[];var n=[];var o=[];var s,l;function u(t,e,r,a){n=n.slice(0,a).concat([e]);o=o.slice(0,a).concat([t&&t._isLinkedToArray]);var i=t&&(t.valType==="data_array"||t.arrayOk===true)&&!(n[a-1]==="colorbar"&&(e==="ticktext"||e==="tickvals"));if(!i)return;c(s,0,"")}function c(t,r,i){var s=t[n[r]];var u=i+n[r];if(r===n.length-1){if(a.isArrayOrTypedArray(s)){e.push(l+u)}}else{if(o[r]){if(Array.isArray(s)){for(var f=0;f=l.length){return false}o=(n.transformsRegistry[l[c].type]||{}).attributes;s=o&&o[e[2]];a=3}else if(t.type==="area"){s=u[r]}else{var f=t._module;if(!f)f=(n.modules[t.type||i.type.dflt]||{})._module;if(!f)return false;o=f.attributes;s=o&&o[r];if(!s){var h=f.basePlotModule;if(h&&h.attributes){s=h.attributes[r]}}if(!s)s=i[r]}return _(s,e,a)};r.getLayoutValObject=function(t,e){var r=b(t,e[0]);return _(r,e,1)};function b(t,e){var r,a,i,s;var l=t._basePlotModules;if(l){var u;for(r=0;r=i.length)return false;if(t.dimensions===2){r++;if(e.length===r)return t;var o=e[r];if(!w(o))return false;t=i[a][o]}else t=i[a]}else{t=i}}}return t}function w(t){return t===Math.round(t)&&t>=0}function k(t){var e,r;if(t==="area"){e={attributes:u};r={}}else{e=n.modules[t]._module,r=e.basePlotModule}var a={};a.type=null;p(a,i);p(a,e.attributes);if(r.attributes){p(a,r.attributes)}a.type=t;var o={meta:e.meta||{},attributes:S(a)};if(e.layoutAttributes){var s={};p(s,e.layoutAttributes);o.layoutAttributes=S(s)}return o}function M(){var t={};var e,r;p(t,o);for(e in n.subplotsRegistry){r=n.subplotsRegistry[e];if(!r.layoutAttributes)continue;if(Array.isArray(r.attr)){for(var a=0;a=a&&(r._input||{})._templateitemname;if(s)o=a;var l=e+"["+o+"]";var u;function c(){u={};if(s){u[l]={};u[l][i]=s}}c();function f(t,e){u[t]=e}function h(t,e){if(s){n.nestedProperty(u[l],t).set(e)}else{u[l+"."+t]=e}}function p(){var t=u;c();return t}function d(e,r){if(e)h(e,r);var a=p();for(var i in a){n.nestedProperty(t,i).set(a[i])}}return{modifyBase:f,modifyItem:h,getUpdateObj:p,applyUpdate:d}}},{"../lib":684,"../plots/attributes":729}],723:[function(t,e,r){"use strict";var n=t("d3");var a=t("../registry");var i=t("../plots/plots");var o=t("../lib");var s=t("../lib/clear_gl_canvases");var l=t("../components/color");var u=t("../components/drawing");var c=t("../components/titles");var f=t("../components/modebar");var h=t("../plots/cartesian/axes");var p=t("../constants/alignment");var d=t("../plots/cartesian/constraints");var v=d.enforce;var g=d.clean;var m=t("../plots/cartesian/autorange").doAutoRange;r.layoutStyles=function(t){return o.syncOrAsync([i.doAutoMargin,x],t)};function y(t,e,r){for(var n=0;n=t[1]||a[1]<=t[0]){continue}if(i[0]e[0]){return true}}return false}function x(t){var e=t._fullLayout;var a=e._size;var i=a.p;var s=h.list(t,"",true);var c=e._has("cartesian");var d;function v(t,e,r){var n=t._lw/2;if(t._id.charAt(0)==="x"){if(!e)return a.t+a.h*(1-(t.position||0))+n%1;else if(r==="top")return e._offset-i-n;return e._offset+e._length+i+n}if(!e)return a.l+a.w*(t.position||0)+n%1;else if(r==="right")return e._offset+e._length+i+n;return e._offset-i-n}for(d=0;dA){c.push({code:"unused",traceType:_,templateCount:M,dataCount:A})}else if(A>M){c.push({code:"reused",traceType:_,templateCount:M,dataCount:A})}}}function T(t,e){for(var r in t){if(r.charAt(0)==="_")continue;var n=t[r];var i=v(t,r,e);if(a(n)){if(Array.isArray(t)&&n._template===false&&n.templateitemname){c.push({code:"missing",path:i,templateitemname:n.templateitemname})}T(n,i)}else if(Array.isArray(n)&&g(n)){T(n,i)}}}T({data:p,layout:h},"");if(c.length)return c.map(m)};function g(t){for(var e=0;e1){h.push(d("object","layout"))}}a.supplyDefaults(p);var m=p._fullData,y=v.length;for(var x=0;xx.length){a.push(d("unused",i,m.concat(x.length)))}var M=x.length;var A=Array.isArray(k);if(A)M=Math.min(M,k.length);var T,S,E,C,L;if(b.dimensions===2){for(S=0;Sx[S].length){a.push(d("unused",i,m.concat(S,x[S].length)))}var I=x[S].length;for(T=0;T<(A?Math.min(I,k[S].length):I);T++){E=A?k[S][T]:k;C=y[S][T];L=x[S][T];if(!n.validate(C,E)){a.push(d("value",i,m.concat(S,T),C))}else if(L!==C&&L!==+C){a.push(d("dynamic",i,m.concat(S,T),C,L))}}}else{a.push(d("array",i,m.concat(S),y[S]))}}}else{for(S=0;S0&&v>0&&g/v>i){p=f;d=h;i=g/v}}}if(r===n){var y=r-1;var x=r+1;if(t.rangemode==="tozero"){e=r<0?[y,0]:[0,x]}else if(t.rangemode==="nonnegative"){e=[Math.max(0,y),Math.max(0,x)]}else{e=[y,x]}}else if(i){if(t.type==="linear"||t.type==="-"){if(t.rangemode==="tozero"){if(p.val>=0){p={val:0,pad:0}}if(d.val<=0){d={val:0,pad:0}}}else if(t.rangemode==="nonnegative"){if(p.val-i*l(p)<0){p={val:0,pad:0}}if(d.val<0){d={val:1,pad:0}}}i=(d.val-p.val)/(t._length-l(p)-l(d))}e=[p.val-i*l(p),d.val+i*l(d)]}if(e[0]===e[1]){if(t.rangemode==="tozero"){if(e[0]<0){e=[e[0],0]}else if(e[0]>0){e=[0,e[0]]}else{e=[0,1]}}else{e=[e[0]-1,e[0]+1];if(t.rangemode==="nonnegative"){e[0]=Math.max(0,e[0])}}}if(o)e.reverse();return a.simpleMap(e,t.l2r||Number)}function s(t){var e=t._length/20;if(t.constrain==="domain"&&t._inputDomain){e*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0])}return function t(r){return r.pad+(r.extrapad?e:0)}}function l(t){if(!t._length)t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;var r;if(t.autorange&&e){t.range=o(t);t._r=t.range.slice();t._rl=a.simpleMap(t._r,t.r2l);r=t._input;r.range=t.range.slice();r.autorange=t.autorange}if(t._anchorAxis&&t._anchorAxis.rangeslider){var n=t._anchorAxis.rangeslider[t._name];if(n){if(n.rangemode==="auto"){if(e){n.range=o(t)}else{n.range=t._rangeInitial?t._rangeInitial.slice():t.range.slice()}}}r=t._anchorAxis._input;r.rangeslider[t._name]=a.extendFlat({},n)}}function u(t){return t.autorange||t._rangesliderAutorange}function c(t,e,r){if(!u(t)||!e)return;if(!t._min)t._min=[];if(!t._max)t._max=[];if(!r)r={};if(!t._m)t.setScale();var a=e.length;var o=r.padded||false;var s=r.tozero&&(t.type==="linear"||t.type==="-");var l=t.type==="log";var c,d,v,g,m,y,x,b,_,w,k,M;var A=false;function T(t){if(Array.isArray(t)){A=true;return function(e){return Math.max(Number(t[e]||0),0)}}else{var e=Math.max(Number(t||0),0);return function(){return e}}}var S=T((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0);var E=T((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0);var C=T(r.vpadplus||r.vpad);var L=T(r.vpadminus||r.vpad);if(!A){k=Infinity;M=-Infinity;if(l){for(c=0;c0)k=g;if(g>M&&g-i)k=g;if(g>M&&g=u&&(g.extrapad||!o)){w=false;break}else if(c(a,g.val)&&g.pad<=u&&(o||!g.extrapad)){i.splice(d,1);d--}}if(w){var A=s&&a===0;i.push({val:a,pad:A?0:u,extrapad:A?false:o})}}}}var z=Math.min(6,a);for(c=0;c=z;c--)I(c)}function f(t){return n(t)&&Math.abs(t)=e}},{"../../constants/numerical":661,"../../lib":684,"fast-isnumeric":214}],732:[function(t,e,r){"use strict";var n=t("d3");var a=t("fast-isnumeric");var i=t("../../plots/plots");var o=t("../../registry");var s=t("../../lib");var l=t("../../lib/svg_text_utils");var u=t("../../components/titles");var c=t("../../components/color");var f=t("../../components/drawing");var h=t("../../constants/numerical");var p=h.ONEAVGYEAR;var d=h.ONEAVGMONTH;var v=h.ONEDAY;var g=h.ONEHOUR;var m=h.ONEMIN;var y=h.ONESEC;var x=h.MINUS_SIGN;var b=h.BADNUM;var _=t("../../constants/alignment").MID_SHIFT;var w=t("../../constants/alignment").LINE_SPACING;var k=e.exports={};k.setConvert=t("./set_convert");var M=t("./axis_autotype");var A=t("./axis_ids");k.id2name=A.id2name;k.name2id=A.name2id;k.cleanId=A.cleanId;k.list=A.list;k.listIds=A.listIds;k.getFromId=A.getFromId;k.getFromTrace=A.getFromTrace;var T=t("./autorange");k.expand=T.expand;k.getAutoRange=T.getAutoRange;k.coerceRef=function(t,e,r,n,a,i){var o=n.charAt(n.length-1);var l=r._fullLayout._subplots[o+"axis"];var u=n+"ref";var c={};if(!a)a=l[0]||i;if(!i)i=a;c[u]={valType:"enumerated",values:l.concat(i?[i]:[]),dflt:a};return s.coerce(t,e,c,u)};k.coercePosition=function(t,e,r,n,a,i){var o,l;if(n==="paper"||n==="pixel"){o=s.ensureNumber;l=r(a,i)}else{var u=k.getFromId(e,n);i=u.fraction2r(i);l=r(a,i);o=u.cleanPos}t[a]=o(l)};k.cleanPosition=function(t,e,r){var n=r==="paper"||r==="pixel"?s.ensureNumber:k.getFromId(e,r).cleanPos;return n(t)};var S=k.getDataConversions=function(t,e,r,n){var a;var i=r==="x"||r==="y"||r==="z"?r:n;if(Array.isArray(i)){a={type:M(n),_categories:[]};k.setConvert(a);if(a.type==="category"){for(var o=0;o2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6){t._minDtick=0}}};k.saveRangeInitial=function(t,e){var r=k.list(t,"",true),n=false;for(var a=0;ah*.3||c(n)||c(i)){var p=r.dtick/2;t+=t+po){var l=Number(r.substr(1));if(i.exactYears>o&&l%12===0){t=k.tickIncrement(t,"M6","reverse")+v*1.5}else if(i.exactMonths>o){t=k.tickIncrement(t,"M1","reverse")+v*15.5}else{t-=v/2}var u=k.tickIncrement(t,r);if(u<=n)return u}return t}k.prepTicks=function(t){var e=s.simpleMap(t.range,t.r2l);if(t.tickmode==="auto"||!t.dtick){var r=t.nticks,n;if(!r){if(t.type==="category"){n=t.tickfont?(t.tickfont.size||12)*1.2:15;r=t._length/n}else{n=t._id.charAt(0)==="y"?40:80;r=s.constrain(t._length/n,4,9)+1}if(t._name==="radialaxis")r*=2}if(t.tickmode==="array")r*=100;k.autoTicks(t,Math.abs(e[1]-e[0])/r);if(t._minDtick>0&&t.dtick=a:c<=a;c=k.tickIncrement(c,e.dtick,i,e.calendar)){if(o.length>u||c===l)break;l=c;o.push(c)}if(e._id==="angular"&&Math.abs(r[1]-r[0])===360){o.pop()}e._tmax=o[o.length-1];e._prevDateHead="";e._inCalcTicks=true;var f=new Array(o.length);for(var h=0;hl&&cp){e/=p;r=n(10);t.dtick="M"+12*j(e,r,P)}else if(i>d){e/=d;t.dtick="M"+j(e,1,O)}else if(i>v){t.dtick=j(e,v,R);t.tick0=s.dateTick0(t.calendar,true)}else if(i>g){t.dtick=j(e,g,O)}else if(i>m){t.dtick=j(e,m,D)}else if(i>y){t.dtick=j(e,y,D)}else{r=n(10);t.dtick=j(e,r,P)}}else if(t.type==="log"){t.tick0=0;var o=s.simpleMap(t.range,t.r2l);if(e>.7){t.dtick=Math.ceil(e)}else if(Math.abs(o[1]-o[0])<1){var l=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/l;r=n(10);t.dtick="L"+j(e,r,P)}else{t.dtick=e>.3?"D2":"D1"}}else if(t.type==="category"){t.tick0=0;t.dtick=Math.ceil(Math.max(e,1))}else if(t._id==="angular"){t.tick0=0;r=1;t.dtick=j(e,r,N)}else{t.tick0=0;r=n(10);t.dtick=j(e,r,P)}if(t.dtick===0)t.dtick=1;if(!a(t.dtick)&&typeof t.dtick!=="string"){var u=t.dtick;t.dtick=1;throw"ax.dtick error: "+String(u)}};function V(t){var e=t.dtick;t._tickexponent=0;if(!a(e)&&typeof e!=="string"){e=1}if(t.type==="category"){t._tickround=null}if(t.type==="date"){var r=t.r2l(t.tick0),n=t.l2r(r).replace(/(^-|i)/g,""),i=n.length;if(String(e).charAt(0)==="M"){if(i>10||n.substr(5)!=="01-01")t._tickround="d";else t._tickround=+e.substr(1)%12===0?"y":"m"}else if(e>=v&&i<=10||e>=v*15)t._tickround="d";else if(e>=m&&i<=16||e>=g)t._tickround="M";else if(e>=y&&i<=19||e>=m)t._tickround="S";else{var o=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,o)-20}}else if(a(e)||e.charAt(0)==="L"){var s=t.range.map(t.r2d||Number);if(!a(e))e=Number(e.substr(1));t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(s[0]),Math.abs(s[1]));var u=Math.floor(Math.log(l)/Math.LN10+.01);if(Math.abs(u)>3){if($(t.exponentformat)&&!J(u)){t._tickexponent=3*Math.round((u-1)/3)}else t._tickexponent=u}}else t._tickround=null}k.tickIncrement=function(t,e,r,i){var o=r?-1:1;if(a(e))return t+o*e;var l=e.charAt(0),u=o*Number(e.substr(1));if(l==="M")return s.incrementMonth(t,u,i);else if(l==="L")return Math.log(Math.pow(10,t)+u)/Math.LN10;else if(l==="D"){var c=e==="D2"?F:B,f=t+o*.01,h=s.roundUp(s.mod(f,1),c,r);return Math.floor(f)+Math.log(n.round(Math.pow(10,h),1))/Math.LN10}else throw"unrecognized dtick "+String(e)};k.tickFirst=function(t){var e=t.r2l||Number,r=s.simpleMap(t.range,e),i=r[1]"+u;t._prevDateHead=u}}e.text=l}function H(t,e,r,n,i){var o=t.dtick,l=e.x,u=t.tickformat;if(i==="never"){i=""}if(n&&(typeof o!=="string"||o.charAt(0)!=="L"))o="L3";if(u||typeof o==="string"&&o.charAt(0)==="L"){e.text=K(Math.pow(10,l),t,i,n)}else if(a(o)||o.charAt(0)==="D"&&s.mod(l+.01,1)<.1){var c=Math.round(l);if(["e","E","power"].indexOf(t.exponentformat)!==-1||$(t.exponentformat)&&J(c)){if(c===0)e.text=1;else if(c===1)e.text="10";else if(c>1)e.text="10"+c+"";else e.text="10"+x+-c+"";e.fontSize*=1.25}else{e.text=K(Math.pow(10,l),t,"","fakehover");if(o==="D1"&&t._id.charAt(0)==="y"){e.dy-=e.fontSize/6}}}else if(o.charAt(0)==="D"){e.text=String(Math.round(Math.pow(10,s.mod(l,1))));e.fontSize*=.75}else throw"unrecognized dtick "+String(o);if(t.dtick==="D1"){var f=String(e.text).charAt(0);if(f==="0"||f==="1"){if(t._id.charAt(0)==="y"){e.dx-=e.fontSize/4}else{e.dy+=e.fontSize/2;e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(l<0?.5:.25)}}}}function G(t,e){var r=t._categories[Math.round(e.x)];if(r===undefined)r="";e.text=String(r)}function W(t,e,r,n,a){if(a==="never"){a=""}else if(t.showexponent==="all"&&Math.abs(e.x/t.dtick)<1e-6){a="hide"}e.text=K(e.x,t,a,n)}function Y(t,e,r,n,a){if(t.thetaunit==="radians"&&!r){var i=e.x/180;if(i===0){e.text="0"}else{var o=X(i);if(o[1]>=100){e.text=K(s.deg2rad(e.x),t,a,n)}else{var l=e.x<0;if(o[1]===1){if(o[0]===1)e.text="\u03c0";else e.text=o[0]+"\u03c0"}else{e.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join("")}if(l)e.text=x+e.text}}}else{e.text=K(e.x,t,a,n)}}function X(t){function e(t,e){return Math.abs(t-e)<=1e-6}function r(t,n){return e(n,0)?t:r(n,t%n)}function n(t){var r=1;while(!e(Math.round(t*r)/r,t)){r*=10}return r}var a=n(t);var i=t*a;var o=Math.abs(r(i,a));return[Math.round(i/o),Math.round(a/o)]}var Z=["f","p","n","\u03bc","m","","k","M","G","T"];function $(t){return t==="SI"||t==="B"}function J(t){return t>14||t<-15}function K(t,e,r,n){var i=t<0,o=e._tickround,l=r||e.exponentformat||"B",u=e._tickexponent,c=k.getTickFormat(e),f=e.separatethousands;if(n){var h={exponentformat:l,dtick:e.showexponent==="none"?e.dtick:a(t)?Math.abs(t)||1:1,range:e.showexponent==="none"?e.range.map(e.r2d):[0,t||1]};V(h);o=(Number(h._tickround)||0)+4;u=h._tickexponent;if(e.hoverformat)c=e.hoverformat}if(c)return e._numFormat(c)(t).replace(/-/g,x);var p=Math.pow(10,-o)/2;if(l==="none")u=0;t=Math.abs(t);if(t"+g+""}else if(l==="B"&&u===9){t+="B"}else if($(l)){t+=Z[u/3+5]}}if(i)return x+t;return t}k.getTickFormat=function(t){var e;function r(t){return typeof t!=="string"?t:Number(t.replace("M",""))*d}function n(t,e){var r=["L","D"];if(typeof t===typeof e){if(typeof t==="number"){return t-e}else{var n=r.indexOf(t.charAt(0));var a=r.indexOf(e.charAt(0));if(n===a){return Number(t.replace(/(L|D)/g,""))-Number(e.replace(/(L|D)/g,""))}else{return n-a}}}else{return typeof t==="number"?1:-1}}function a(t,e,r){var n=r||function(t){return t};var a=e[0];var i=e[1];return(!a&&typeof a!=="number"||n(a)<=n(t))&&(!i&&typeof i!=="number"||n(i)>=n(t))}function i(t,e){var r=e[0]===null;var a=e[1]===null;var i=n(t,e[0])>=0;var o=n(t,e[1])<=0;return(r||i)&&(a||o)}var o,s;if(t.tickformatstops&&t.tickformatstops.length>0){switch(t.type){case"date":case"linear":{for(e=0;e1&&e1){for(a=1;ai*2}function l(t){var e=Math.max(1,(t.length-1)/1e3),r=0,n=0,o;for(var s=0;sr*2}},{"../../constants/numerical":661,"../../lib":684,"fast-isnumeric":214}],734:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("../../lib");var i=t("./layout_attributes");var o=t("./tick_value_defaults");var s=t("./tick_mark_defaults");var l=t("./tick_label_defaults");var u=t("./category_order_defaults");var c=t("./line_grid_defaults");var f=t("./set_convert");e.exports=function t(e,r,h,p,d){var v=p.letter;var g=r._id;var m=p.font||{};var y=h("visible",!p.cheateronly);var x=r.type;if(x==="date"){var b=n.getComponentMethod("calendars","handleDefaults");b(e,r,"calendar",p.calendar)}f(r,d);var _=h("autorange",!r.isValidRange(e.range));r._rangesliderAutorange=false;if(_)h("rangemode");h("range");r.cleanRange();u(e,r,h,p);if(x!=="category"&&!p.noHover)h("hoverformat");if(!y)return r;var w=h("color");var k=w!==i.color.dflt?w:m.color;var M=((d._splomAxes||{})[v]||{})[g]||d._dfltTitle[v];h("title",M);a.coerceFont(h,"titlefont",{family:m.family,size:Math.round(m.size*1.2),color:k});o(e,r,h,x);l(e,r,h,x,p);s(e,r,h,p);c(e,r,h,{dfltColor:w,bgColor:p.bgColor,showGrid:p.showGrid,attributes:i});if(r.showline||r.ticks)h("mirror");if(p.automargin)h("automargin");return r}},{"../../lib":684,"../../registry":817,"./category_order_defaults":736,"./layout_attributes":744,"./line_grid_defaults":746,"./set_convert":750,"./tick_label_defaults":751,"./tick_mark_defaults":752,"./tick_value_defaults":753}],735:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("./constants");r.id2name=function t(e){if(typeof e!=="string"||!e.match(a.AX_ID_PATTERN))return;var r=e.substr(1);if(r==="1")r="";return e.charAt(0)+"axis"+r};r.name2id=function t(e){if(!e.match(a.AX_NAME_PATTERN))return;var r=e.substr(5);if(r==="1")r="";return e.charAt(0)+r};r.cleanId=function t(e,r){if(!e.match(a.AX_ID_PATTERN))return;if(r&&e.charAt(0)!==r)return;var n=e.substr(1).replace(/^0+/,"");if(n==="1")n="";return e.charAt(0)+n};r.list=function(t,e,n){var a=t._fullLayout;if(!a)return[];var i=r.listIds(t,e);var o=new Array(i.length);var s;for(s=0;sn?1:-1;return+(t.substr(1)||1)-+(e.substr(1)||1)}},{"../../registry":817,"./constants":737}],736:[function(t,e,r){"use strict";function n(t,e){var r=e.dataAttr||t._id.charAt(0);var n={};var a;var i,o;if(e.axData){a=e.axData}else{a=[];for(i=0;i0;var l;if(s)l="array";var u=a("categoryorder",l);var c;if(u==="array"){c=a("categoryarray")}if(!s&&u==="array"){u=r.categoryorder="trace"}if(u==="trace"){r._initialCategories=[]}else if(u==="array"){r._initialCategories=c.slice()}else{c=n(r,i).sort();if(u==="category ascending"){r._initialCategories=c}else if(u==="category descending"){r._initialCategories=c.reverse()}}}},{}],737:[function(t,e,r){"use strict";var n=t("../../lib/regex").counter;e.exports={idRegex:{x:n("x"),y:n("y")},attrRegex:n("[xy]axis"),xAxisMatch:n("xaxis"),yAxisMatch:n("yaxis"),AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,SUBPLOT_PATTERN:/^x([0-9]*)y([0-9]*)$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,SELECTDELAY:100,SELECTID:"-select",DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],traceLayerClasses:["heatmaplayer","contourcarpetlayer","contourlayer","barlayer","carpetlayer","violinlayer","boxlayer","ohlclayer","scattercarpetlayer","scatterlayer"],layerValue2layerClass:{"above traces":"above","below traces":"below"}}},{"../../lib/regex":700}],738:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("./axis_ids").id2name;e.exports=function t(e,r,a,s,l){var u=l._axisConstraintGroups;var c=r._id;var f=c.charAt(0);if(r.fixedrange)return;a("constrain");n.coerce(e,r,{constraintoward:{valType:"enumerated",values:f==="x"?["left","center","right"]:["bottom","middle","top"],dflt:f==="x"?"center":"middle"}},"constraintoward");if(!e.scaleanchor)return;var h=i(u,c,s,l);var p=n.coerce(e,r,{scaleanchor:{valType:"enumerated",values:h.linkableAxes}},"scaleanchor");if(p){var d=a("scaleratio");if(!d)d=r.scaleratio=1;o(u,h.thisGroup,c,p,d)}else if(s.indexOf(e.scaleanchor)!==-1){n.warn("ignored "+r._name+'.scaleanchor: "'+e.scaleanchor+'" to avoid either an infinite loop '+"and possibly inconsistent scaleratios, or because the target"+"axis has fixed range.")}};function i(t,e,r,n){var i=n[a(e)].type;var o,s,l,u;var c=[];for(s=0;so*x&&!k)continue;for(c=0;cP&&BI){I=B}}var N=(I-L)/(2*z);v/=N;L=h.l2r(L);I=h.l2r(I);h.range=h._input.range=SM||o>M){Et="xy";if(i/nt>o/at){o=i*at/nt;if(kt>a)Mt.t=kt-o;else Mt.b=kt+o}else{i=o*nt/at;if(wt>n)Mt.l=wt-i;else Mt.r=wt+i}Lt.attr("d",H(Mt))}else{s()}}else if(!st||o10||r.scrollWidth-r.clientWidth>10){return}clearTimeout(Bt);var n=-e.deltaY;if(!isFinite(n))n=e.wheelDelta/10;if(!isFinite(n)){s.log("Did not find wheel motion attributes: ",e);return}var a=Math.exp(-Math.min(Math.max(n,-20),20)/200),i=Nt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),o=(e.clientX-i.left)/i.width,l=(i.bottom-e.clientY)/i.height,u;function c(t,e,r){if(t.fixedrange)return;var n=s.simpleMap(t.range,t.r2l),a=n[0]+(n[1]-n[0])*e;function i(e){return t.l2r(a+(e-a)*r)}t.range=n.map(i)}if(ct){if(!T)o=.5;for(u=0;u=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function O(t,e,r){if(!t)return"pointer";if(t==="nsew"){if(r)return"";if(e==="pan")return"move";return"crosshair"}return t.toLowerCase()+"-resize"}function D(t,e,r,n,a){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",a+"Z")}function R(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:c.background,stroke:c.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function B(t,e,r,n,a,i){t.attr("d",n+"M"+r.l+","+r.t+"v"+r.h+"h"+r.w+"v-"+r.h+"h-"+r.w+"Z");F(t,e,a,i)}function F(t,e,r,n){if(!r){t.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200);e.transition().style("opacity",1).duration(200)}}function N(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function j(t){if(A&&t.data&&t._context.showTips){s.notifier(s._(t,"Double-click to zoom back out"),"long");A=false}}function V(t){return t==="lasso"||t==="select"}function U(t,e){return"M"+(t.l-.5)+","+(e-M-.5)+"h-3v"+(2*M+1)+"h3ZM"+(t.r+.5)+","+(e-M-.5)+"h3v"+(2*M+1)+"h-3Z"}function q(t,e){return"M"+(e-M-.5)+","+(t.t-.5)+"v-3h"+(2*M+1)+"v3ZM"+(e-M-.5)+","+(t.b+.5)+"v3h"+(2*M+1)+"v-3Z"}function H(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,M)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function G(t,e,r){var n=t._fullLayout._axisConstraintGroups;var a=false;var i={};var o={};var l,u,c,f;for(var h=0;hm[1]-.01)r.domain=h;a.noneOrAll(e.domain,r.domain,h)}i("layer");return r}},{"../../lib":684,"fast-isnumeric":214}],748:[function(t,e,r){"use strict";var n=t("../../constants/alignment").FROM_BL;e.exports=function t(e,r,a){if(a===undefined){a=n[e.constraintoward||"center"]}var i=[e.r2l(e.range[0]),e.r2l(e.range[1])];var o=i[0]+(i[1]-i[0])*a;e.range=e._input.range=[e.l2r(o+(i[0]-o)*r),e.l2r(o+(i[1]-o)*r)]}},{"../../constants/alignment":656}],749:[function(t,e,r){"use strict";var n=t("polybooljs");var a=t("../../registry");var i=t("../../components/color");var o=t("../../components/fx");var s=t("../../lib/polygon");var l=t("../../lib/throttle");var u=t("../../components/fx/helpers").makeEventData;var c=t("./axis_ids").getFromId;var f=t("../sort_modules").sortModules;var h=t("./constants");var p=h.MINSELECT;var d=s.filter;var v=s.tester;var g=s.multitester;function m(t){return t._id}function y(t,e,r,n,a){var s=n.gd;var u=s._fullLayout;var f=u._zoomlayer;var y=n.element.getBoundingClientRect();var k=n.plotinfo;var M=k.xaxis._offset;var A=k.yaxis._offset;var T=e-y.left;var S=r-y.top;var E=T;var C=S;var L="M"+T+","+S;var I=n.xaxes[0]._length;var z=n.yaxes[0]._length;var P=n.xaxes.map(m);var O=n.yaxes.map(m);var D=n.xaxes.concat(n.yaxes);var R=t.altKey;var B,F,N,j;var V,U,q,H,G;var W=u._lastSelectedSubplot&&u._lastSelectedSubplot===k.id;if(W&&(t.shiftKey||t.altKey)&&(k.selection&&k.selection.polygons)&&!n.polygons){n.polygons=k.selection.polygons;n.mergedPolygons=k.selection.mergedPolygons}else if(!t.shiftKey&&!t.altKey||(t.shiftKey||t.altKey)&&!k.selection){k.selection={};k.selection.polygons=n.polygons=[];k.selection.mergedPolygons=n.mergedPolygons=[]}if(!W){w(f);u._lastSelectedSubplot=k.id}if(a==="lasso"){B=d([[T,S]],h.BENDPX)}var Y=f.selectAll("path.select-outline-"+k.id).data([1,2]);Y.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t+" select-outline-"+k.id}).attr("transform","translate("+M+", "+A+")").attr("d",L+"Z");var X=f.append("path").attr("class","zoombox-corners").style({fill:i.background,stroke:i.defaultLine,"stroke-width":1}).attr("transform","translate("+M+", "+A+")").attr("d","M0,0Z");var Z=[];var $=u._uid+h.SELECTID;var J=[];for(V=0;V0)return Math.log(t)/Math.LN10;else if(t<=0&&r&&e.range&&e.range.length===2){var n=e.range[0],a=e.range[1];return.5*(n+a-3*g*Math.abs(n-a))}else return h}function y(t,r,n){var i=l(t,n||e.calendar);if(i===h){if(a(t))i=l(new Date(+t));else return h}return i}function x(t,r,n){return s(t,r,n||e.calendar)}function b(t){return e._categories[Math.round(t)]}function _(t){if(t!==null&&t!==undefined){if(e._categoriesMap===undefined){e._categoriesMap={}}if(e._categoriesMap[t]!==undefined){return e._categoriesMap[t]}else{e._categories.push(t);var r=e._categories.length-1;e._categoriesMap[t]=r;return r}}return h}function w(t){if(e._categoriesMap){var r=e._categoriesMap[t];if(r!==undefined)return r}if(a(t))return+t}function k(t){if(!a(t))return h;return n.round(e._b+e._m*t,2)}function M(t){return(t-e._b)/e._m}e.c2l=e.type==="log"?m:u;e.l2c=e.type==="log"?v:u;e.l2p=k;e.p2l=M;e.c2p=e.type==="log"?function(t,e){return k(m(t,e))}:k;e.p2c=e.type==="log"?function(t){return v(M(t))}:M;if(["linear","-"].indexOf(e.type)!==-1){e.d2r=e.r2d=e.d2c=e.r2c=e.d2l=e.r2l=o;e.c2d=e.c2r=e.l2d=e.l2r=u;e.d2p=e.r2p=function(t){return e.l2p(o(t))};e.p2d=e.p2r=M;e.cleanPos=u}else if(e.type==="log"){e.d2r=e.d2l=function(t,e){return m(o(t),e)};e.r2d=e.r2c=function(t){return v(o(t))};e.d2c=e.r2l=o;e.c2d=e.l2r=u;e.c2r=m;e.l2d=v;e.d2p=function(t,r){return e.l2p(e.d2r(t,r))};e.p2d=function(t){return v(M(t))};e.r2p=function(t){return e.l2p(o(t))};e.p2r=M;e.cleanPos=u}else if(e.type==="date"){e.d2r=e.r2d=i.identity;e.d2c=e.r2c=e.d2l=e.r2l=y;e.c2d=e.c2r=e.l2d=e.l2r=x;e.d2p=e.r2p=function(t,r,n){return e.l2p(y(t,0,n))};e.p2d=e.p2r=function(t,e,r){return x(M(t),e,r)};e.cleanPos=function(t){return i.cleanDate(t,h,e.calendar)}}else if(e.type==="category"){e.d2c=e.d2l=_;e.r2d=e.c2d=e.l2d=b;e.d2r=e.d2l_noadd=w;e.r2c=function(t){var r=w(t);return r!==undefined?r:e.fraction2r(.5)};e.l2r=e.c2r=u;e.r2l=w;e.d2p=function(t){return e.l2p(e.r2c(t))};e.p2d=function(t){return b(M(t))};e.r2p=e.d2p;e.p2r=M;e.cleanPos=function(t){if(typeof t==="string"&&t!=="")return t;return u(t)}}e.fraction2r=function(t){var r=e.r2l(e.range[0]),n=e.r2l(e.range[1]);return e.l2r(r+t*(n-r))};e.r2fraction=function(t){var r=e.r2l(e.range[0]),n=e.r2l(e.range[1]);return(e.r2l(t)-r)/(n-r)};e.cleanRange=function(t,r){if(!r)r={};if(!t)t="range";var n=i.nestedProperty(e,t).get();var o,s;if(e.type==="date")s=i.dfltRange(e.calendar);else if(c==="y")s=p.DFLTRANGEY;else s=r.dfltRange||p.DFLTRANGEX;s=s.slice();if(!n||n.length!==2){i.nestedProperty(e,t).set(s);return}if(e.type==="date"){n[0]=i.cleanDate(n[0],h,e.calendar);n[1]=i.cleanDate(n[1],h,e.calendar)}for(o=0;o<2;o++){if(e.type==="date"){if(!i.isDateTime(n[o],e.calendar)){e[t]=s;break}if(e.r2l(n[0])===e.r2l(n[1])){var l=i.constrain(e.r2l(n[0]),i.MIN_MS+1e3,i.MAX_MS-1e3);n[0]=e.l2r(l-1e3);n[1]=e.l2r(l+1e3);break}}else{if(!a(n[o])){if(a(n[1-o])){n[o]=n[1-o]*(o?10:.1)}else{e[t]=s;break}}if(n[o]<-f)n[o]=-f;else if(n[o]>f)n[o]=f;if(n[0]===n[1]){var u=Math.max(1,Math.abs(n[0]*1e-6));n[0]-=u;n[1]+=u}}}};e.setScale=function(t){var n=r._size;if(!e._categories)e._categories=[];if(!e._categoriesMap)e._categoriesMap={};if(e.overlaying){var a=d.getFromId({_fullLayout:r},e.overlaying);e.domain=a.domain}var i=t&&e._r?"_r":"range",o=e.calendar;e.cleanRange(i);var s=e.r2l(e[i][0],o),l=e.r2l(e[i][1],o);if(c==="y"){e._offset=n.t+(1-e.domain[1])*n.h;e._length=n.h*(e.domain[1]-e.domain[0]);e._m=e._length/(s-l);e._b=-e._m*l}else{e._offset=n.l+e.domain[0]*n.w;e._length=n.w*(e.domain[1]-e.domain[0]);e._m=e._length/(l-s);e._b=-e._m*s}if(!isFinite(e._m)||!isFinite(e._b)){r._replotting=false;throw new Error("Something went wrong with axis scaling")}};e.makeCalcdata=function(t,r){var n,a,o,s;var l=e.type;var u=l==="date"&&t[r+"calendar"];if(r in t){n=t[r];s=t._length||n.length;if(i.isTypedArray(n)&&(l==="linear"||l==="log")){if(s===n.length){return n}else if(n.subarray){return n.subarray(0,s)}}a=new Array(s);for(o=0;o0?Number(f):c}else if(typeof f!=="string"){r.dtick=c}else{var h=f.charAt(0),p=f.substr(1);p=n(p)?Number(p):0;if(p<=0||!(s==="date"&&h==="M"&&p===Math.round(p)||s==="log"&&h==="L"||s==="log"&&h==="D"&&(p===1||p===2))){r.dtick=c}}var d=s==="date"?a.dateTick0(r.calendar):0;var v=o("tick0",d);if(s==="date"){r.tick0=a.cleanDate(v,d)}else if(n(v)&&f!=="D1"&&f!=="D2"){r.tick0=Number(v)}else{r.tick0=d}}else{var g=o("tickvals");if(g===undefined)r.tickmode="auto";else o("ticktext")}}},{"../../constants/numerical":661,"../../lib":684,"fast-isnumeric":214}],754:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../registry");var i=t("../../components/drawing");var o=t("./axes");var s=t("./constants").attrRegex;e.exports=function t(e,r,l,u){var c=e._fullLayout;var f=[];function h(t){var e,r,n,a,i;var o={};for(e in t){r=e.split(".");n=r[0].match(s);if(n){var l=e.charAt(0);var u=r[0];a=c[u];i={};if(Array.isArray(t[e])){i.to=t[e].slice(0)}else{if(Array.isArray(t[e].range)){i.to=t[e].range.slice(0)}}if(!i.to)continue;i.axisName=u;i.length=a._length;f.push(l);o[l]=i}}return o}function p(t,e,r){var n;var a=t._plots;var i=[];var o,s;for(n in a){var l=a[n];if(i.indexOf(l)!==-1)continue;var u=l.xaxis._id;var c=l.yaxis._id;var f=l.xaxis.range;var h=l.yaxis.range;l.xaxis._r=l.xaxis.range.slice();l.yaxis._r=l.yaxis.range.slice();if(r[u]){o=r[u].to}else{o=f}if(r[c]){s=r[c].to}else{s=h}if(f[0]===o[0]&&f[1]===o[1]&&h[0]===s[0]&&h[1]===s[1])continue;if(e.indexOf(u)!==-1||e.indexOf(c)!==-1){i.push(l)}}return i}var d=h(r);var v=Object.keys(d);var g=p(c,v,d);function m(){function t(t,r,n){for(var a=0;a rect").call(i.setTranslate,0,0).call(i.setScale,1,1);t.plot.call(i.setTranslate,e._offset,r._offset).call(i.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(i.setPointGroupScale,1,1);n.selectAll(".textpoint").call(i.setTextPointsScale,1,1);n.call(i.hideOutsideRangePoints,t)}function b(t,r){var n,a,o;var s=d[t.xaxis._id];var l=d[t.yaxis._id];var u=[];if(s){n=e._fullLayout[s.axisName];a=n._r;o=s.to;u[0]=(a[0]*(1-r)+r*o[0]-a[0])/(a[1]-a[0])*t.xaxis._length;var c=a[1]-a[0];var f=o[1]-o[0];n.range[0]=a[0]*(1-r)+r*o[0];n.range[1]=a[1]*(1-r)+r*o[1];u[2]=t.xaxis._length*(1-r+r*f/c)}else{u[0]=0;u[2]=t.xaxis._length}if(l){n=e._fullLayout[l.axisName];a=n._r;o=l.to;u[1]=(a[1]*(1-r)+r*o[1]-a[1])/(a[0]-a[1])*t.yaxis._length;var h=a[1]-a[0];var p=o[1]-o[0];n.range[0]=a[0]*(1-r)+r*o[0];n.range[1]=a[1]*(1-r)+r*o[1];u[3]=t.yaxis._length*(1-r+r*p/h)}else{u[1]=0;u[3]=t.yaxis._length}y(t.xaxis,t.yaxis);var v=t.xaxis;var g=t.yaxis;var m=!!s;var x=!!l;var b=m?v._length/u[2]:1,_=x?g._length/u[3]:1;var w=m?u[0]:0,k=x?u[1]:0;var M=m?u[0]/u[2]*v._length:0,A=x?u[1]/u[3]*g._length:0;var T=v._offset-M,S=g._offset-A;t.clipRect.call(i.setTranslate,w,k).call(i.setScale,1/b,1/_);t.plot.call(i.setTranslate,T,S).call(i.setScale,b,_);i.setPointGroupScale(t.zoomScalePts,1/b,1/_);i.setTextPointsScale(t.zoomScaleTxt,1/b,1/_)}var _;if(u){_=u()}function w(){var t={};for(var r=0;rl.duration){w();T=window.cancelAnimationFrame(E)}else{T=window.requestAnimationFrame(E)}}M=Date.now();T=window.requestAnimationFrame(E);return Promise.resolve()}},{"../../components/drawing":583,"../../registry":817,"./axes":732,"./constants":737,d3:147}],755:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("./axis_autotype");var i=t("./axis_ids").name2id;e.exports=function t(e,r,n,a,s){if(s){r._name=s;r._id=i(s)}var l=n("type");if(l==="-"){o(r,a);if(r.type==="-"){r.type="linear"}else{e.type=r.type}}};function o(t,e){if(t.type!=="-")return;var r=t._id;var i=r.charAt(0);if(r.indexOf("scene")!==-1)r=i;var o=s(e,r,i);if(!o)return;if(o.type==="histogram"&&i==={v:"y",h:"x"}[o.orientation||"v"]){t.type="linear";return}var c=i+"calendar";var f=o[c];var h;if(u(o,i)){var p=l(o);var d=[];for(h=0;h0&&a["_"+r+"axes"][e]){return a}if((a[r+"axis"]||r)===e){if(u(a,r)){return a}else if((a[r]||[]).length||a[r+"0"]){return a}}}}function l(t){return{v:"x",h:"y"}[t.orientation||"v"]}function u(t,e){var r=l(t),a=n.traceIs(t,"box-violin"),i=n.traceIs(t._fullInput||{},"candlestick");return a&&!i&&e===r&&t[r]===undefined&&t[r+"0"]===undefined}},{"../../registry":817,"./axis_autotype":733,"./axis_ids":735}],756:[function(t,e,r){"use strict";var n=t("../registry");var a=t("../lib");r.manageCommandObserver=function(t,e,n,o){var s={};var l=true;if(e&&e._commandObserver){s=e._commandObserver}if(!s.cache){s.cache={}}s.lookupTable={};var u=r.hasSimpleAPICommandBindings(t,n,s.lookupTable);if(e&&e._commandObserver){if(!u){if(e._commandObserver.remove){e._commandObserver.remove();e._commandObserver=null;return s}}else{return s}}if(u){i(t,u,s.cache);s.check=function e(){if(!l)return;var r=i(t,u,s.cache);if(r.changed&&o){if(s.lookupTable[r.value]!==undefined){s.disable();Promise.resolve(o({value:r.value,type:u.type,prop:u.prop,traces:u.traces,index:s.lookupTable[r.value]})).then(s.enable,s.enable)}}return r.changed};var c=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"];for(var f=0;f0?".":"")+i;if(a.isPlainObject(o)){u(o,e,s,n+1)}else{e(s,i,o)}})}},{"../lib":684,"../registry":817}],757:[function(t,e,r){"use strict";var n=t("../lib/extend").extendFlat;r.attributes=function(t,e){t=t||{};e=e||{};var r={valType:"info_array",editType:t.editType,items:[{valType:"number",min:0,max:1,editType:t.editType},{valType:"number",min:0,max:1,editType:t.editType}],dflt:[0,1]};var a=t.name?t.name+" ":"";var i=t.trace?"trace ":"subplot ";var o=e.description?" "+e.description:"";var s={x:n({},r,{}),y:n({},r,{}),editType:t.editType};if(!t.noGridCell){s.row={valType:"integer",min:0,dflt:0,editType:t.editType};s.column={valType:"integer",min:0,dflt:0,editType:t.editType}}return s};r.defaults=function(t,e,r,n){var a=n&&n.x||[0,1];var i=n&&n.y||[0,1];var o=e.grid;if(o){var s=r("domain.column");if(s!==undefined){if(so}else{return false}};a.getPath=function(){return n.geo.path().projection(a)};a.getBounds=function(t){return a.getPath().bounds(t)};a.fitExtent=function(t,e){var r=t[1][0]-t[0][0];var n=t[1][1]-t[0][1];var i=a.clipExtent&&a.clipExtent();a.scale(150).translate([0,0]);if(i)a.clipExtent(null);var o=a.getBounds(e);var s=Math.min(r/(o[1][0]-o[0][0]),n/(o[1][1]-o[0][1]));var l=+t[0][0]+(r-s*(o[1][0]+o[0][0]))/2;var u=+t[0][1]+(n-s*(o[1][1]+o[0][1]))/2;if(i)a.clipExtent(i);return a.scale(s*150).translate([l,u])};a.precision(d.precision);if(i){a.clipAngle(i-d.clipPad)}return a}function b(t,e){var r=e[t];var a=r.dtick;var i=d.scopeDefaults[e.scope];var o=i.lonaxisRange;var s=i.lataxisRange;var l=t==="lonaxis"?[a]:[0,a];return n.geo.graticule().extent([[o[0],s[0]],[o[1],s[1]]]).step(l)}function _(t,e){var r=d.clipPad;var n=t[0]+r;var a=t[1]-r;var i=e[0]+r;var o=e[1]-r;if(n>0&&a<0)a+=360;var s=(a-n)/4;return{type:"Polygon",coordinates:[[[n,i],[n,o],[n+s,o],[n+2*s,o],[n+3*s,o],[a,o],[a,i],[a-s,i],[a-2*s,i],[a-3*s,i],[n,i]]]}}},{"../../components/color":558,"../../components/dragelement":580,"../../components/drawing":583,"../../components/fx":600,"../../lib":684,"../../lib/topojson_utils":711,"../../registry":817,"../cartesian/axes":732,"../cartesian/select":749,"../plots":795,"./constants":760,"./projections":766,"./zoom":767,d3:147,"topojson-client":502}],762:[function(t,e,r){"use strict";var n=t("./geo");var a=t("../../plots/get_data").getSubplotCalcData;var i=t("../../lib").counterRegex;var o="geo";r.name=o;r.attr=o;r.idRoot=o;r.idRegex=r.attrRegex=i(o);r.attributes=t("./layout/attributes");r.layoutAttributes=t("./layout/layout_attributes");r.supplyLayoutDefaults=t("./layout/defaults");r.plot=function t(e){var r=e._fullLayout;var i=e.calcdata;var s=r._subplots[o];if(window.PlotlyGeoAssets===undefined){window.PlotlyGeoAssets={topojson:{}}}for(var l=0;l0&&M<0)M+=360;var A=(k+M)/2;var T;if(!c){var S=f?l.projRotate:[A,0,0];T=r("projection.rotation.lon",S[0]);r("projection.rotation.lat",S[1]);r("projection.rotation.roll",S[2]);n=r("showcoastlines",!f);if(n){r("coastlinecolor");r("coastlinewidth")}n=r("showocean");if(n)r("oceancolor")}var E;var C;if(c){E=-96.6;C=38.7}else{E=f?A:T;C=(w[0]+w[1])/2}r("center.lon",E);r("center.lat",C);if(h){var L=l.projParallels||[0,60];r("projection.parallels",L)}r("projection.scale");n=r("showland");if(n)r("landcolor");n=r("showlakes");if(n)r("lakecolor");n=r("showrivers");if(n){r("rivercolor");r("riverwidth")}n=r("showcountries",f&&s!=="usa");if(n){r("countrycolor");r("countrywidth")}if(s==="usa"||s==="north america"&&i===50){r("showsubunits",true);r("subunitcolor");r("subunitwidth")}if(!f){n=r("showframe",true);if(n){r("framecolor");r("framewidth")}}r("bgcolor")}},{"../../subplot_defaults":809,"../constants":760,"./layout_attributes":765}],765:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes");var a=t("../../domain").attributes;var i=t("../constants");var o=t("../../../plot_api/edit_types").overrideAll;var s={range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},showgrid:{valType:"boolean",dflt:false},tick0:{valType:"number"},dtick:{valType:"number"},gridcolor:{valType:"color",dflt:n.lightLine},gridwidth:{valType:"number",min:0,dflt:1}};e.exports=o({domain:a({name:"geo"},{}),resolution:{valType:"enumerated",values:[110,50],dflt:110,coerceNumber:true},scope:{valType:"enumerated",values:Object.keys(i.scopeDefaults),dflt:"world"},projection:{type:{valType:"enumerated",values:Object.keys(i.projNames)},rotation:{lon:{valType:"number"},lat:{valType:"number"},roll:{valType:"number"}},parallels:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},scale:{valType:"number",min:0,dflt:1}},center:{lon:{valType:"number"},lat:{valType:"number"}},showcoastlines:{valType:"boolean"},coastlinecolor:{valType:"color",dflt:n.defaultLine},coastlinewidth:{valType:"number",min:0,dflt:1},showland:{valType:"boolean",dflt:false},landcolor:{valType:"color",dflt:i.landColor},showocean:{valType:"boolean",dflt:false},oceancolor:{valType:"color",dflt:i.waterColor},showlakes:{valType:"boolean",dflt:false},lakecolor:{valType:"color",dflt:i.waterColor},showrivers:{valType:"boolean",dflt:false},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"},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:s,lataxis:s},"plot","from-root")},{"../../../components/color/attributes":557,"../../../plot_api/edit_types":715,"../../domain":757,"../constants":760}],766:[function(t,e,r){"use strict";function n(t){t.geo.project=function(t,e){var a=e.stream;if(!a)throw new Error("not yet supported");return(t&&n.hasOwnProperty(t.type)?n[t.type]:r)(t,a)};function e(t,e){return{type:"Feature",id:t.id,properties:t.properties,geometry:r(t.geometry,e)}}function r(e,n){if(!e)return null;if(e.type==="GeometryCollection")return{type:"GeometryCollection",geometries:object.geometries.map(function(t){return r(t,n)})};if(!u.hasOwnProperty(e.type))return null;var a=u[e.type];t.geo.stream(e,n(a));return a.result()}var n={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}};var a=[],i=[];var o={point:function(t,e){a.push([t,e])},result:function(){var t=!a.length?null:a.length<2?{type:"Point",coordinates:a[0]}:{type:"MultiPoint",coordinates:a};a=[];return t}};var s={lineStart:c,point:function(t,e){a.push([t,e])},lineEnd:function(){if(a.length)i.push(a),a=[]},result:function(){var t=!i.length?null:i.length<2?{type:"LineString",coordinates:i[0]}:{type:"MultiLineString",coordinates:i};i=[];return t}};var l={polygonStart:c,lineStart:c,point:function(t,e){a.push([t,e])},lineEnd:function(){var t=a.length;if(t){do{a.push(a[0].slice())}while(++t<4);i.push(a),a=[]}},polygonEnd:c,result:function(){if(!i.length)return null;var t=[],e=[];i.forEach(function(r){if(f(r))t.push([r]);else e.push(r)});e.forEach(function(e){var r=e[0];t.some(function(t){if(h(t[0],r)){t.push(e);return true}})||t.push([e])});i=[];return!t.length?null:t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}}};var u={Point:o,MultiPoint:o,LineString:s,MultiLineString:s,Polygon:l,MultiPolygon:l,Sphere:l};function c(){}function f(t){if((r=t.length)<4)return false;var e=0,r,n=t[r-1][1]*t[0][0]-t[r-1][0]*t[0][1];while(++en^p>n&&r<(h-u)*(n-c)/(p-c)+u)a=!a}return a}var p=1e-6,d=p*p,v=Math.PI,g=v/2,m=Math.sqrt(v),y=v/180,x=180/v;function b(t){return t?t/Math.sin(t):1}function _(t){return t>0?1:t<0?-1:0}function w(t){return t>1?g:t<-1?-g:Math.asin(t)}function k(t){return t>1?0:t<-1?v:Math.acos(t)}function M(t){return t>0?Math.sqrt(t):0}var A=t.geo.projection,T=t.geo.projectionMutator;t.geo.interrupt=function(e){var r=[[[[-v,0],[0,g],[v,0]]],[[[-v,0],[0,-g],[v,0]]]];var n;function a(t,n){var a=n<0?-1:+1,i=r[+(n<0)];for(var o=0,s=i.length-1;oi[o][2][0];++o);var l=e(t-i[o][1][0],n);l[0]+=e(i[o][1][0],a*n>a*i[o][0][1]?i[o][0][1]:n)[0];return l}function i(){n=r.map(function(t){return t.map(function(t){var r=e(t[0][0],t[0][1])[0],n=e(t[2][0],t[2][1])[0],a=e(t[1][0],t[0][1])[1],i=e(t[1][0],t[1][1])[1],o;if(a>i)o=a,a=i,i=o;return[[r,a],[n,i]]})})}if(e.invert)a.invert=function(t,i){var o=n[+(i<0)],s=r[+(i<0)];for(var l=0,u=o.length;l=0;--a){var o=r[1][a],s=o[0][0]*180/v,l=o[0][1]*180/v,c=o[1][1]*180/v,f=o[2][0]*180/v,h=o[2][1]*180/v;n.push(u([[f-e,h-e],[f-e,c+e],[s+e,c+e],[s+e,l-e]],30))}return{type:"Polygon",coordinates:[t.merge(n)]}}function u(t,e){var r=-1,n=t.length,a=t[0],i,o,s,l=[];while(++rp;n++){var i=Math.cos(e);e-=a=(e+Math.sin(e)*(i+2)-r)/(2*i*(1+i))}return[2/Math.sqrt(v*(4+v))*t*(1+Math.cos(e)),2*Math.sqrt(v/(4+v))*Math.sin(e)]}S.invert=function(t,e){var r=.5*e*Math.sqrt((4+v)/v),n=w(r),a=Math.cos(n);return[t/(2/Math.sqrt(v*(4+v))*(1+a)),w((n+r*(a+2))/(2+g))]};(t.geo.eckert4=function(){return A(S)}).raw=S;var E=t.geo.azimuthalEqualArea.raw;function C(t,e){if(arguments.length<2)e=t;if(e===1)return E;if(e===Infinity)return I;function r(r,n){var a=E(r/e,n);a[0]*=t;return a}r.invert=function(r,n){var a=E.invert(r/t,n);a[0]*=e;return a};return r}function L(){var t=2,e=T(C),r=e(t);r.coefficient=function(r){if(!arguments.length)return t;return e(t=+r)};return r}function I(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}I.invert=function(t,e){var r=2*w(e/2);return[t*Math.cos(r/2)/Math.cos(r),r]};(t.geo.hammer=L).raw=C;function z(t,e){return[3*t/(2*v)*Math.sqrt(v*v/3-e*e),e]}z.invert=function(t,e){return[2/3*v*t/Math.sqrt(v*v/3-e*e),e]};(t.geo.kavrayskiy7=function(){return A(z)}).raw=z;function P(t,e){return[t,1.25*Math.log(Math.tan(v/4+.4*e))]}P.invert=function(t,e){return[t,2.5*Math.atan(Math.exp(.8*e))-.625*v]};(t.geo.miller=function(){return A(P)}).raw=P;function O(t){return function(e){var r=t*Math.sin(e),n=30,a;do{e-=a=(e+Math.sin(e)-r)/(1+Math.cos(e))}while(Math.abs(a)>p&&--n>0);return e/2}}function D(t,e,r){var n=O(r);function a(r,a){return[t*r*Math.cos(a=n(a)),e*Math.sin(a)]}a.invert=function(n,a){var i=w(a/e);return[n/(t*Math.cos(i)),w((2*i+Math.sin(2*i))/r)]};return a}var R=O(v),B=D(Math.SQRT2/g,Math.SQRT2,v);(t.geo.mollweide=function(){return A(B)}).raw=B;function F(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)))]}F.invert=function(t,e){var r=e,n=25,a;do{var i=r*r,o=i*i;r-=a=(r*(1.007226+i*(.015085+o*(-.044475+.028874*i-.005916*o)))-e)/(1.007226+i*(.015085*3+o*(-.044475*7+.028874*9*i-.005916*11*o)))}while(Math.abs(a)>p&&--n>0);return[t/(.8707+(i=r*r)*(-.131979+i*(-.013791+i*i*i*(.003971-.001529*i)))),r]};(t.geo.naturalEarth=function(){return A(F)}).raw=F;var N=[[.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]];N.forEach(function(t){t[1]*=1.0144});function j(t,e){var r=Math.min(18,Math.abs(e)*36/v),n=Math.floor(r),a=r-n,i=(f=N[n])[0],o=f[1],s=(f=N[++n])[0],l=f[1],u=(f=N[Math.min(19,++n)])[0],c=f[1],f;return[t*(s+a*(u-i)/2+a*a*(u-2*s+i)/2),(e>0?g:-g)*(l+a*(c-o)/2+a*a*(c-2*l+o)/2)]}j.invert=function(t,e){var r=e/g,n=r*90,a=Math.min(18,Math.abs(n/5)),i=Math.max(0,Math.floor(a));do{var o=N[i][1],s=N[i+1][1],l=N[Math.min(19,i+2)][1],u=l-o,c=l-2*s+o,f=2*(Math.abs(r)-s)/u,h=c/u,p=f*(1-h*f*(1-2*h*f));if(p>=0||i===1){n=(e>=0?5:-5)*(p+a);var v=50,m;do{a=Math.min(18,Math.abs(n)/5);i=Math.floor(a);p=a-i;o=N[i][1];s=N[i+1][1];l=N[Math.min(19,i+2)][1];n-=(m=(e>=0?g:-g)*(s+p*(l-o)/2+p*p*(l-2*s+o)/2)-e)*x}while(Math.abs(m)>d&&--v>0);break}}while(--i>=0);var b=N[i][0],_=N[i+1][0],w=N[Math.min(19,i+2)][0];return[t/(_+p*(w-b)/2+p*p*(w-2*_+b)/2),n*y]};(t.geo.robinson=function(){return A(j)}).raw=j;function V(t,e){return[t*Math.cos(e),e]}V.invert=function(t,e){return[t/Math.cos(e),e]};(t.geo.sinusoidal=function(){return A(V)}).raw=V;function U(t,e){var r=Math.cos(e),n=b(k(r*Math.cos(t/=2)));return[2*r*Math.sin(t)*n,Math.sin(e)*n]}U.invert=function(t,e){if(t*t+4*e*e>v*v+p)return;var r=t,n=e,a=25;do{var i=Math.sin(r),o=Math.sin(r/2),s=Math.cos(r/2),l=Math.sin(n),u=Math.cos(n),c=Math.sin(2*n),f=l*l,h=u*u,d=o*o,g=1-h*s*s,m=g?k(u*s)*Math.sqrt(y=1/g):y=0,y,x=2*m*u*o-t,b=m*l-e,_=y*(h*d+m*u*s*f),w=y*(.5*i*c-m*2*l*o),M=y*.25*(c*o-m*l*h*i),A=y*(f*s+m*d*u),T=w*M-A*_;if(!T)break;var S=(b*w-x*A)/T,E=(x*M-b*_)/T;r-=S,n-=E}while((Math.abs(S)>p||Math.abs(E)>p)&&--a>0);return[r,n]};(t.geo.aitoff=function(){return A(U)}).raw=U;function q(t,e){var r=U(t,e);return[(r[0]+t/g)/2,(r[1]+e)/2]}q.invert=function(t,e){var r=t,n=e,a=25;do{var i=Math.cos(n),o=Math.sin(n),s=Math.sin(2*n),l=o*o,u=i*i,c=Math.sin(r),f=Math.cos(r/2),h=Math.sin(r/2),d=h*h,v=1-u*f*f,m=v?k(i*f)*Math.sqrt(y=1/v):y=0,y,x=.5*(2*m*i*h+r/g)-t,b=.5*(m*o+n)-e,_=.5*y*(u*d+m*i*f*l)+.5/g,w=y*(c*s/4-m*o*h),M=.125*y*(s*h-m*o*u*c),A=.5*y*(l*f+m*d*i)+.5,T=w*M-A*_,S=(b*w-x*A)/T,E=(x*M-b*_)/T;r-=S,n-=E}while((Math.abs(S)>p||Math.abs(E)>p)&&--a>0);return[r,n]};(t.geo.winkel3=function(){return A(q)}).raw=q}e.exports=n},{}],767:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../lib");var i=Math.PI/180;var o=180/Math.PI;var s={cursor:"pointer"};var l={cursor:"auto"};function u(t,e){var r=t.projection;var n;if(e._isScoped){n=h}else if(e._isClipped){n=d}else{n=p}return n(t,r)}e.exports=u;function c(t,e){return n.behavior.zoom().translate(e.translate()).scale(e.scale())}function f(t,e,r){var n=t.id;var i=t.graphDiv;var o=i.layout[n];var s=i._fullLayout[n];var l={};function u(t,e){var r=a.nestedProperty(s,t);if(r.get()!==e){r.set(e);a.nestedProperty(o,t).set(e);l[n+"."+t]=e}}r(u);u("projection.scale",e.scale()/t.fitScale);i.emit("plotly_relayout",l)}function h(t,e){var r=c(t,e);function a(){n.select(this).style(s)}function i(){e.scale(n.event.scale).translate(n.event.translate);t.render()}function o(r){var n=e.invert(t.midPt);r("center.lon",n[0]);r("center.lat",n[1])}function u(){n.select(this).style(l);f(t,e,o)}r.on("zoomstart",a).on("zoom",i).on("zoomend",u);return r}function p(t,e){var r=c(t,e);var a=2;var i,o,u,h,p,d,v,g;function m(t){return e.invert(t)}function y(t){var r=e(m(t));return Math.abs(r[0]-t[0])>a||Math.abs(r[1]-t[1])>a}function x(){n.select(this).style(s);i=n.mouse(this);o=e.rotate();u=e.translate();h=o;p=m(i)}function b(){d=n.mouse(this);if(y(i)){r.scale(e.scale());r.translate(e.translate());return}e.scale(n.event.scale);e.translate([u[0],n.event.translate[1]]);if(!p){i=d;p=m(i)}else if(m(d)){g=m(d);v=[h[0]+(g[0]-p[0]),o[1],o[2]];e.rotate(v);h=v}t.render()}function _(){n.select(this).style(l);f(t,e,w)}function w(r){var n=e.rotate();var a=e.invert(t.midPt);r("projection.rotation.lon",-n[0]);r("center.lon",a[0]);r("center.lat",a[1])}r.on("zoomstart",x).on("zoom",b).on("zoomend",_);return r}function d(t,e){var r={r:e.rotate(),k:e.scale()},a=c(t,e),i=S(a,"zoomstart","zoom","zoomend"),o=0,u=a.on;var h;a.on("zoomstart",function(){n.select(this).style(s);var t=n.mouse(this),o=e.rotate(),l=o,c=e.translate(),f=g(o);h=v(e,t);u.call(a,"zoom",function(){var a=n.mouse(this);e.scale(r.k=n.event.scale);if(!h){t=a;h=v(e,t)}else if(v(e,a)){e.rotate(o).translate(c);var s=v(e,a),u=y(h,s),p=k(m(f,u)),g=r.r=x(p,h,l);if(!isFinite(g[0])||!isFinite(g[1])||!isFinite(g[2])){g=l}e.rotate(g);l=g}d(i.of(this,arguments))});p(i.of(this,arguments))}).on("zoomend",function(){n.select(this).style(l);u.call(a,"zoom",null);b(i.of(this,arguments));f(t,e,_)}).on("zoom.redraw",function(){t.render()});function p(t){if(!o++)t({type:"zoomstart"})}function d(t){t({type:"zoom"})}function b(t){if(!--o)t({type:"zoomend"})}function _(t){var r=e.rotate();t("projection.rotation.lon",-r[0]);t("projection.rotation.lat",-r[1])}return n.rebind(a,i,"on")}function v(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&M(r)}function g(t){var e=.5*t[0]*i,r=.5*t[1]*i,n=.5*t[2]*i,a=Math.sin(e),o=Math.cos(e),s=Math.sin(r),l=Math.cos(r),u=Math.sin(n),c=Math.cos(n);return[o*l*c+a*s*u,a*l*c-o*s*u,o*s*c+a*l*u,o*l*u-a*s*c]}function m(t,e){var r=t[0],n=t[1],a=t[2],i=t[3],o=e[0],s=e[1],l=e[2],u=e[3];return[r*o-n*s-a*l-i*u,r*s+n*o+a*u-i*l,r*l-n*u+a*o+i*s,r*u+n*l-a*s+i*o]}function y(t,e){if(!t||!e)return;var r=T(t,e),n=Math.sqrt(A(r,r)),a=.5*Math.acos(Math.max(-1,Math.min(1,A(t,e)))),i=Math.sin(a)/n;return n&&[Math.cos(a),r[2]*i,-r[1]*i,r[0]*i]}function x(t,e,r){var n=w(e,2,t[0]);n=w(n,1,t[1]);n=w(n,0,t[2]-r[2]);var a=e[0],i=e[1],s=e[2],l=n[0],u=n[1],c=n[2],f=Math.atan2(i,a)*o,h=Math.sqrt(a*a+i*i),p,d;if(Math.abs(u)>h){d=(u>0?90:-90)-f;p=0}else{d=Math.asin(u/h)*o-f;p=Math.sqrt(h*h-u*u)}var v=180-d-2*f,g=(Math.atan2(c,l)-Math.atan2(s,p))*o,m=(Math.atan2(c,l)-Math.atan2(s,-p))*o;var y=b(r[0],r[1],d,g),x=b(r[0],r[1],v,m);if(y<=x)return[d,g,r[2]];else return[v,m,r[2]]}function b(t,e,r,n){var a=_(r-t),i=_(n-e);return Math.sqrt(a*a+i*i)}function _(t){return(t%360+540)%360-180}function w(t,e,r){var n=r*i,a=t.slice(),o=e===0?1:0,s=e===2?1:2,l=Math.cos(n),u=Math.sin(n);a[o]=t[o]*l-t[s]*u;a[s]=t[s]*l+t[o]*u;return a}function k(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*o,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*o,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*o]}function M(t){var e=t[0]*i,r=t[1]*i,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function A(t,e){var r=0;for(var n=0,a=t.length;nMath.abs(g)){u.boxEnd[1]=u.boxStart[1]+Math.abs(v)*w*(g>=0?1:-1);if(u.boxEnd[1]i[3]){u.boxEnd[1]=i[3];u.boxEnd[0]=u.boxStart[0]+(i[3]-u.boxStart[1])/Math.abs(w)}}else{u.boxEnd[0]=u.boxStart[0]+Math.abs(g)/w*(v>=0?1:-1);if(u.boxEnd[0]i[2]){u.boxEnd[0]=i[2];u.boxEnd[1]=u.boxStart[1]+(i[2]-u.boxStart[0])*Math.abs(w)}}}else{if(b)u.boxEnd[0]=u.boxStart[0];if(_)u.boxEnd[1]=u.boxStart[1]}}else if(u.boxEnabled){v=u.boxStart[0]!==u.boxEnd[0];g=u.boxStart[1]!==u.boxEnd[1];if(v||g){if(v){m(0,u.boxStart[0],u.boxEnd[0]);t.xaxis.autorange=false}if(g){m(1,u.boxStart[1],u.boxEnd[1]);t.yaxis.autorange=false}t.relayoutCallback()}else{t.glplot.setDirty()}u.boxEnabled=false;u.boxInited=false}else if(u.boxInited){u.boxInited=false}break;case"pan":u.boxEnabled=false;u.boxInited=false;if(e){if(!u.panning){u.dragStart[0]=n;u.dragStart[1]=a}if(Math.abs(u.dragStart[0]-n)Math.abs(e)){u.rotate(i,0,0,-t*r*Math.PI*d.rotateSpeed/window.innerWidth)}else{var o=-d.zoomSpeed*a*e/window.innerHeight*(i-u.lastT())/20;u.pan(i,0,0,f*(Math.exp(o)-1))}},true);return d}},{"3d-view":43,"has-passive-events":379,"mouse-change":402,"mouse-event-offset":403,"mouse-wheel":405,"right-now":465}],774:[function(t,e,r){"use strict";var n=t("../../plot_api/edit_types").overrideAll;var a=t("../../components/fx/layout_attributes");var i=t("./scene");var o=t("../get_data").getSubplotData;var s=t("../../lib");var l=t("../../constants/xmlns_namespaces");var u="gl3d";var c="scene";r.name=u;r.attr=c;r.idRoot=c;r.idRegex=r.attrRegex=s.counterRegex("scene");r.attributes=t("./layout/attributes");r.layoutAttributes=t("./layout/layout_attributes");r.baseLayoutAttrOverrides=n({hoverlabel:a.hoverlabel},"plot","nested");r.supplyLayoutDefaults=t("./layout/defaults");r.plot=function t(e){var r=e._fullLayout;var n=e._fullData;var a=r._subplots[u];for(var l=0;l1;function s(t){if(i)return;var r=n.validate(e[t],l[t]);if(r)return e[t]}o(e,r,a,{type:"gl3d",attributes:l,handleDefaults:u,fullLayout:r,font:r.font,fullData:a,getDfltFromLayout:s,paper_bgcolor:r.paper_bgcolor,calendar:r.calendar})};function u(t,e,r,n){var o=r("bgcolor"),l=a.combine(o,n.paper_bgcolor);var u=["up","center","eye"];for(var c=0;c")}else{M=c.textLabel}if(t.fullSceneLayout.hovermode){u.loneHover({x:(.5+.5*v[0]/v[3])*a,y:(.5-.5*v[1]/v[3])*i,xLabel:_,yLabel:w,zLabel:k,text:M,name:s.name,color:u.castHoverOption(e,m,"bgcolor")||s.color,borderColor:u.castHoverOption(e,m,"bordercolor"),fontFamily:u.castHoverOption(e,m,"font.family"),fontSize:u.castHoverOption(e,m,"font.size"),fontColor:u.castHoverOption(e,m,"font.color")},{container:r,gd:t.graphDiv})}var T={x:c.traceCoordinate[0],y:c.traceCoordinate[1],z:c.traceCoordinate[2],data:e._input,fullData:e,curveNumber:e.index,pointNumber:m};if(e._module.eventData){T=e._module.eventData(T,c,e,{},m)}u.appendArrayPointValue(T,e,m);var S={points:[T]};if(c.buttons&&c.distance<5){t.graphDiv.emit("plotly_click",S)}else{t.graphDiv.emit("plotly_hover",S)}d=S}else{u.loneUnhover(r);t.graphDiv.emit("plotly_unhover",d)}t.drawAnnotations(t)}function b(t,e,r,o){var l={canvas:r,gl:o,container:t.container,axes:t.axesOptions,spikes:t.spikeOptions,pickRadius:10,snapToData:true,autoScale:true,autoBounds:false};if(t.staticMode){if(!y){m=document.createElement("canvas");y=a({canvas:m,preserveDrawingBuffer:true,premultipliedAlpha:true,antialias:true});if(!y){throw new Error("error creating static canvas/context for image server")}}l.pixelRatio=t.pixelRatio;l.gl=y;l.canvas=m}try{t.glplot=n(l)}catch(e){return f(t)}var u=function(t){if(t.fullSceneLayout.dragmode===false)return;var e={};e[t.id+".camera"]=T(t.camera);t.saveCamera(t.graphDiv.layout);t.graphDiv.emit("plotly_relayout",e)};t.glplot.canvas.addEventListener("mouseup",u.bind(null,t));t.glplot.canvas.addEventListener("wheel",u.bind(null,t),i?{passive:false}:false);if(!t.staticMode){t.glplot.canvas.addEventListener("webglcontextlost",function(t){s.warn("Lost WebGL context.");t.preventDefault()})}if(!t.camera){var c=t.fullSceneLayout.camera;t.camera=h(t.container,{center:[c.center.x,c.center.y,c.center.z],eye:[c.eye.x,c.eye.y,c.eye.z],up:[c.up.x,c.up.y,c.up.z],zoomMin:.1,zoomMax:100,mode:"orbit"})}t.glplot.camera=t.camera;t.glplot.oncontextloss=function(){t.recoverContext()};t.glplot.onrender=x.bind(null,t);t.traces={};return true}function _(t,e){var r=document.createElement("div");var n=t.container;this.graphDiv=t.graphDiv;var a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.style.position="absolute";a.style.top=a.style.left="0px";a.style.width=a.style.height="100%";a.style["z-index"]=20;a.style["pointer-events"]="none";r.appendChild(a);this.svgContainer=a;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.fullSceneLayout=e[this.id];this.plotArgs=[[],{},{}];this.axesOptions=d(e[this.id]);this.spikeOptions=v(e[this.id]);this.container=r;this.staticMode=!!t.staticPlot;this.pixelRatio=t.plotGlPixelRatio||2;this.dataScale=[1,1,1];this.contourLevels=[[],[],[]];this.convertAnnotations=o.getComponentMethod("annotations3d","convert");this.drawAnnotations=o.getComponentMethod("annotations3d","draw");if(!b(this,e))return}var w=_.prototype;w.recoverContext=function(){var t=this;var e=this.glplot.gl;var r=this.glplot.canvas;this.glplot.dispose();function n(){if(e.isContextLost()){requestAnimationFrame(n);return}if(!b(t,t.fullLayout,r,e)){s.error("Catastrophic and unrecoverable WebGL error. Context lost.");return}t.plot.apply(t,t.plotArgs)}requestAnimationFrame(n)};var k=["xaxis","yaxis","zaxis"];function M(t,e,r){var n=t.fullSceneLayout;for(var a=0;a<3;a++){var i=k[a];var o=i.charAt(0);var l=n[i];var u=e[o];var c=e[o+"calendar"];var f=e["_"+o+"length"];if(!s.isArrayOrTypedArray(u)){r[0][a]=Math.min(r[0][a],0);r[1][a]=Math.max(r[1][a],f-1)}else{var h;for(var p=0;p<(f||u.length);p++){if(s.isArrayOrTypedArray(u[p])){for(var d=0;dh[1][o]){p[o]=1}else{if(h[1][o]===h[0][o]){p[o]=1}else{p[o]=1/(h[1][o]-h[0][o])}}}this.dataScale=p;this.convertAnnotations(this);for(i=0;iv[1][i]){v[0][i]=-1;v[1][i]=1}else{var E=v[1][i]-v[0][i];v[0][i]-=E/32;v[1][i]+=E/32}}else{var C=s.range;v[0][i]=s.r2l(C[0]);v[1][i]=s.r2l(C[1])}if(v[0][i]===v[1][i]){v[0][i]-=1;v[1][i]+=1}g[i]=v[1][i]-v[0][i];this.glplot.bounds[0][i]=v[0][i]*p[i];this.glplot.bounds[1][i]=v[1][i]*p[i]}var L=[1,1,1];for(i=0;i<3;++i){s=u[k[i]];l=s.type;var I=m[l];L[i]=Math.pow(I.acc,1/I.count)/p[i]}var z=4;var P;if(u.aspectmode==="auto"){if(Math.max.apply(null,L)/Math.min.apply(null,L)<=z){P=L}else{P=[1,1,1]}}else if(u.aspectmode==="cube"){P=[1,1,1]}else if(u.aspectmode==="data"){P=L}else if(u.aspectmode==="manual"){var O=u.aspectratio;P=[O.x,O.y,O.z]}else{throw new Error("scene.js aspectRatio was not one of the enumerated types")}u.aspectratio.x=f.aspectratio.x=P[0];u.aspectratio.y=f.aspectratio.y=P[1];u.aspectratio.z=f.aspectratio.z=P[2];this.glplot.aspect=P;var D=u.domain||null,R=e._size||null;if(D&&R){var B=this.container.style;B.position="absolute";B.left=R.l+D.x[0]*R.w+"px";B.top=R.t+(1-D.y[1])*R.h+"px";B.width=R.w*(D.x[1]-D.x[0])+"px";B.height=R.h*(D.y[1]-D.y[0])+"px"}this.glplot.redraw()};w.destroy=function(){if(!this.glplot)return;this.camera.mouseListener.enabled=false;this.container.removeEventListener("wheel",this.camera.wheelListener);this.camera=this.glplot.camera=null;this.glplot.dispose();this.container.parentNode.removeChild(this.container);this.glplot=null};function A(t){return[[t.eye.x,t.eye.y,t.eye.z],[t.center.x,t.center.y,t.center.z],[t.up.x,t.up.y,t.up.z]]}function T(t){return{up:{x:t.up[0],y:t.up[1],z:t.up[2]},center:{x:t.center[0],y:t.center[1],z:t.center[2]},eye:{x:t.eye[0],y:t.eye[1],z:t.eye[2]}}}w.getCamera=function t(){this.glplot.camera.view.recalcMatrix(this.camera.view.lastT());return T(this.glplot.camera)};w.setCamera=function t(e){this.glplot.camera.lookAt.apply(this,A(e))};w.saveCamera=function t(e){var r=this.getCamera(),n=s.nestedProperty(e,this.id+".camera"),a=n.get(),i=false;function o(t,e,r,n){var a=["up","center","eye"],i=["x","y","z"];return e[a[r]]&&t[a[r]][i[n]]===e[a[r]][i[n]]}if(a===undefined)i=true;else{for(var l=0;l<3;l++){for(var u=0;u<3;u++){if(!o(r,a,l,u)){i=true;break}}}}if(i)n.set(r);return i};w.updateFx=function(t,e){var r=this.camera;if(r){if(t==="orbit"){r.mode="orbit";r.keyBindingMode="rotate"}else if(t==="turntable"){r.up=[0,0,1];r.mode="turntable";r.keyBindingMode="rotate"}else{r.keyBindingMode=t}}this.fullSceneLayout.hovermode=e};w.toImage=function(t){if(!t)t="png";if(this.staticMode)this.container.appendChild(m);this.glplot.redraw();var e=this.glplot.gl;var r=e.drawingBufferWidth;var n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var a=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,a);for(var i=0,o=n-1;i0)}function l(t){var e={},r={};switch(t.type){case"circle":n.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":n.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":n.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var i=t.symbol,o=a(i.textposition,i.iconsize);n.extendFlat(e,{"icon-image":i.icon+"-15","icon-size":i.iconsize/10,"text-field":i.text,"text-size":i.textfont.size,"text-anchor":o.anchor,"text-offset":o.offset});n.extendFlat(r,{"icon-color":t.color,"text-color":i.textfont.color,"text-opacity":t.opacity});break}return{layout:e,paint:r}}function u(t){var e=t.sourcetype;var r=t.source;var n={type:e};var a;if(e==="geojson"){a="data"}else if(e==="vector"){a=typeof r==="string"?"url":"tiles"}n[a]=r;return n}e.exports=function t(e,r,n){var a=new i(e,r);a.update(n);return a}},{"../../lib":684,"./convert_text_opts":788}],791:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("../../components/color").defaultLine;var i=t("../domain").attributes;var o=t("../font_attributes");var s=t("../../traces/scatter/attributes").textposition;var l=t("../../plot_api/edit_types").overrideAll;var u=t("../../plot_api/plot_template").templatedArray;var c=o({});c.family.dflt="Open Sans Regular, Arial Unicode MS Regular";e.exports=l({_arrayAttrRegexps:[n.counterRegex("mapbox",".layers",true)],domain:i({name:"mapbox"}),accesstoken:{valType:"string",noBlank:true,strict:true},style:{valType:"any",values:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],dflt:"basic"},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},layers:u("layer",{visible:{valType:"boolean",dflt:true},sourcetype:{valType:"enumerated",values:["geojson","vector"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},type:{valType:"enumerated",values:["circle","line","fill","symbol"],dflt:"circle"},below:{valType:"string",dflt:""},color:{valType:"color",dflt:a},opacity:{valType:"number",min:0,max:1,dflt:1},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2}},fill:{outlinecolor:{valType:"color",dflt:a}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},textfont:c,textposition:n.extendFlat({},s,{arrayOk:false})}})},"plot","from-root")},{"../../components/color":558,"../../lib":684,"../../plot_api/edit_types":715,"../../plot_api/plot_template":722,"../../traces/scatter/attributes":1015,"../domain":757,"../font_attributes":758}],792:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("../subplot_defaults");var i=t("../array_container_defaults");var o=t("./layout_attributes");e.exports=function t(e,r,n){a(e,r,n,{type:"mapbox",attributes:o,handleDefaults:s,partition:"y",accessToken:r._mapboxAccessToken})};function s(t,e,r,n){r("accesstoken",n.accessToken);r("style");r("center.lon");r("center.lat");r("zoom");r("bearing");r("pitch");i(t,e,{name:"layers",handleItemDefaults:l});e._input=t}function l(t,e){function r(r,a){return n.coerce(t,e,o.layers,r,a)}var a=r("visible");if(a){var i=r("sourcetype");r("source");if(i==="vector")r("sourcelayer");var s=r("type");r("below");r("color");r("opacity");if(s==="circle"){r("circle.radius")}if(s==="line"){r("line.width")}if(s==="fill"){r("fill.outlinecolor")}if(s==="symbol"){r("symbol.icon");r("symbol.iconsize");r("symbol.text");n.coerceFont(r,"symbol.textfont");r("symbol.textposition")}}}},{"../../lib":684,"../array_container_defaults":728,"../subplot_defaults":809,"./layout_attributes":791}],793:[function(t,e,r){"use strict";var n=t("mapbox-gl");var a=t("../../components/fx");var i=t("../../lib");var o=t("../../components/dragelement");var s=t("../cartesian/select").prepSelect;var l=t("./constants");var u=t("./layout_attributes");var c=t("./layers");function f(t){this.id=t.id;this.gd=t.gd;this.container=t.container;this.isStatic=t.staticPlot;var e=t.fullLayout;this.uid=e._uid+"-"+this.id;this.opts=e[this.id];this.div=null;this.xaxis=null;this.yaxis=null;this.createFramework(e);this.map=null;this.accessToken=null;this.styleObj=null;this.traceHash={};this.layerList=[]}var h=f.prototype;e.exports=function t(e){return new f(e)};h.plot=function(t,e,r){var n=this;var a=n.opts=e[this.id];if(n.map&&a.accesstoken!==n.accessToken){n.map.remove();n.map=null;n.styleObj=null;n.traceHash=[];n.layerList={}}var i;if(!n.map){i=new Promise(function(r,a){n.createMap(t,e,r,a)})}else{i=new Promise(function(r,a){n.updateMap(t,e,r,a)})}r.push(i)};h.createMap=function(t,e,r,i){var o=this;var s=o.gd;var u=o.opts;var c=o.styleObj=p(u.style);o.accessToken=u.accesstoken;var f=o.map=new n.Map({container:o.div,style:c.style,center:v(u.center),zoom:u.zoom,bearing:u.bearing,pitch:u.pitch,interactive:!o.isStatic,preserveDrawingBuffer:o.isStatic,doubleClickZoom:false,boxZoom:false});var h=l.controlContainerClassName;var d=o.div.getElementsByClassName(h)[0];o.div.removeChild(d);f._canvas.style.left="0px";f._canvas.style.top="0px";o.rejectOnError(i);f.once("load",function(){o.updateData(t);o.updateLayout(e);o.resolveOnRender(r)});if(o.isStatic)return;var g=false;f.on("moveend",function(t){if(!o.map)return;var e=o.getView();u._input.center=u.center=e.center;u._input.zoom=u.zoom=e.zoom;u._input.bearing=u.bearing=e.bearing;u._input.pitch=u.pitch=e.pitch;if(t.originalEvent||g){y(e)}g=false});f.on("wheel",function(){g=true});f.on("mousemove",function(t){var e=o.div.getBoundingClientRect();t.clientX=t.point.x+e.left;t.clientY=t.point.y+e.top;t.target.getBoundingClientRect=function(){return e};o.xaxis.p2c=function(){return t.lngLat.lng};o.yaxis.p2c=function(){return t.lngLat.lat};a.hover(s,t,o.id)});f.on("click",function(t){a.click(s,t.originalEvent)});function m(){a.loneUnhover(e._toppaper)}f.on("dragstart",m);f.on("zoomstart",m);f.on("dblclick",function(){s.emit("plotly_doubleclick",null);var t=o.viewInitial;f.setCenter(v(t.center));f.setZoom(t.zoom);f.setBearing(t.bearing);f.setPitch(t.pitch);var e=o.getView();u._input.center=u.center=e.center;u._input.zoom=u.zoom=e.zoom;u._input.bearing=u.bearing=e.bearing;u._input.pitch=u.pitch=e.pitch;y(e)});function y(t){var e=o.id;var r={};for(var n in t){r[e+"."+n]=t[n]}s.emit("plotly_relayout",r)}o.clearSelect=function(){s._fullLayout._zoomlayer.selectAll(".select-outline").remove()}};h.updateMap=function(t,e,r,n){var a=this;var i=a.map;a.rejectOnError(n);var o=p(a.opts.style);if(a.styleObj.id!==o.id){a.styleObj=o;i.setStyle(o.style);i.once("styledata",function(){a.traceHash={};a.updateData(t);a.updateLayout(e);a.resolveOnRender(r)})}else{a.updateData(t);a.updateLayout(e);a.resolveOnRender(r)}};h.updateData=function(t){var e=this.traceHash;var r,n,a,i;for(a=0;a=e.width-20){i["text-anchor"]="start";i.x=5}else{i["text-anchor"]="end";i.x=e._paper.attr("width")-7}r.attr(i);var o=r.select(".js-link-to-tool"),s=r.select(".js-link-spacer"),c=r.select(".js-sourcelinks");if(t._context.showSources)t._context.showSources(t);if(t._context.showLink)b(t,o);s.text(o.text()&&c.text()?" - ":"")};function b(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(){m.sendDataToCloud(t)})}else{var n=window.location.pathname.split("/");var a=window.location.search;r.attr({"xlink:xlink:show":"new","xlink:xlink:href":"/"+n[2].split(".")[0]+"/"+n[1]+a})}}m.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=(window.PLOTLYENV||{}).BASE_URL||t._context.plotlyServerURL;var r=n.select(t).append("div").attr("id","hiddenform").style("display","none");var a=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});var i=a.append("input").attr({type:"text",name:"data"});i.node().value=m.graphJson(t,false,"keepdata");a.node().submit();r.remove();t.emit("plotly_afterexport");return false};var _=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"];var w=["year","month","dayMonth","dayMonthYear"];m.supplyDefaults=function(t,e){var r=e&&e.skipUpdateCalc;var n=t._fullLayout||{};if(n._skipDefaults){delete n._skipDefaults;return}var a=t._fullLayout={};var o=t.layout||{};var s=t._fullData||[];var u=t._fullData=[];var c=t.data||[];var p=t.calcdata||[];var d=t._context||{};var y;if(!t._transitionData)m.createTransitionData(t);a._dfltTitle={plot:g(t,"Click to enter Plot title"),x:g(t,"Click to enter X axis title"),y:g(t,"Click to enter Y axis title"),colorbar:g(t,"Click to enter Colorscale title"),annotation:g(t,"new text")};a._traceWord=g(t,"trace");var x=T(t,_);a._mapboxAccessToken=d.mapboxAccessToken;if(n._initialAutoSizeIsDone){var b=n.width,M=n.height;m.supplyLayoutGlobalDefaults(o,a,x);if(!o.width)a.width=b;if(!o.height)a.height=M;m.sanitizeMargins(a)}else{m.supplyLayoutGlobalDefaults(o,a,x);var E=!o.width||!o.height,C=a.autosize,L=d.autosizable,I=E&&(C||L);if(I)m.plotAutoSize(t,o,a);else if(E)m.sanitizeMargins(a);if(!C&&E){o.width=a.width;o.height=a.height}}a._d3locale=S(x,a.separators);a._extraFormat=T(t,w);a._initialAutoSizeIsDone=true;a._dataLength=c.length;a._modules=[];a._basePlotModules=[];var z=a._subplots=A();var P=a._splomAxes={x:{},y:{}};var O=a._splomSubplots={};a._splomGridDflt={};a._requestRangeslider={};a._traceUids=k(s,c);a._globalTransforms=(t._context||{}).globalTransforms;m.supplyDataDefaults(c,u,o,a);var D=Object.keys(P.x);var R=Object.keys(P.y);if(D.length>1&&R.length>1){i.getComponentMethod("grid","sizeDefaults")(o,a);for(y=0;y15&&R.length>15&&a.shapes.length===0&&a.images.length===0;a._hasCartesian=a._has("cartesian");a._hasGeo=a._has("geo");a._hasGL3D=a._has("gl3d");a._hasGL2D=a._has("gl2d");a._hasTernary=a._has("ternary");a._hasPie=a._has("pie");m.linkSubplots(u,a,s,n);m.cleanPlot(u,a,s,n,p);v(a,n);m.doAutoMargin(t);var j=f.list(t);for(y=0;y0){var f=L(e._boundingBoxMargins),h=f.left+f.right,p=f.bottom+f.top,d=1-2*o;var v=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};s=Math.round(d*(v.width-h));u=Math.round(d*(v.height-p))}else{var g=c?window.getComputedStyle(e):{};s=parseFloat(g.width)||n.width;u=parseFloat(g.height)||n.height}var y=m.layoutAttributes.width.min,x=m.layoutAttributes.height.min;if(s1,_=!r.height&&Math.abs(n.height-u)>1;if(_||b){if(b)n.width=s;if(_)n.height=u}if(!e._initialAutoSize){e._initialAutoSize={width:s,height:u}}m.sanitizeMargins(n)};function L(t){var e={left:0,right:0,bottom:0,top:0},r;if(t){for(r in t){if(t.hasOwnProperty(r)){e.left+=t[r].left||0;e.right+=t[r].right||0;e.bottom+=t[r].bottom||0;e.top+=t[r].top||0}}}return e}m.supplyLayoutModuleDefaults=function(t,e,r,n){var a=i.componentsRegistry;var o=e._basePlotModules;var s,u,c;var f=i.subplotsRegistry.cartesian;for(s in a){c=a[s];if(c.includeBasePlot){c.includeBasePlot(t,e)}}if(!o.length){o.push(f)}if(e._has("cartesian")){i.getComponentMethod("grid","contentDefaults")(t,e);f.finalizeSubplots(t,e)}for(var h in e._subplots){e._subplots[h].sort(l.subplotSort)}for(u=0;un.width*.5)r.l=r.r=0;if(r.b+r.t>n.height*.5)r.b=r.t=0;var l=r.xl!==undefined?r.xl:r.x;var u=r.xr!==undefined?r.xr:r.x;var c=r.yt!==undefined?r.yt:r.y;var f=r.yb!==undefined?r.yb:r.y;a[e]={l:{val:l,size:r.l+o},r:{val:u,size:r.r+o},b:{val:f,size:r.b+o},t:{val:c,size:r.t+o}};i[e]=1}if(!n._replotting)m.doAutoMargin(t)}};m.doAutoMargin=function(t){var e=t._fullLayout;if(!e._size)e._size={};I(e);var r=e._size,n=JSON.stringify(r);var o=Math.max(e.margin.l||0,0);var s=Math.max(e.margin.r||0,0);var l=Math.max(e.margin.t||0,0);var u=Math.max(e.margin.b||0,0);var c=e._pushmargin;var f=e._pushmarginIds;if(e.margin.autoexpand!==false){for(var h in c){if(!f[h])delete c[h]}c.base={l:{val:0,size:o},r:{val:1,size:s},t:{val:1,size:l},b:{val:0,size:u}};for(var p in c){var d=c[p].l||{},v=c[p].b||{},g=d.val,m=d.size,y=v.val,x=v.size;for(var b in c){if(a(m)&&c[b].r){var _=c[b].r.val,w=c[b].r.size;if(_>g){var k=(m*_+(w-e.width)*g)/(_-g),M=(w*(1-g)+(m-e.width)*(1-_))/(_-g);if(k>=0&&M>=0&&k+M>o+s){o=k;s=M}}}if(a(x)&&c[b].t){var A=c[b].t.val,T=c[b].t.size;if(A>y){var S=(x*A+(T-e.height)*y)/(A-y),E=(T*(1-y)+(x-e.height)*(1-A))/(A-y);if(S>=0&&E>=0&&S+E>u+l){u=S;l=E}}}}}}r.l=Math.round(o);r.r=Math.round(s);r.t=Math.round(l);r.b=Math.round(u);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;if(!e._replotting&&n!=="{}"&&n!==JSON.stringify(e._size)){if("_redrawFromAutoMarginCount"in e){e._redrawFromAutoMarginCount++}else{e._redrawFromAutoMarginCount=1}return i.call("plot",t)}};m.graphJson=function(t,e,r,n,a){if(a&&e&&!t._fullData||a&&!e&&!t._fullLayout){m.supplyDefaults(t)}var i=a?t._fullData:t.data,o=a?t._fullLayout:t.layout,s=(t._transitionData||{})._frames;function u(t){if(typeof t==="function"){return null}if(l.isPlainObject(t)){var e={},n,a;for(n in t){if(typeof t[n]==="function"||["_","["].indexOf(n.charAt(0))!==-1){continue}if(r==="keepdata"){if(n.substr(n.length-3)==="src"){continue}}else if(r==="keepstream"){a=t[n+"src"];if(typeof a==="string"&&a.indexOf(":")>0){if(!l.isPlainObject(t.stream)){continue}}}else if(r!=="keepall"){a=t[n+"src"];if(typeof a==="string"&&a.indexOf(":")>0){continue}}e[n]=u(t[n])}return e}if(Array.isArray(t)){return t.map(u)}if(l.isJSDate(t))return l.ms2DateTimeLocal(+t);return t}var c={data:(i||[]).map(function(t){var r=u(t);if(e){delete r.fit}return r})};if(!e){c.layout=u(o)}if(t.framework&&t.framework.isPolar)c=t.framework.getConfig();if(s)c.frames=u(s);return n==="object"?c:JSON.stringify(c)};m.modifyFrames=function(t,e){var r,n,a;var i=t._transitionData._frames;var o=t._transitionData._frameHash;for(r=0;r0){t._transitioningWithDuration=true}t._transitionData._interruptCallbacks.push(function(){g=true});if(a.redraw){t._transitionData._interruptCallbacks.push(function(){return i.call("redraw",t)})}t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var n=0;var s=0;function u(){n++;return function(){s++;if(!g&&s===n){x(e)}}}var c;var f;var p=t._fullLayout._basePlotModules;var d=false;if(r){for(f=0;f=0;h--){if(i[h].enabled){s._indexToPoints=i[h]._indexToPoints;break}}if(l&&l.calc){a=l.calc(t,s)}}if(!Array.isArray(a)||!a[0]){a=[{x:c,y:c}]}if(!a[0].t)a[0].t={};a[0].trace=s;p[e]=a}for(u=0;u=0;var C=E?c.angularAxis.domain:n.extent(k);var L=Math.abs(k[1]-k[0]);if(T&&!M)L=0;var I=C.slice();if(S&&M)I[1]+=L;var z=c.angularAxis.ticksCount||4;if(z>8)z=z/(z/8)+z%8;if(c.angularAxis.ticksStep){z=(I[1]-I[0])/z}var P=c.angularAxis.ticksStep||(I[1]-I[0])/(z*(c.minorTicks+1));if(A)P=Math.max(Math.round(P),1);if(!I[2])I[2]=P;var O=n.range.apply(this,I);O=O.map(function(t,e){return parseFloat(t.toPrecision(12))});h=n.scale.linear().domain(I.slice(0,2)).range(c.direction==="clockwise"?[0,360]:[360,0]);a.layout.angularAxis.domain=h.domain();a.layout.angularAxis.endPadding=S?L:0;l=n.select(this).select("svg.chart-root");if(typeof l==="undefined"||l.empty()){var D="' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '";var R=(new DOMParser).parseFromString(D,"application/xml");var B=this.appendChild(this.ownerDocument.importNode(R.documentElement,true));l=n.select(B)}l.select(".guides-group").style({"pointer-events":"none"});l.select(".angular.axis-group").style({"pointer-events":"none"});l.select(".radial.axis-group").style({"pointer-events":"none"});var F=l.select(".chart-group");var N={fill:"none",stroke:c.tickColor};var j={"font-size":c.font.size,"font-family":c.font.family,fill:c.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+c.font.outlineColor}).join(",")};var V;if(c.showLegend){V=l.select(".legend-group").attr({transform:"translate("+[x,c.margin.top]+")"}).style({display:"block"});var U=p.map(function(t,e){var r=s.util.cloneJson(t);r.symbol=t.geometry==="DotPlot"?t.dotType||"circle":t.geometry!="LinePlot"?"square":"line";r.visibleInLegend=typeof t.visibleInLegend==="undefined"||t.visibleInLegend;r.color=t.geometry==="LinePlot"?t.strokeColor:t.color;return r});s.Legend().config({data:p.map(function(t,e){return t.name||"Element"+e}),legendConfig:i({},s.Legend.defaultConfig().legendConfig,{container:V,elements:U,reverseOrder:c.legend.reverseOrder})})();var q=V.node().getBBox();x=Math.min(c.width-q.width-c.margin.left-c.margin.right,c.height-c.margin.top-c.margin.bottom)/2;x=Math.max(10,x);b=[c.margin.left+x,c.margin.top+x];f.range([0,x]);a.layout.radialAxis.domain=f.domain();V.attr("transform","translate("+[b[0]+x,b[1]-x]+")")}else{V=l.select(".legend-group").style({display:"none"})}l.attr({width:c.width,height:c.height}).style({opacity:c.opacity});F.attr("transform","translate("+b+")").style({cursor:"crosshair"});var H=[(c.width-(c.margin.left+c.margin.right+x*2+(q?q.width:0)))/2,(c.height-(c.margin.top+c.margin.bottom+x*2))/2];H[0]=Math.max(0,H[0]);H[1]=Math.max(0,H[1]);l.select(".outer-group").attr("transform","translate("+H+")");if(c.title){var G=l.select("g.title-group text").style(j).text(c.title);var W=G.node().getBBox();G.attr({x:b[0]-W.width/2,y:b[1]-x-20})}var Y=l.select(".radial.axis-group");if(c.radialAxis.gridLinesVisible){var X=Y.selectAll("circle.grid-circle").data(f.ticks(5));X.enter().append("circle").attr({class:"grid-circle"}).style(N);X.attr("r",f);X.exit().remove()}Y.select("circle.outside-circle").attr({r:x}).style(N);var Z=l.select("circle.background-circle").attr({r:x}).style({fill:c.backgroundColor,stroke:c.stroke});function $(t,e){return h(t)%360+c.orientation}if(c.radialAxis.visible){var J=n.svg.axis().scale(f).ticks(5).tickSize(5);Y.call(J).attr({transform:"rotate("+c.radialAxis.orientation+")"});Y.selectAll(".domain").style(N);Y.selectAll("g>text").text(function(t,e){return this.textContent+c.radialAxis.ticksSuffix}).style(j).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){if(c.radialAxis.tickOrientation==="horizontal"){return"rotate("+-c.radialAxis.orientation+") translate("+[0,j["font-size"]]+")"}else return"translate("+[0,j["font-size"]]+")"}});Y.selectAll("g>line").style({stroke:"black"})}var K=l.select(".angular.axis-group").selectAll("g.angular-tick").data(O);var Q=K.enter().append("g").classed("angular-tick",true);K.attr({transform:function(t,e){return"rotate("+$(t,e)+")"}}).style({display:c.angularAxis.visible?"block":"none"});K.exit().remove();Q.append("line").classed("grid-line",true).classed("major",function(t,e){return e%(c.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(c.minorTicks+1)==0)}).style(N);Q.selectAll(".minor").style({stroke:c.minorTickColor});K.select("line.grid-line").attr({x1:c.tickLength?x-c.tickLength:0,x2:x}).style({display:c.angularAxis.gridLinesVisible?"block":"none"});Q.append("text").classed("axis-text",true).style(j);var tt=K.select("text.axis-text").attr({x:x+c.labelOffset,dy:o+"em",transform:function(t,e){var r=$(t,e);var n=x+c.labelOffset;var a=c.angularAxis.tickOrientation;if(a=="horizontal")return"rotate("+-r+" "+n+" 0)";else if(a=="radial")return r<270&&r>90?"rotate(180 "+n+" 0)":null;else return"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:c.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){if(e%(c.minorTicks+1)!=0)return"";if(A){return A[t]+c.angularAxis.ticksSuffix}else return t+c.angularAxis.ticksSuffix}).style(j);if(c.angularAxis.rewriteTicks)tt.text(function(t,e){if(e%(c.minorTicks+1)!=0)return"";return c.angularAxis.rewriteTicks(this.textContent,e)});var et=n.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));V.attr({transform:"translate("+[x+et,c.margin.top]+")"});var rt=l.select("g.geometry-group").selectAll("g").size()>0;var nt=l.select("g.geometry-group").selectAll("g.geometry").data(p);nt.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}});nt.exit().remove();if(p[0]||rt){var at=[];p.forEach(function(t,e){var r={};r.radialScale=f;r.angularScale=h;r.container=nt.filter(function(t,r){return r==e});r.geometry=t.geometry;r.orientation=c.orientation;r.direction=c.direction;r.index=e;at.push({data:t,geometryConfig:r})});var it=n.nest().key(function(t,e){return typeof t.data.groupId!="undefined"||"unstacked"}).entries(at);var ot=[];it.forEach(function(t,e){if(t.key==="unstacked")ot=ot.concat(t.values.map(function(t,e){return[t]}));else ot.push(t.values)});ot.forEach(function(t,e){var r;if(Array.isArray(t))r=t[0].geometryConfig.geometry;else r=t.geometryConfig.geometry;var n=t.map(function(t,e){return i(s[r].defaultConfig(),t)});s[r]().config(n)()})}var st=l.select(".guides-group");var lt=l.select(".tooltips-group");var ut=s.tooltipPanel().config({container:lt,fontSize:8})();var ct=s.tooltipPanel().config({container:lt,fontSize:8})();var ft=s.tooltipPanel().config({container:lt,hasTick:true})();var ht,pt;if(!M){var dt=st.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});F.on("mousemove.angular-guide",function(t,e){var r=s.util.getMousePos(Z).angle;dt.attr({x2:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-c.orientation)%360;ht=h.invert(n);var a=s.util.convertToCartesian(x+12,r+180);ut.text(s.util.round(ht)).move([a[0]+b[0],a[1]+b[1]])}).on("mouseout.angular-guide",function(t,e){st.select("line").style({opacity:0})})}var vt=st.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var r=s.util.getMousePos(Z).radius;vt.attr({r:r}).style({opacity:.5});pt=f.invert(s.util.getMousePos(Z).radius);var n=s.util.convertToCartesian(r,c.radialAxis.orientation);ct.text(s.util.round(pt)).move([n[0]+b[0],n[1]+b[1]])}).on("mouseout.radial-guide",function(t,e){vt.style({opacity:0});ft.hide();ut.hide();ct.hide()});l.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(t,e){var r=n.select(this);var a=this.style.fill;var i="black";var o=this.style.opacity||1;r.attr({"data-opacity":o});if(a&&a!=="none"){r.attr({"data-fill":a});i=n.hsl(a).darker().toString();r.style({fill:i,opacity:1});var u={t:s.util.round(t[0]),r:s.util.round(t[1])};if(M)u.t=A[t[0]];var c="t: "+u.t+", r: "+u.r;var f=this.getBoundingClientRect();var h=l.node().getBoundingClientRect();var p=[f.left+f.width/2-H[0]-h.left,f.top+f.height/2-H[1]-h.top];ft.config({color:i}).text(c);ft.move(p)}else{a=this.style.stroke||"black";r.attr({"data-stroke":a});i=n.hsl(a).darker().toString();r.style({stroke:i,opacity:1})}}).on("mousemove.tooltip",function(t,e){if(n.event.which!=0)return false;if(n.select(this).attr("data-fill"))ft.show()}).on("mouseout.tooltip",function(t,e){ft.hide();var r=n.select(this);var a=r.attr("data-fill");if(a)r.style({fill:a,opacity:r.attr("data-opacity")});else r.style({stroke:r.attr("data-stroke"),opacity:r.attr("data-opacity")})})});return p}p.render=function(t){d(t);return this};p.config=function(t){if(!arguments.length)return e;var r=s.util.cloneJson(t);r.data.forEach(function(t,r){if(!e.data[r])e.data[r]={};i(e.data[r],s.Axis.defaultConfig().data[0]);i(e.data[r],t)});i(e.layout,s.Axis.defaultConfig().layout);i(e.layout,r.layout);return this};p.getLiveConfig=function(){return a};p.getinputConfig=function(){return r};p.radialScale=function(t){return f};p.angularScale=function(t){return h};p.svg=function(){return l};n.rebind(p,c,"on");return p};s.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:true,opacity:1}],layout:{defaultColorRange:n.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:true,gridLinesVisible:true,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:true,gridLinesVisible:true,labelsVisible:true,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:true,legend:{reverseOrder:false},opacity:1}};return r};s.util={};s.DATAEXTENT="dataExtent";s.AREA="AreaChart";s.LINE="LinePlot";s.DOT="DotPlot";s.BAR="BarChart";s.util._override=function(t,e){for(var r in t)if(r in e)e[r]=t[r]};s.util._extend=function(t,e){for(var r in t)e[r]=t[r]};s.util._rndSnd=function(){return Math.random()*2-1+(Math.random()*2-1)+(Math.random()*2-1)};s.util.dataFromEquation2=function(t,e){var r=e||6;var a=n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;var a=t(n);return[e,a]});return a};s.util.dataFromEquation=function(t,e,r){var a=e||6;var i=[],o=[];n.range(0,360+a,a).forEach(function(e,r){var n=e*Math.PI/180;var a=t(n);i.push(e);o.push(a)});var s={t:i,r:o};if(r)s.name=r;return s};s.util.ensureArray=function(t,e){if(typeof t==="undefined")return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})};s.util.fillArrays=function(t,e,r){e.forEach(function(e,n){t[e]=s.util.ensureArray(t[e],r)});return t};s.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))};s.util.validateKeys=function(t,e){if(typeof e==="string")e=e.split(".");var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))};s.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})};s.util.arrayLast=function(t){return t[t.length-1]};s.util.arrayEqual=function(t,e){var r=Math.max(t.length,e.length,1);while(r-- >=0&&t[r]===e[r]);return r===-2};s.util.flattenArray=function(t){var e=[];while(!s.util.arrayEqual(e,t)){e=t;t=[].concat.apply([],t)}return t};s.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})};s.util.convertToCartesian=function(t,e){var r=e*Math.PI/180;var n=t*Math.cos(r);var a=t*Math.sin(r);return[n,a]};s.util.round=function(t,e){var r=e||2;var n=Math.pow(10,r);return Math.round(t*n)/n};s.util.getMousePos=function(t){var e=n.mouse(t.node());var r=e[0];var a=e[1];var i={};i.x=r;i.y=a;i.pos=e;i.angle=(Math.atan2(a,r)+Math.PI)*180/Math.PI;i.radius=Math.sqrt(r*r+a*a);return i};s.util.duplicatesCount=function(t){var e={},r;var n={};for(var a=0,i=t.length;a0)return;var l=n.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path");l.attr({class:"line",d:c(s),transform:function(e,r){return"rotate("+(t.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return d.fill(r,a,i)},"fill-opacity":0,stroke:function(t,e){return d.stroke(r,a,i)},"stroke-width":function(t,e){return d["stroke-width"](r,a,i)},"stroke-dasharray":function(t,e){return d["stroke-dasharray"](r,a,i)},opacity:function(t,e){return d.opacity(r,a,i)},display:function(t,e){return d.display(r,a,i)}})};var f=t.angularScale.range();var h=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180;var p=n.svg.arc().startAngle(function(t){return-h/2}).endAngle(function(t){return h/2}).innerRadius(function(e){return t.radialScale(l+(e[2]||0))}).outerRadius(function(e){return t.radialScale(l+(e[2]||0))+t.radialScale(e[1])});u.arc=function(e,r,a){n.select(this).attr({class:"mark arc",d:p,transform:function(e,r){return"rotate("+(t.orientation+s(e[0])+90)+")"}})};var d={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 a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return typeof e[n].data.visible==="undefined"||e[n].data.visible?"block":"none"}};var v=n.select(this).selectAll("g.layer").data(o);v.enter().append("g").attr({class:"layer"});var g=v.selectAll("path.mark").data(function(t,e){return t});g.enter().append("path").attr({class:"mark"});g.style(d).each(u[t.geometryType]);g.exit().remove();v.exit().remove();function m(e,r){var n=t.radialScale(e[1]);var a=(t.angularScale(e[0])+t.orientation)*Math.PI/180;return{r:n,t:a}}function y(t){var e=t.r*Math.cos(t.t);var r=t.r*Math.sin(t.t);return{x:e,y:r}}})}l.config=function(t){if(!arguments.length)return e;t.forEach(function(t,r){if(!e[r])e[r]={};i(e[r],s.PolyChart.defaultConfig());i(e[r],t)});return this};l.getColorScale=function(){return o};n.rebind(l,r,"on");return l};s.PolyChart.defaultConfig=function(){var t={data:{name:"geom1",t:[[1,2,3,4]],r:[[1,2,3,4]],dotType:"circle",dotSize:64,dotVisible:false,barWidth:20,color:"#ffa500",strokeSize:1,strokeColor:"silver",strokeDash:"solid",opacity:1,index:0,visible:true,visibleInLegend:true},geometryConfig:{geometry:"LinePlot",geometryType:"arc",direction:"clockwise",orientation:0,container:"body",radialScale:null,angularScale:null,colorScale:n.scale.category20()}};return t};s.BarChart=function t(){return s.PolyChart()};s.BarChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"bar"}};return t};s.AreaChart=function t(){return s.PolyChart()};s.AreaChart.defaultConfig=function(){var t={geometryConfig:{geometryType:"arc"}};return t};s.DotPlot=function t(){return s.PolyChart()};s.DotPlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"dot",dotType:"circle"}};return t};s.LinePlot=function t(){return s.PolyChart()};s.LinePlot.defaultConfig=function(){var t={geometryConfig:{geometryType:"line"}};return t};s.Legend=function t(){var e=s.Legend.defaultConfig();var r=n.dispatch("hover");function a(){var t=e.legendConfig;var r=e.data.map(function(e,r){return[].concat(e).map(function(e,n){var a=i({},t.elements[r]);a.name=e;a.color=[].concat(t.elements[r].color)[n];return a})});var o=n.merge(r);o=o.filter(function(e,r){return t.elements[r]&&(t.elements[r].visibleInLegend||typeof t.elements[r].visibleInLegend==="undefined")});if(t.reverseOrder)o=o.reverse();var s=t.container;if(typeof s=="string"||s.nodeName)s=n.select(s);var l=o.map(function(t,e){return t.color});var u=t.fontSize;var c=t.isContinuous==null?typeof o[0]==="number":t.isContinuous;var f=c?t.height:u*o.length;var h=s.classed("legend-group",true);var p=h.selectAll("svg").data([0]);var d=p.enter().append("svg").attr({width:300,height:f+u,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});d.append("g").classed("legend-axis",true);d.append("g").classed("legend-marks",true);var v=n.range(o.length);var g=n.scale[c?"linear":"ordinal"]().domain(v).range(l);var m=n.scale[c?"linear":"ordinal"]().domain(v)[c?"range":"rangePoints"]([0,f]);var y=function(t,e){var r=e*3;if(t==="line"){return"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z"}else if(n.svg.symbolTypes.indexOf(t)!=-1)return n.svg.symbol().type(t).size(r)();else return n.svg.symbol().type("square").size(r)()};if(c){var x=p.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);x.enter().append("stop");x.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}});p.append("rect").classed("legend-mark",true).attr({height:t.height,width:t.colorBandWidth,fill:"url(#grad1)"})}else{var b=p.select(".legend-marks").selectAll("path.legend-mark").data(o);b.enter().append("path").classed("legend-mark",true);b.attr({transform:function(t,e){return"translate("+[u/2,m(e)+u/2]+")"},d:function(t,e){var r=t.symbol;return y(r,u)},fill:function(t,e){return g(e)}});b.exit().remove()}var _=n.svg.axis().scale(m).orient("right");var w=p.select("g.legend-axis").attr({transform:"translate("+[c?t.colorBandWidth:u,u/2]+")"}).call(_);w.selectAll(".domain").style({fill:"none",stroke:"none"});w.selectAll("line").style({fill:"none",stroke:c?t.textColor:"none"});w.selectAll("text").style({fill:t.textColor,"font-size":t.fontSize}).text(function(t,e){return o[e].name});return a}a.config=function(t){if(!arguments.length)return e;i(e,t);return this};n.rebind(a,r,"on");return a};s.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:false}};return r};s.tooltipPanel=function(){var t,e,r;var a={container:null,hasTick:false,fontSize:12,color:"white",padding:5};var o="tooltip-"+s.tooltipPanel.uid++;var l=10;var u=function(){t=a.container.selectAll("g."+o).data([0]);var n=t.enter().append("g").classed(o,true).style({"pointer-events":"none",display:"none"});r=n.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"});e=n.append("text").attr({dx:a.padding+l,dy:+a.fontSize*.3});return u};u.text=function(i){var o=n.hsl(a.color).l;var s=o>=.5?"#aaa":"white";var c=o>=.5?"black":"white";var f=i||"";e.style({fill:c,"font-size":a.fontSize+"px"}).text(f);var h=a.padding;var p=e.node().getBBox();var d={fill:a.color,stroke:s,"stroke-width":"2px"};var v=p.width+h*2+l;var g=p.height+h*2;r.attr({d:"M"+[[l,-g/2],[l,-g/4],[a.hasTick?0:l,0],[l,g/4],[l,g/2],[v,g/2],[v,-g/2]].join("L")+"Z"}).style(d);t.attr({transform:"translate("+[l,-g/2+h*2]+")"});t.style({display:"block"});return u};u.move=function(e){if(!t)return;t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"});return u};u.hide=function(){if(!t)return;t.style({display:"none"});return u};u.show=function(){if(!t)return;t.style({display:"block"});return u};u.config=function(t){i(a,t);return u};return u};s.tooltipPanel.uid=1;s.adapter={};s.adapter.plotly=function t(){var e={};e.convert=function(t,e){var r={};if(t.data){r.data=t.data.map(function(t,r){var n=i({},t);var a=[[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"]]];a.forEach(function(t,r){s.util.translator.apply(null,t.concat(e))});if(!e)delete n.marker;if(e)delete n.groupId;if(!e){if(n.type==="scatter"){if(n.mode==="lines")n.geometry="LinePlot";else if(n.mode==="markers")n.geometry="DotPlot";else if(n.mode==="lines+markers"){n.geometry="LinePlot";n.dotVisible=true}}else if(n.type==="area")n.geometry="AreaChart";else if(n.type==="bar")n.geometry="BarChart";delete n.mode;delete n.type}else{if(n.geometry==="LinePlot"){n.type="scatter";if(n.dotVisible===true){delete n.dotVisible;n.mode="lines+markers"}else n.mode="lines"}else if(n.geometry==="DotPlot"){n.type="scatter";n.mode="markers"}else if(n.geometry==="AreaChart")n.type="area";else if(n.geometry==="BarChart")n.type="bar";delete n.geometry}return n});if(!e&&t.layout&&t.layout.barmode==="stack"){var a=s.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);if(n!=-1)r.data[e].groupId=n})}}if(t.layout){var o=i({},t.layout);var l=[[o,["plot_bgcolor"],["backgroundColor"]],[o,["showlegend"],["showLegend"]],[o,["radialaxis"],["radialAxis"]],[o,["angularaxis"],["angularAxis"]],[o.angularaxis,["showline"],["gridLinesVisible"]],[o.angularaxis,["showticklabels"],["labelsVisible"]],[o.angularaxis,["nticks"],["ticksCount"]],[o.angularaxis,["tickorientation"],["tickOrientation"]],[o.angularaxis,["ticksuffix"],["ticksSuffix"]],[o.angularaxis,["range"],["domain"]],[o.angularaxis,["endpadding"],["endPadding"]],[o.radialaxis,["showline"],["gridLinesVisible"]],[o.radialaxis,["tickorientation"],["tickOrientation"]],[o.radialaxis,["ticksuffix"],["ticksSuffix"]],[o.radialaxis,["range"],["domain"]],[o.angularAxis,["showline"],["gridLinesVisible"]],[o.angularAxis,["showticklabels"],["labelsVisible"]],[o.angularAxis,["nticks"],["ticksCount"]],[o.angularAxis,["tickorientation"],["tickOrientation"]],[o.angularAxis,["ticksuffix"],["ticksSuffix"]],[o.angularAxis,["range"],["domain"]],[o.angularAxis,["endpadding"],["endPadding"]],[o.radialAxis,["showline"],["gridLinesVisible"]],[o.radialAxis,["tickorientation"],["tickOrientation"]],[o.radialAxis,["ticksuffix"],["ticksSuffix"]],[o.radialAxis,["range"],["domain"]],[o.font,["outlinecolor"],["outlineColor"]],[o.legend,["traceorder"],["reverseOrder"]],[o,["labeloffset"],["labelOffset"]],[o,["defaultcolorrange"],["defaultColorRange"]]];l.forEach(function(t,r){s.util.translator.apply(null,t.concat(e))});if(!e){if(o.angularAxis&&typeof o.angularAxis.ticklen!=="undefined")o.tickLength=o.angularAxis.ticklen;if(o.angularAxis&&typeof o.angularAxis.tickcolor!=="undefined")o.tickColor=o.angularAxis.tickcolor}else{if(typeof o.tickLength!=="undefined"){o.angularaxis.ticklen=o.tickLength;delete o.tickLength}if(o.tickColor){o.angularaxis.tickcolor=o.tickColor;delete o.tickColor}}if(o.legend&&typeof o.legend.reverseOrder!="boolean"){o.legend.reverseOrder=o.legend.reverseOrder!="normal"}if(o.legend&&typeof o.legend.traceorder=="boolean"){o.legend.traceorder=o.legend.traceorder?"reversed":"normal";delete o.legend.reverseOrder}if(o.margin&&typeof o.margin.t!="undefined"){var u=["t","r","b","l","pad"];var c=["top","right","bottom","left","pad"];var f={};n.entries(o.margin).forEach(function(t,e){f[c[u.indexOf(t.key)]]=t.value});o.margin=f}if(e){delete o.needsEndSpacing;delete o.minorTickColor;delete o.minorTicks;delete o.angularaxis.ticksCount;delete o.angularaxis.ticksCount;delete o.angularaxis.ticksStep;delete o.angularaxis.rewriteTicks;delete o.angularaxis.nticks;delete o.radialaxis.ticksCount;delete o.radialaxis.ticksCount;delete o.radialaxis.ticksStep;delete o.radialaxis.rewriteTicks;delete o.radialaxis.nticks}r.layout=o}return r};return e}},{"../../../constants/alignment":656,"../../../lib":684,d3:147}],805:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../../lib");var i=t("../../../components/color");var o=t("./micropolar");var s=t("./undo_manager");var l=a.extendDeepAll;var u=e.exports={};u.framework=function(t){var e,r,a,i,c;var f=new s;function h(r,s){if(s)c=s;n.select(n.select(c).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove();e=!e?r:l(e,r);if(!a)a=o.Axis();i=o.adapter.plotly().convert(e);a.config(i).render(c);t.data=e.data;t.layout=e.layout;u.fillLayout(t);return e}h.isPolar=true;h.svg=function(){return a.svg()};h.getConfig=function(){return e};h.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),true)};h.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}};h.setUndoPoint=function(){var t=this;var n=o.util.cloneJson(e);(function(e,r){f.add({undo:function(){if(r)t(r)},redo:function(){t(e)}})})(n,r);r=o.util.cloneJson(n)};h.undo=function(){f.undo()};h.redo=function(){f.redo()};return h};u.fillLayout=function(t){var e=n.select(t).selectAll(".plot-container"),r=e.selectAll(".svg-container"),a=t.framework&&t.framework.svg&&t.framework.svg(),o={width:800,height:600,paper_bgcolor:i.background,_container:e,_paperdiv:r,_paper:a};t._fullLayout=l(o,t.layout)}},{"../../../components/color":558,"../../../lib":684,"./micropolar":804,"./undo_manager":806,d3:147}],806:[function(t,e,r){"use strict";e.exports=function t(){var e=[],r=-1,n=false,a;function i(t,e){if(!t)return this;n=true;t[e]();n=false;return this}return{add:function(t){if(n)return this;e.splice(r+1,e.length-r);e.push(t);r=e.length-1;return this},setCallback:function(t){a=t},undo:function(){var t=e[r];if(!t)return this;i(t,"undo");r-=1;if(a)a(t.undo);return this},redo:function(){var t=e[r+1];if(!t)return this;i(t,"redo");r+=1;if(a)a(t.redo);return this},clear:function(){e=[];r=-1},hasUndo:function(){return r!==-1},hasRedo:function(){return ry){x=f;b=f*y;k=(h-b)/a.h/2;_=[i[0],i[1]];w=[u[0]+k,u[1]-k]}else{x=h/y;b=h;k=(f-x)/a.w/2;_=[i[0]+k,i[1]-k];w=[u[0],u[1]]}r.xLength2=x;r.yLength2=b;r.xDomain2=_;r.yDomain2=w;var M=r.xOffset2=a.l+a.w*_[0];var A=r.yOffset2=a.t+a.h*(1-w[1]);var T=r.radius=x/v;var S=r.cx=M-T*d[0];var E=r.cy=A+T*d[3];var C=r.cxx=S-M;var L=r.cyy=E-A;var I={anchor:"free",position:0,_counteraxis:true,automargin:false};r.radialAxis=o.extendFlat({},e.radialaxis,I,{_axislayer:n["radial-axis"],_gridlayer:n["radial-grid"],_id:"x",_pos:0,side:{counterclockwise:"top",clockwise:"bottom"}[e.radialaxis.side],domain:[0,T/a.w]});r.angularAxis=o.extendFlat({},e.angularaxis,I,{_axislayer:n["angular-axis"],_gridlayer:n["angular-grid"],_id:"angular",_pos:0,side:"right",domain:[0,Math.PI],autorange:false});r.doAutoRange(t,e);r.updateAngularAxis(t,e);r.updateRadialAxis(t,e);r.updateRadialAxisTitle(t,e);var P=r.radialAxis.range;var O=P[1]-P[0];var D=r.xaxis={type:"linear",_id:"x",range:[d[0]*O,d[2]*O],domain:_};c.setConvert(D,t);D.setScale();var R=r.yaxis={type:"linear",_id:"y",range:[d[1]*O,d[3]*O],domain:w};c.setConvert(R,t);R.setScale();D.isPtWithinRange=function(t){return r.isPtWithinSector(t)};R.isPtWithinRange=function(){return true};r.clipPaths.forTraces.select("path").attr("d",G(T,p,r.vangles)).attr("transform",Z(C,L));n.frontplot.attr("transform",Z(M,A)).call(l.setClipUrl,r._hasClipOnAxisFalse?null:r.clipIds.forTraces);n.bg.attr("d",G(T,p,r.vangles)).attr("transform",Z(S,E)).call(s.fill,e.bgcolor);r.framework.selectAll(".crisp").classed("crisp",0)};C.doAutoRange=function(t,e){var r=e.radialaxis;var n=this.radialAxis;L(n,r,t);f(n);r.range=n.range.slice();r._input.range=n.range.slice()};C.updateRadialAxis=function(t,e){var r=this;var n=r.gd;var a=r.layers;var i=r.radius;var o=r.cx;var l=r.cy;var u=e.radialaxis;var f=e.sector;var h=M(f[0]);var p=r.radialAxis;r.fillViewInitialKey("radialaxis.angle",u.angle);r.fillViewInitialKey("radialaxis.range",p.range.slice());if(p.tickangle==="auto"&&(h>90&&h<=270)){p.tickangle=180}p._transfn=function(t){return"translate("+p.l2p(t.x)+",0)"};p._gridpath=function(t){var e=p.r2p(t.x);return H(e,f,r.vangles)};var d=I(u);if(r.radialTickLayout!==d){a["radial-axis"].selectAll(".xtick").remove();r.radialTickLayout=d}c.doTicksSingle(n,p,true);var v=r.radialAxisAngle=r.vangles?k(O(w(u.angle),r.vangles)):u.angle;var g=Z(o,l)+$(-v);X(a["radial-axis"],u.showticklabels||u.ticks,{transform:g});X(a["radial-grid"],u.showgrid,{transform:Z(o,l)}).selectAll("path").attr("transform",null);X(a["radial-line"].select("line"),u.showline,{x1:0,y1:0,x2:i,y2:0,transform:g}).attr("stroke-width",u.linewidth).call(s.stroke,u.linecolor)};C.updateRadialAxisTitle=function(t,e,r){var n=this;var a=n.gd;var i=n.radius;var o=n.cx;var s=n.cy;var u=e.radialaxis;var c=n.id+"title";var f=r!==undefined?r:n.radialAxisAngle;var h=w(f);var p=Math.cos(h);var d=Math.sin(h);var g=0;if(u.title){var m=l.bBox(n.layers["radial-axis"].node()).height;var y=u.titlefont.size;g=u.side==="counterclockwise"?-m-y*.4:m+y*.8}n.layers["radial-axis-title"]=v.draw(a,c,{propContainer:u,propName:n.id+".radialaxis.title",placeholder:_(a,"Click to enter radial axis title"),attributes:{x:o+i/2*p+g*d,y:s-i/2*d+g*p,"text-anchor":"middle"},transform:{rotate:-f}})};C.updateAngularAxis=function(t,e){var r=this;var a=r.gd;var i=r.layers;var o=r.radius;var l=r.cx;var u=r.cy;var f=e.angularaxis;var h=e.sector;var p=h.map(w);var d=r.angularAxis;r.fillViewInitialKey("angularaxis.rotation",f.rotation);function v(t){return d.c2rad(t.x,"degrees")}function g(t){return[o*Math.cos(t),o*Math.sin(t)]}if(d.type==="linear"){if(Y(h)){d.range=h.slice()}else{d.range=p.map(d.unTransformRad).map(k)}if(d.thetaunit==="radians"){d.tick0=k(d.tick0);d.dtick=k(d.dtick)}}else if(d.type==="category"){var m=f.period?Math.max(f.period,f._categories.length):f._categories.length;d.range=[0,m];d._tickFilter=function(t){return P(v(t),h)}}L(d,f,t);d._transfn=function(t){var e=v(t);var r=g(e);var a=Z(l+r[0],u-r[1]);var i=n.select(this);if(i&&i.node()&&i.classed("ticks")){a+=$(-k(e))}return a};d._gridpath=function(t){var e=v(t);var r=g(e);return"M0,0L"+-r[0]+","+r[1]};var y=f.ticks!=="outside"?.7:.5;d._labelx=function(t){var e=v(t);var r=d._labelStandoff;var n=d._pad;var a=tt(e)===0?0:Math.cos(e)*(r+n+y*t.fontSize);var i=Q(e)*(t.dx+r+n);return a+i};d._labely=function(t){var e=v(t);var r=d._labelStandoff;var n=d._labelShift;var a=d._pad;var i=t.dy+t.fontSize*b-n;var o=-Math.sin(e)*(r+a+y*t.fontSize);return i+o};d._labelanchor=function(t,e){var r=v(e);return tt(r)===0?Q(r)>0?"start":"end":"middle"};var x=I(f);if(r.angularTickLayout!==x){i["angular-axis"].selectAll(".angulartick").remove();r.angularTickLayout=x}c.doTicksSingle(a,d,true);var _;if(e.gridshape==="linear"){_=d._vals.map(v);if(D(_[0],_[1])<0){_=_.slice().reverse()}}else{_=null}r.vangles=_;X(i["angular-line"].select("path"),f.showline,{d:G(o,h,_),transform:Z(l,u)}).attr("stroke-width",f.linewidth).call(s.stroke,f.linecolor)};C.updateFx=function(t,e){if(!this.gd._context.staticPlot){this.updateAngularDrag(t,e);this.updateRadialDrag(t,e);this.updateMainDrag(t,e)}};C.updateMainDrag=function(t,e){var r=this;var s=r.gd;var l=r.layers;var u=t._zoomlayer;var c=S.MINZOOM;var f=S.OFFEDGE;var v=r.radius;var y=r.cx;var x=r.cy;var b=r.cxx;var _=r.cyy;var w=e.sector;var k=r.vangles;var M=S.cornerHalfWidth;var A=S.cornerLen/2;var T=p.makeDragger(l,"path","maindrag","crosshair");n.select(T).attr("d",G(v,w,k)).attr("transform",Z(y,x));var E={element:T,gd:s,subplot:r.id,plotinfo:{xaxis:r.xaxis,yaxis:r.yaxis},xaxes:[r.xaxis],yaxes:[r.yaxis]};var C,L;var I,z;var P,O,N;var j,V;function q(t,e){return Math.sqrt(t*t+e*e)}function H(t,e){return q(t-b,e-_)}function W(t,e){return Math.atan2(_-e,t-b)}function Y(t,e){return[t*Math.cos(e),t*Math.sin(-e)]}function X(t){return G(t,w,k)}function $(t,e){if(t===0)return X(2*M);var r=A/t;var n=e-r;var a=e+r;var i=Math.max(0,Math.min(t,v));var o=i-M;var s=i+M;return"M"+Y(o,n)+"A"+[o,o]+" 0,0,0 "+Y(o,a)+"L"+Y(s,a)+"A"+[s,s]+" 0,0,1 "+Y(s,n)+"Z"}function K(t,e,r){if(t===0)return X(2*M);var n=Y(t,e);var a=Y(t,r);var i=J((n[0]+a[0])/2);var o=J((n[1]+a[1])/2);var s,l;if(i&&o){var u=o/i;var c=-1/u;var f=F(M,u,i,o);s=F(A,c,f[0][0],f[0][1]);l=F(A,c,f[1][0],f[1][1])}else{var h,p;if(o){h=A;p=M}else{h=M;p=A}s=[[i-h,o-p],[i+h,o-p]];l=[[i-h,o+p],[i+h,o+p]]}return"M"+s.join("L")+"L"+l.reverse().join("L")+"Z"}function Q(){I=null;z=null;P=X(v);O=false;var t=s._fullLayout[r.id];N=a(t.bgcolor).getLuminance();j=p.makeZoombox(u,N,y,x,P);j.attr("fill-rule","evenodd");V=p.makeCorners(u,y,x);m(u)}function tt(t,e){e=Math.min(e,v);if(tc){if(t0?r:Infinity});var r=o.mod(e+1,k.length);return[k[e],k[r]]}function at(t,e,r,n){var a=B(r,n,r,[t-b,_-e]);return q(a[0],a[1])}function it(t,e){var r=C+t;var n=L+e;var a=W(C,L);var i=W(r,n);var o=nt(a);var s=nt(i);var l=at(C,L,o[0],o[1]);var u=Math.min(at(r,n,s[0],s[1]),v);var c;var f;if(tt(l,u)){c=P+X(z)+X(I);f=[K(I,o[0],o[1]),K(z,o[0],o[1])].join(" ")}et(c,f)}function ot(){p.removeZoombox(s);if(I===null||z===null)return;p.showDoubleClickNotifier(s);var t=r.radialAxis;var e=t.range;var n=e[1]-e[0];var a={};a[r.id+".radialaxis.range"]=[e[0]+I*n/v,e[0]+z*n/v];i.call("relayout",s,a)}E.prepFn=function(t,e,r){var n=s._fullLayout.dragmode;var a=T.getBoundingClientRect();C=e-a.left;L=r-a.top;if(k){var i=U(v,w,k);C+=b+i[0];L+=_+i[1]}switch(n){case"zoom":if(k){E.moveFn=it}else{E.moveFn=rt}E.doneFn=ot;Q(t,e,r);break;case"select":case"lasso":g(t,e,r,E,n);break}};E.clickFn=function(t,e){p.removeZoombox(s);if(t===2){var n={};for(var a in r.viewInitial){n[r.id+"."+a]=r.viewInitial[a]}s.emit("plotly_doubleclick",null);i.call("relayout",s,n)}d.click(s,e,r.id)};T.onmousemove=function(t){d.hover(s,t,r.id);s._fullLayout._lasthover=T;s._fullLayout._hoversubplot=r.id};T.onmouseout=function(t){if(s._dragging)return;h.unhover(s,t)};h.init(E)};C.updateRadialDrag=function(t,e){var r=this;var a=r.gd;var s=r.layers;var l=r.radius;var u=r.cx;var f=r.cy;var d=r.radialAxis;var v=e.radialaxis;var g=w(r.radialAxisAngle);var y=d.range.slice();var x=y[1]-y[0];var b=S.radialDragBoxSize;var _=b/2;if(!v.visible)return;var M=p.makeRectDragger(s,"radialdrag","crosshair",-_,-_,b,b);var A={element:M,gd:a};var T=u+(l+_)*Math.cos(g);var E=f-(l+_)*Math.sin(g);n.select(M).attr("transform",Z(T,E));var C;var L;var I;function z(t,e){if(C){C(t,e)}else{var r=[t,-e];var n=[Math.cos(g),Math.sin(g)];var a=Math.abs(o.dot(r,n)/Math.sqrt(o.dot(r,r)));if(!isNaN(a)){C=a<.5?D:R}}}function P(){if(L!==null){i.call("relayout",a,r.id+".radialaxis.angle",L)}else if(I!==null){i.call("relayout",a,r.id+".radialaxis.range[1]",I)}}function D(t,e){var n=T+t;var a=E+e;L=Math.atan2(f-a,n-u);if(r.vangles)L=O(L,r.vangles);L=k(L);var i=Z(u,f)+$(-L);s["radial-axis"].attr("transform",i);s["radial-line"].select("line").attr("transform",i);var o=r.gd._fullLayout;var l=o[r.id];r.updateRadialAxisTitle(o,l,L)}function R(t,e){var n=o.dot([t,-e],[Math.cos(g),Math.sin(g)]);var h=y[1]-x*n/l*.75;if(x>0!==h>y[0])return;I=d.range[1]=h;c.doTicksSingle(a,r.radialAxis,true);s["radial-grid"].attr("transform",Z(u,f)).selectAll("path").attr("transform",null);var p=I-y[0];var v=r.sectorBBox;r.xaxis.range=[v[0]*p,v[2]*p];r.yaxis.range=[v[1]*p,v[3]*p];r.xaxis.setScale();r.yaxis.setScale();for(var m in r.traceHash){var b=r.traceHash[m];var _=o.filterVisible(b);var w=b[0][0].trace._module;var k=a._fullLayout[r.id];w.plot(a,r,_,k);if(!i.traceIs(m,"gl")){for(var M=0;M<_.length;M++){w.style(a,_[M])}}}}A.prepFn=function(){C=null;L=null;I=null;A.moveFn=z;A.doneFn=P;m(t._zoomlayer)};A.clampFn=function(t,e){if(Math.sqrt(t*t+e*e)=a[0]){o=a[0];s=a[1]}else{o=a[1];s=a[0]}if(r){var l=x(V(o,e,r));var u=x(V(s,e,r));var c=[i*Math.cos(t.rad),i*Math.sin(t.rad)];return u.contains(c)&&!l.contains(c)}return i>=o&&i<=s};C.fillViewInitialKey=function(t,e){if(!(t in this.viewInitial)){this.viewInitial[t]=e}};function L(t,e,r){c.setConvert(t,r);t._min=e._min;t._max=e._max;t.setScale()}function I(t){var e=t.ticks+String(t.ticklen)+String(t.showticklabels);if("side"in t)e+=t.side;return e}function z(t){var e=t[0];var r=t[1];var n=r-e;var a=M(e);var i=a+n;var o=Math.cos(w(a));var s=Math.sin(w(a));var l=Math.cos(w(i));var u=Math.sin(w(i));var c,f,h,p;if(a<=90&&i>=90||a>90&&i>=450){p=1}else if(s<=0&&u<=0){p=0}else{p=Math.max(s,u)}if(a<=180&&i>=180||a>180&&i>=540){c=-1}else if(o>=0&&l>=0){c=0}else{c=Math.min(o,l)}if(a<=270&&i>=270||a>270&&i>=630){f=-1}else if(s>=0&&u>=0){f=0}else{f=Math.min(s,u)}if(i>=360){h=1}else if(o<=0&&l<=0){h=0}else{h=Math.max(o,l)}return[c,f,h,p]}function P(t,e){if(Y(e))return true;var r=M(e[0]);var n=M(e[1]);if(r>n)n+=360;var a=M(k(t));var i=a+360;return a>=r&&a<=n||i>=r&&i<=n}function O(t,e){function r(e){return Math.abs(D(t,e))}var n=R(e,r);return e[n]}function D(t,e){var r=e-t;return Math.atan2(Math.sin(r),Math.cos(r))}function R(t,e){e=e||o.identity;var r=Infinity;var n;for(var a=0;a1e-10?t:0}function K(t){return Math.abs(t)<1e-10?0:t>0?1:-1}function Q(t){return K(Math.cos(t))}function tt(t){return K(Math.sin(t))}},{"../../components/color":558,"../../components/dragelement":580,"../../components/drawing":583,"../../components/fx":600,"../../components/titles":649,"../../constants/alignment":656,"../../lib":684,"../../lib/polygon":696,"../../lib/setcursor":704,"../../registry":817,"../cartesian/autorange":731,"../cartesian/axes":732,"../cartesian/dragbox":740,"../cartesian/select":749,"../plots":795,"./constants":796,"./helpers":797,d3:147,tinycolor2:499}],808:[function(t,e,r){"use strict";function n(t,e){if(t==="splom")return-1;if(e==="splom")return 1;return 0}function a(t,e){return n(t.name,e.name)}e.exports={sortBasePlotModules:a,sortModules:n}},{}],809:[function(t,e,r){"use strict";var n=t("../lib");var a=t("../plot_api/plot_template");var i=t("./domain").defaults;e.exports=function t(e,r,o,s){var l=s.type;var u=s.attributes;var c=s.handleDefaults;var f=s.partition||"x";var h=r._subplots[l];var p=h.length;var d=p&&h[0].replace(/\d+$/,"");var v,g;function m(t,e){return n.coerce(v,g,u,t,e)}for(var y=0;y=u){d.min=0;v.min=0;g.min=0;if(t.aaxis)delete t.aaxis.min;if(t.baxis)delete t.baxis.min;if(t.caxis)delete t.caxis.min}}},{"../../../components/color":558,"../../../plot_api/plot_template":722,"../../subplot_defaults":809,"./axis_defaults":813,"./layout_attributes":815}],815:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes");var a=t("../../domain").attributes;var i=t("./axis_attributes");var o=t("../../../plot_api/edit_types").overrideAll;e.exports=o({domain:a({name:"ternary"}),bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:i,baxis:i,caxis:i},"plot","from-root")},{"../../../components/color/attributes":557,"../../../plot_api/edit_types":715,"../../domain":757,"./axis_attributes":812}],816:[function(t,e,r){"use strict";var n=t("d3");var a=t("tinycolor2");var i=t("../../registry");var o=t("../../lib");var s=o._;var l=t("../../components/color");var u=t("../../components/drawing");var c=t("../cartesian/set_convert");var f=t("../../lib/extend").extendFlat;var h=t("../plots");var p=t("../cartesian/axes");var d=t("../../components/dragelement");var v=t("../../components/fx");var g=t("../../components/titles");var m=t("../cartesian/select").prepSelect;var y=t("../cartesian/select").clearSelect;var x=t("../cartesian/constants");function b(t,e){this.id=t.id;this.graphDiv=t.graphDiv;this.init(e);this.makeFramework(e)}e.exports=b;var _=b.prototype;_.init=function(t){this.container=t._ternarylayer;this.defs=t._defs;this.layoutId=t._uid;this.traceHash={};this.layers={}};_.plot=function(t,e){var r=this;var n=e[r.id];var a=e._size;r._hasClipOnAxisFalse=false;for(var i=0;iw*p){_=p;b=_*w}else{b=h;_=b/w}k=o*b/h;M=s*_/p;y=e.l+e.w*a-b/2;x=e.t+e.h*(1-i)-_/2;r.x0=y;r.y0=x;r.w=b;r.h=_;r.sum=d;r.xaxis={type:"linear",range:[v+2*m-d,d-v-2*g],domain:[a-k/2,a+k/2],_id:"x"};c(r.xaxis,r.graphDiv._fullLayout);r.xaxis.setScale();r.xaxis.isPtWithinRange=function(t){return t.a>=r.aaxis.range[0]&&t.a<=r.aaxis.range[1]&&t.b>=r.baxis.range[1]&&t.b<=r.baxis.range[0]&&t.c>=r.caxis.range[1]&&t.c<=r.caxis.range[0]};r.yaxis={type:"linear",range:[v,d-g-m],domain:[i-M/2,i+M/2],_id:"y"};c(r.yaxis,r.graphDiv._fullLayout);r.yaxis.setScale();r.yaxis.isPtWithinRange=function(){return true};var A=r.yaxis.domain[0];var T=r.aaxis=f({},t.aaxis,{visible:true,range:[v,d-g-m],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[A,A+M*w],_axislayer:r.layers.aaxis,_gridlayer:r.layers.agrid,_pos:0,_id:"y",_length:b,_gridpath:"M0,0l"+_+",-"+b/2,automargin:false});c(T,r.graphDiv._fullLayout);T.setScale();var S=r.baxis=f({},t.baxis,{visible:true,range:[d-v-m,g],side:"bottom",_counterangle:30,domain:r.xaxis.domain,_axislayer:r.layers.baxis,_gridlayer:r.layers.bgrid,_counteraxis:r.aaxis,_pos:0,_id:"x",_length:b,_gridpath:"M0,0l-"+b/2+",-"+_,automargin:false});c(S,r.graphDiv._fullLayout);S.setScale();T._counteraxis=S;var E=r.caxis=f({},t.caxis,{visible:true,range:[d-v-g,m],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[A,A+M*w],_axislayer:r.layers.caxis,_gridlayer:r.layers.cgrid,_counteraxis:r.baxis,_pos:0,_id:"y",_length:b,_gridpath:"M0,0l-"+_+","+b/2,automargin:false});c(E,r.graphDiv._fullLayout);E.setScale();var C="M"+y+","+(x+_)+"h"+b+"l-"+b/2+",-"+_+"Z";r.clipDef.select("path").attr("d",C);r.layers.plotbg.select("path").attr("d",C);var L="M0,"+_+"h"+b+"l-"+b/2+",-"+_+"Z";r.clipDefRelative.select("path").attr("d",L);var I="translate("+y+","+x+")";r.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",I);r.clipDefRelative.select("path").attr("transform",null);var z="translate("+(y-S._offset)+","+(x+_)+")";r.layers.baxis.attr("transform",z);r.layers.bgrid.attr("transform",z);var P="translate("+(y+b/2)+","+x+")rotate(30)translate(0,"+-T._offset+")";r.layers.aaxis.attr("transform",P);r.layers.agrid.attr("transform",P);var O="translate("+(y+b/2)+","+x+")rotate(-30)translate(0,"+-E._offset+")";r.layers.caxis.attr("transform",O);r.layers.cgrid.attr("transform",O);r.drawAxes(true);r.plotContainer.selectAll(".crisp").classed("crisp",false);r.layers.aline.select("path").attr("d",T.showline?"M"+y+","+(x+_)+"l"+b/2+",-"+_:"M0,0").call(l.stroke,T.linecolor||"#000").style("stroke-width",(T.linewidth||0)+"px");r.layers.bline.select("path").attr("d",S.showline?"M"+y+","+(x+_)+"h"+b:"M0,0").call(l.stroke,S.linecolor||"#000").style("stroke-width",(S.linewidth||0)+"px");r.layers.cline.select("path").attr("d",E.showline?"M"+(y+b/2)+","+x+"l"+b/2+","+_:"M0,0").call(l.stroke,E.linecolor||"#000").style("stroke-width",(E.linewidth||0)+"px");if(!r.graphDiv._context.staticPlot){r.initInteractions()}u.setClipUrl(r.layers.frontplot,r._hasClipOnAxisFalse?null:r.clipId)};_.drawAxes=function(t){var e=this,r=e.graphDiv,n=e.id.substr(7)+"title",a=e.aaxis,i=e.baxis,o=e.caxis;p.doTicksSingle(r,a,true);p.doTicksSingle(r,i,true);p.doTicksSingle(r,o,true);if(t){var l=Math.max(a.showticklabels?a.tickfont.size/2:0,(o.showticklabels?o.tickfont.size*.75:0)+(o.ticks==="outside"?o.ticklen*.87:0));e.layers["a-title"]=g.draw(r,"a"+n,{propContainer:a,propName:e.id+".aaxis.title",placeholder:s(r,"Click to enter Component A title"),attributes:{x:e.x0+e.w/2,y:e.y0-a.titlefont.size/3-l,"text-anchor":"middle"}});var u=(i.showticklabels?i.tickfont.size:0)+(i.ticks==="outside"?i.ticklen:0)+3;e.layers["b-title"]=g.draw(r,"b"+n,{propContainer:i,propName:e.id+".baxis.title",placeholder:s(r,"Click to enter Component B title"),attributes:{x:e.x0-u,y:e.y0+e.h+i.titlefont.size*.83+u,"text-anchor":"middle"}});e.layers["c-title"]=g.draw(r,"c"+n,{propContainer:o,propName:e.id+".caxis.title",placeholder:s(r,"Click to enter Component C title"),attributes:{x:e.x0+e.w+u,y:e.y0+e.h+o.titlefont.size*.83+u,"text-anchor":"middle"}})}};var k=x.MINZOOM/2+.87;var M="m-0.87,.5h"+k+"v3h-"+(k+5.2)+"l"+(k/2+2.6)+",-"+(k*.87+4.5)+"l2.6,1.5l-"+k/2+","+k*.87+"Z";var A="m0.87,.5h-"+k+"v3h"+(k+5.2)+"l-"+(k/2+2.6)+",-"+(k*.87+4.5)+"l-2.6,1.5l"+k/2+","+k*.87+"Z";var T="m0,1l"+k/2+","+k*.87+"l2.6,-1.5l-"+(k/2+2.6)+",-"+(k*.87+4.5)+"l-"+(k/2+2.6)+","+(k*.87+4.5)+"l2.6,1.5l"+k/2+",-"+k*.87+"Z";var S="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z";var E=true;_.initInteractions=function(){var t=this,e=t.layers.plotbg.select("path").node(),r=t.graphDiv,n=r._fullLayout._zoomlayer;var c={element:e,gd:r,plotinfo:{xaxis:t.xaxis,yaxis:t.yaxis},subplot:t.id,prepFn:function(e,a,i){c.xaxes=[t.xaxis];c.yaxes=[t.yaxis];var o=r._fullLayout.dragmode;if(e.shiftKey){if(o==="pan")o="zoom";else o="pan"}if(o==="lasso")c.minDrag=1;else c.minDrag=undefined;if(o==="zoom"){c.moveFn=B;c.doneFn=F;P(e,a,i)}else if(o==="pan"){c.moveFn=j;c.doneFn=V;N();y(n)}else if(o==="select"||o==="lasso"){m(e,a,i,c,o)}},clickFn:function(e,n){C(r);if(e===2){var a={};a[t.id+".aaxis.min"]=0;a[t.id+".baxis.min"]=0;a[t.id+".caxis.min"]=0;r.emit("plotly_doubleclick",null);i.call("relayout",r,a)}v.click(r,n,t.id)}};var f,h,p,g,b,_,k,L,I,z;function P(r,i,o){var s=e.getBoundingClientRect();f=i-s.left;h=o-s.top;p={a:t.aaxis.range[0],b:t.baxis.range[1],c:t.caxis.range[1]};b=p;g=t.aaxis.range[1]-p.a;_=a(t.graphDiv._fullLayout[t.id].bgcolor).getLuminance();k="M0,"+t.h+"L"+t.w/2+", 0L"+t.w+","+t.h+"Z";L=false;I=n.append("path").attr("class","zoombox").attr("transform","translate("+t.x0+", "+t.y0+")").style({fill:_>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",k);z=n.append("path").attr("class","zoombox-corners").attr("transform","translate("+t.x0+", "+t.y0+")").style({fill:l.background,stroke:l.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z");y(n)}function O(e,r){return 1-r/t.h}function D(e,r){return 1-(e+(t.h-r)/Math.sqrt(3))/t.w}function R(e,r){return(e-(t.h-r)/Math.sqrt(3))/t.w}function B(e,r){var n=f+e,a=h+r,i=Math.max(0,Math.min(1,O(f,h),O(n,a))),o=Math.max(0,Math.min(1,D(f,h),D(n,a))),s=Math.max(0,Math.min(1,R(f,h),R(n,a))),l=(i/2+s)*t.w,u=(1-i/2-o)*t.w,c=(l+u)/2,d=u-l,v=(1-i)*t.h,m=v-d/w;if(d.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200);z.transition().style("opacity",1).duration(200);L=true}}function F(){C(r);if(b===p)return;var e={};e[t.id+".aaxis.min"]=b.a;e[t.id+".baxis.min"]=b.b;e[t.id+".caxis.min"]=b.c;i.call("relayout",r,e);if(E&&r.data&&r._context.showTips){o.notifier(s(r,"Double-click to zoom back out"),"long");E=false}}function N(){p={a:t.aaxis.range[0],b:t.baxis.range[1],c:t.caxis.range[1]};b=p}function j(e,r){var n=e/t.xaxis._m,a=r/t.yaxis._m;b={a:p.a-a,b:p.b+(n+a)/2,c:p.c-(n-a)/2};var i=[b.a,b.b,b.c].sort(),o={a:i.indexOf(b.a),b:i.indexOf(b.b),c:i.indexOf(b.c)};if(i[0]<0){if(i[1]+i[0]/2<0){i[2]+=i[0]+i[1];i[0]=i[1]=0}else{i[2]+=i[0]/2;i[1]+=i[0]/2;i[0]=0}b={a:i[o.a],b:i[o.b],c:i[o.c]};r=(p.a-b.a)*t.yaxis._m;e=(p.c-b.c-p.b+b.b)*t.xaxis._m}var s="translate("+(t.x0+e)+","+(t.y0+r)+")";t.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",s);var l="translate("+-e+","+-r+")";t.clipDefRelative.select("path").attr("transform",l);t.aaxis.range=[b.a,t.sum-b.b-b.c];t.baxis.range=[t.sum-b.a-b.c,b.b];t.caxis.range=[t.sum-b.a-b.b,b.c];t.drawAxes(false);t.plotContainer.selectAll(".crisp").classed("crisp",false);if(t._hasClipOnAxisFalse){t.plotContainer.select(".scatterlayer").selectAll(".trace").call(u.hideOutsideRangePoints,t)}}function V(){var e={};e[t.id+".aaxis.min"]=b.a;e[t.id+".baxis.min"]=b.b;e[t.id+".caxis.min"]=b.c;i.call("relayout",r,e)}e.onmousemove=function(n){v.hover(r,n,t.id);r._fullLayout._lasthover=e;r._fullLayout._hoversubplot=t.id};e.onmouseout=function(t){if(r._dragging)return;d.unhover(r,t)};d.init(c)};function C(t){n.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}},{"../../components/color":558,"../../components/dragelement":580,"../../components/drawing":583,"../../components/fx":600,"../../components/titles":649,"../../lib":684,"../../lib/extend":673,"../../registry":817,"../cartesian/axes":732,"../cartesian/constants":737,"../cartesian/select":749,"../cartesian/set_convert":750,"../plots":795,d3:147,tinycolor2:499}],817:[function(t,e,r){"use strict";var n=t("./lib/loggers");var a=t("./lib/noop");var i=t("./lib/push_unique");var o=t("./lib/is_plain_object");var s=t("./lib/extend");var l=t("./plots/attributes");var u=t("./plots/layout_attributes");var c=s.extendFlat;var f=s.extendDeepAll;r.modules={};r.allCategories={};r.allTypes=[];r.subplotsRegistry={};r.transformsRegistry={};r.componentsRegistry={};r.layoutArrayContainers=[];r.layoutArrayRegexes=[];r.traceLayoutAttributes={};r.localeRegistry={};r.apiMethodRegistry={};r.register=function t(e){if(!e){throw new Error("No argument passed to Plotly.register.")}else if(e&&!Array.isArray(e)){e=[e]}for(var n=0;n-1}e.exports=function t(e,r){if(e.framework&&e.framework.isPolar){e=e.framework.getConfig()}var n;var l=e.data;var u=e.layout;var c=i([],l);var f=i({},u,o(r.tileClass));var h=e._context||{};if(r.width)f.width=r.width;if(r.height)f.height=r.height;if(r.tileClass==="thumbnail"||r.tileClass==="themes__thumb"){f.annotations=[];var p=Object.keys(f);for(n=0;n")!==-1){return""}return e.html(t).text()});e.remove();return r}function h(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}e.exports=function t(e,r,p){var d=e._fullLayout;var v=d._paper;var g=d._toppaper;var m=d.width;var y=d.height;var x;v.insert("rect",":first-child").call(i.setRect,0,0,m,y).call(o.fill,d.paper_bgcolor);var b=d._basePlotModules||[];for(x=0;x=2?E(t):t>e?Math.ceil(t):Math.floor(t)}if(!e._context.staticPlot){var L=l.opacity(i.mc||c.marker.color),I=L<1||T>.01?E:C;w=I(w,k);k=I(k,w);M=I(M,A);A=I(A,M)}o.ensureSingle(d,"path").style("vector-effect","non-scaling-stroke").attr("d","M"+w+","+M+"V"+A+"H"+k+"V"+M+"Z").call(u.setClipUrl,r.layerClipId);y(e,d,t,s,w,k,M,A);if(r.layerClipId){u.hideOutsideRangePoint(t[s],d.select("text"),f,h,c.xcalendar,c.ycalendar)}});var x=t[0].trace.cliponaxis===false;u.setClipUrl(d,x?null:r.layerClipId)});c.getComponentMethod("errorbars","plot")(d,r)};function y(t,e,r,n,a,i,l,c){var f;function h(e,r,n){var a=o.ensureSingle(e,"text").text(r).attr({class:"bartext bartext-"+f,transform:"","text-anchor":"middle","data-notex":1}).call(u.font,n).call(s.convertToTspans,t);return a}var p=r[0].trace,d=p.orientation;var v=w(p,n);f=k(p,n);if(!v||f==="none"){e.select("text").remove();return}var g=M(p,n,t._fullLayout.font),y=A(p,n,g),_=T(p,n,g);var S=t._fullLayout.barmode,E=S==="stack",C=S==="relative",L=E||C,I=r[n],z=!L||I._outmost,P=Math.abs(i-a)-2*m,O=Math.abs(c-l)-2*m,D,R,B,F;if(f==="outside"){if(!z)f="inside"}if(f==="auto"){if(z){f="inside";D=h(e,v,y);R=u.bBox(D.node()),B=R.width,F=R.height;var N=B>0&&F>0,j=B<=P&&F<=O,V=B<=O&&F<=P,U=d==="h"?P>=B*(O/F):O>=F*(P/B);if(N&&(j||V||U)){f="inside"}else{f="outside";D.remove();D=null}}else f="inside"}if(!D){D=h(e,v,f==="outside"?_:y);R=u.bBox(D.node()),B=R.width,F=R.height;if(B<=0||F<=0){D.remove();return}}var q,H;if(f==="outside"){H=p.constraintext==="both"||p.constraintext==="outside";q=b(a,i,l,c,R,d,H)}else{H=p.constraintext==="both"||p.constraintext==="inside";q=x(a,i,l,c,R,d,H)}D.attr("transform",q)}function x(t,e,r,n,a,i,o){var s=a.width,l=a.height,u=(a.left+a.right)/2,c=(a.top+a.bottom)/2,f=Math.abs(e-t),h=Math.abs(n-r),p,d,v,g;var y;if(f>2*m&&h>2*m){y=m;f-=2*y;h-=2*y}else y=0;var x,b;if(s<=f&&l<=h){x=false;b=1}else if(s<=h&&l<=f){x=true;b=1}else if(sr){v=(t+e)/2;g=n-y-d/2}else{v=(t+e)/2;g=n+y+d/2}}return _(u,c,v,g,b,x)}function b(t,e,r,n,a,i,o){var s=i==="h"?Math.abs(n-r):Math.abs(e-t),l;if(s>2*m){l=m}var u=1;if(o){u=i==="h"?Math.min(1,s/a.height):Math.min(1,s/a.width)}var c=(a.left+a.right)/2,f=(a.top+a.bottom)/2,h,p,d,v;h=u*a.width;p=u*a.height;if(i==="h"){if(er){d=(t+e)/2;v=n+l+p/2}else{d=(t+e)/2;v=n-l-p/2}}return _(c,f,d,v,u,false)}function _(t,e,r,n,a,i){var o,s,l;if(a<1)o="scale("+a+") ";else{a=1;o=""}s=i?"rotate("+i+" "+t+" "+e+") ":"";var u=r-a*t,c=n-a*e;l="translate("+u+" "+c+")";return l+o+s}function w(t,e){var r=E(t.text,e);return C(h,r)}function k(t,e){var r=E(t.textposition,e);return L(p,r)}function M(t,e,r){return S(d,t.textfont,e,r)}function A(t,e,r){return S(v,t.insidetextfont,e,r)}function T(t,e,r){return S(g,t.outsidetextfont,e,r)}function S(t,e,r,n){e=e||{};var a=E(e.family,r),i=E(e.size,r),o=E(e.color,r);return{family:C(t.family,a,n.family),size:I(t.size,i,n.size),color:z(t.color,o,n.color)}}function E(t,e){var r;if(!Array.isArray(t))r=t;else if(ei;if(!o)return e}return r!==undefined?r:t.dflt}function z(t,e,r){if(i(e).isValid())return e;return r!==undefined?r:t.dflt}},{"../../components/color":558,"../../components/drawing":583,"../../lib":684,"../../lib/svg_text_utils":708,"../../registry":817,"./attributes":827,d3:147,"fast-isnumeric":214,tinycolor2:499}],835:[function(t,e,r){"use strict";e.exports=function t(e,r){var n=e.cd;var a=e.xaxis;var i=e.yaxis;var o=[];var s;if(r===false){for(s=0;sf+u||!n(c))){p=true;y(h,t)}}for(var v=0;v1||o.bargap===0&&o.bargroupgap===0&&!t[0].trace.marker.line.width){n.select(this).attr("shape-rendering","crispEdges")}});r.selectAll("g.points").each(function(e){var r=n.select(this);var a=e[0].trace;s(r,a,t)});i.getComponentMethod("errorbars","style")(r)}function s(t,e,r){var i=t.selectAll("path");var o=t.selectAll("text");a.pointStyle(i,e,r);o.each(function(t){var r=n.select(this);var i;if(r.classed("bartext-inside")){i=e.insidetextfont}else if(r.classed("bartext-outside")){i=e.outsidetextfont}if(!i)i=e.textfont;function o(e){var r=i[e];return Array.isArray(r)?r[t.i]:r}a.font(r,o("family"),o("size"),o("color"))})}function l(t,e){var r=e[0].node3;var n=e[0].trace;if(n.selectedpoints){a.selectedPointStyle(r.selectAll("path"),n);a.selectedTextStyle(r.selectAll("text"),n)}else{s(r,n,t)}}e.exports={style:o,styleOnSelect:l}},{"../../components/drawing":583,"../../registry":817,d3:147}],839:[function(t,e,r){"use strict";var n=t("../../components/color");var a=t("../../components/colorscale/has_colorscale");var i=t("../../components/colorscale/defaults");e.exports=function t(e,r,o,s,l){o("marker.color",s);if(a(e,"marker")){i(e,r,l,o,{prefix:"marker.",cLetter:"c"})}o("marker.line.color",n.defaultLine);if(a(e,"marker.line")){i(e,r,l,o,{prefix:"marker.line.",cLetter:"c"})}o("marker.line.width");o("marker.opacity");o("selected.marker.color");o("unselected.marker.color")}},{"../../components/color":558,"../../components/colorscale/defaults":568,"../../components/colorscale/has_colorscale":572}],840:[function(t,e,r){"use strict";var n=t("../scatter/attributes");var a=t("../../components/color/attributes");var i=t("../../lib/extend").extendFlat;var o=n.marker;var s=o.line;e.exports={y:{valType:"data_array",editType:"calc+clearAxisTypes"},x:{valType:"data_array",editType:"calc+clearAxisTypes"},x0:{valType:"any",editType:"calc+clearAxisTypes"},y0:{valType:"any",editType:"calc+clearAxisTypes"},name:{valType:"string",editType:"calc+clearAxisTypes"},text:i({},n.text,{}),whiskerwidth:{valType:"number",min:0,max:1,dflt:.5,editType:"calcIfAutorange"},notched:{valType:"boolean",editType:"calcIfAutorange"},notchwidth:{valType:"number",min:0,max:.5,dflt:.25,editType:"calcIfAutorange"},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",false],dflt:"outliers",editType:"calcIfAutorange"},boxmean:{valType:"enumerated",values:[true,"sd",false],dflt:false,editType:"calcIfAutorange"},jitter:{valType:"number",min:0,max:1,editType:"calcIfAutorange"},pointpos:{valType:"number",min:-2,max:2,editType:"calcIfAutorange"},orientation:{valType:"enumerated",values:["v","h"],editType:"calc+clearAxisTypes"},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)",editType:"style"},symbol:i({},o.symbol,{arrayOk:false,editType:"plot"}),opacity:i({},o.opacity,{arrayOk:false,dflt:1,editType:"style"}),size:i({},o.size,{arrayOk:false,editType:"calcIfAutorange"}),color:i({},o.color,{arrayOk:false,editType:"style"}),line:{color:i({},s.color,{arrayOk:false,dflt:a.defaultLine,editType:"style"}),width:i({},s.width,{arrayOk:false,dflt:0,editType:"style"}),outliercolor:{valType:"color",editType:"style"},outlierwidth:{valType:"number",min:0,dflt:1,editType:"style"},editType:"style"},editType:"plot"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},editType:"plot"},fillcolor:n.fillcolor,selected:{marker:n.selected.marker,editType:"style"},unselected:{marker:n.unselected.marker,editType:"style"},hoveron:{valType:"flaglist",flags:["boxes","points"],dflt:"boxes+points",editType:"style"}}},{"../../components/color/attributes":557,"../../lib/extend":673,"../scatter/attributes":1015}],841:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("../../lib");var i=a._;var o=t("../../plots/cartesian/axes");e.exports=function t(e,r){var d=e._fullLayout;var v=o.getFromId(e,r.xaxis||"x");var g=o.getFromId(e,r.yaxis||"y");var m=[];var y=r.type==="violin"?"_numViolins":"_numBoxes";var x;var b,_;var w,k;if(r.orientation==="h"){b=v;_="x";w=g;k="y"}else{b=g;_="y";w=v;k="x"}var M=b.makeCalcdata(r,_);var A=s(r,k,w,M,d[y]);var T=a.distinctVals(A);var S=T.vals;var E=T.minDiff/2;var C=l(S,E);var L=S.length;var I=u(L);for(x=0;x=0&&P0){var D=I[x].sort(h);var R=D.map(p);var B=R.length;var F={pos:S[x],pts:D};F.min=R[0];F.max=R[B-1];F.mean=a.mean(R,B);F.sd=a.stdev(R,B,F.mean);F.q1=a.interp(R,.25);F.med=a.interp(R,.5);F.q3=a.interp(R,.75);F.lf=Math.min(F.q1,R[Math.min(a.findBin(2.5*F.q1-1.5*F.q3,R,true)+1,B-1)]);F.uf=Math.max(F.q3,R[Math.max(a.findBin(2.5*F.q3-1.5*F.q1,R),0)]);F.lo=4*F.q1-3*F.q3;F.uo=4*F.q3-3*F.q1;var N=F.q3-F.q1;var j=1.57*N/Math.sqrt(B);F.ln=F.med-j;F.un=F.med+j;m.push(F)}}f(m,r);o.expand(b,M,{padded:true});if(m.length>0){m[0].t={num:d[y],dPos:E,posLetter:k,valLetter:_,labels:{med:i(e,"median:"),min:i(e,"min:"),q1:i(e,"q1:"),q3:i(e,"q3:"),max:i(e,"max:"),mean:r.boxmean==="sd"?i(e,"mean \xb1 \u03c3:"):i(e,"mean:"),lf:i(e,"lower fence:"),uf:i(e,"upper fence:")}};d[y]++;return m}else{return[{t:{empty:true}}]}};function s(t,e,r,i,o){if(e in t){return r.makeCalcdata(t,e)}var s;if(e+"0"in t){s=t[e+"0"]}else if("name"in t&&(r.type==="category"||n(t.name)&&["linear","log"].indexOf(r.type)!==-1||a.isDateTime(t.name)&&r.type==="date")){s=t.name}else{s=o}var l=r.d2c(s,0,t[e+"calendar"]);return i.map(function(){return l})}function l(t,e){var r=t.length;var n=new Array(r+1);for(var a=0;a1;var g=a.dPos*d*(1-i.boxgroupgap)/(v?p:1);var m=v?2*a.dPos*(-.5+(a.num+.5)/p)*d:0;var y=g*l.whiskerwidth;if(l.visible!==true||a.empty){h.remove();return}var x,b;if(l.orientation==="h"){x=s;b=o}else{x=o;b=s}a.bPos=m;a.bdPos=g;a.wdPos=y;a.wHover=a.dPos*(v?d/p:1);u(h,{pos:x,val:b},l,a);c(h,{x:o,y:s},l,a);f(h,{pos:x,val:b},l,a)})}function u(t,e,r,i){var o=e.pos;var s=e.val;var l=i.bPos;var u=i.wdPos||0;var c=i.bPosPxOffset||0;var f=r.whiskerwidth||0;var h=r.notched||false;var p=h?1-2*r.notchwidth:1;var d;var v;if(Array.isArray(i.bdPos)){d=i.bdPos[0];v=i.bdPos[1]}else{d=i.bdPos;v=i.bdPos}var g=t.selectAll("path.box").data(r.type!=="violin"||r.box?a.identity:[]);g.enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","box");g.exit().remove();g.each(function(t){var e=t.pos;var i=o.c2p(e+l,true)+c;var g=o.c2p(e+l-d,true)+c;var m=o.c2p(e+l+v,true)+c;var y=o.c2p(e+l-u,true)+c;var x=o.c2p(e+l+u,true)+c;var b=o.c2p(e+l-d*p,true)+c;var _=o.c2p(e+l+v*p,true)+c;var w=s.c2p(t.q1,true);var k=s.c2p(t.q3,true);var M=a.constrain(s.c2p(t.med,true),Math.min(w,k)+1,Math.max(w,k)-1);var A=t.lf===undefined||r.boxpoints===false;var T=s.c2p(A?t.min:t.lf,true);var S=s.c2p(A?t.max:t.uf,true);var E=s.c2p(t.ln,true);var C=s.c2p(t.un,true);if(r.orientation==="h"){n.select(this).attr("d","M"+M+","+b+"V"+_+"M"+w+","+g+"V"+m+(h?"H"+E+"L"+M+","+_+"L"+C+","+m:"")+"H"+k+"V"+g+(h?"H"+C+"L"+M+","+b+"L"+E+","+g:"")+"Z"+"M"+w+","+i+"H"+T+"M"+k+","+i+"H"+S+(f===0?"":"M"+T+","+y+"V"+x+"M"+S+","+y+"V"+x))}else{n.select(this).attr("d","M"+b+","+M+"H"+_+"M"+g+","+w+"H"+m+(h?"V"+E+"L"+_+","+M+"L"+m+","+C:"")+"V"+k+"H"+g+(h?"V"+C+"L"+b+","+M+"L"+g+","+E:"")+"Z"+"M"+i+","+w+"V"+T+"M"+i+","+k+"V"+S+(f===0?"":"M"+y+","+T+"H"+x+"M"+y+","+S+"H"+x))}})}function c(t,e,r,n){var l=e.x;var u=e.y;var c=n.bdPos;var f=n.bPos;var h=r.boxpoints||r.points;a.seedPseudoRandom();var p=function(t){t.forEach(function(t){t.t=n;t.trace=r});return t};var d=t.selectAll("g.points").data(h?p:[]);d.enter().append("g").attr("class","points");d.exit().remove();var v=d.selectAll("path").data(function(t){var e;var n=h==="all"?t.pts:t.pts.filter(function(e){return e.vt.uf});var i=Math.max((t.max-t.min)/10,t.q3-t.q1);var l=i*1e-9;var u=i*s;var p=[];var d=0;var v;if(r.jitter){if(i===0){d=1;p=new Array(n.length);for(e=0;et.lo){_.so=true}}return n});v.enter().append("path").classed("point",true);v.exit().remove();v.call(i.translatePoints,l,u)}function f(t,e,r,i){var o=e.pos;var s=e.val;var l=i.bPos;var u=i.bPosPxOffset||0;var c=r.boxmean||(r.meanline||{}).visible;var f;var h;if(Array.isArray(i.bdPos)){f=i.bdPos[0];h=i.bdPos[1]}else{f=i.bdPos;h=i.bdPos}var p=t.selectAll("path.mean").data(r.type==="box"&&r.boxmean||r.type==="violin"&&r.box&&r.meanline?a.identity:[]);p.enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"});p.exit().remove();p.each(function(t){var e=o.c2p(t.pos+l,true)+u;var a=o.c2p(t.pos+l-f,true)+u;var i=o.c2p(t.pos+l+h,true)+u;var p=s.c2p(t.mean,true);var d=s.c2p(t.mean-t.sd,true);var v=s.c2p(t.mean+t.sd,true);if(r.orientation==="h"){n.select(this).attr("d","M"+p+","+a+"V"+i+(c==="sd"?"m0,0L"+d+","+e+"L"+p+","+a+"L"+v+","+e+"Z":""))}else{n.select(this).attr("d","M"+a+","+p+"H"+i+(c==="sd"?"m0,0L"+e+","+d+"L"+a+","+p+"L"+e+","+v+"Z":""))}})}e.exports={plot:l,plotBoxAndWhiskers:u,plotPoints:c,plotBoxMean:f}},{"../../components/drawing":583,"../../lib":684,d3:147}],848:[function(t,e,r){"use strict";e.exports=function t(e,r){var n=e.cd;var a=e.xaxis;var i=e.yaxis;var o=[];var s,l;if(r===false){for(s=0;s=10){return null}var r=Infinity;var i=-Infinity;var o=t.length;for(var s=0;s0?Math.floor:Math.ceil;var P=L>0?Math.ceil:Math.floor;var O=L>0?Math.min:Math.max;var D=L>0?Math.max:Math.min;var R=z(E+I);var B=P(C-I);f=S(E);var F=[[f]];for(i=R;i*L=0;i--){o[f-i]=e[h][i];s[f-i]=r[h][i]}l.push({x:o,y:s,bicubic:u});for(i=h,o=[],s=[];i>=0;i--){o[h-i]=e[i][0];s[h-i]=r[i][0]}l.push({x:o,y:s,bicubic:c});return l}},{}],863:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");var a=t("../../lib/extend").extendFlat;e.exports=function t(e,r,i){var o,s,l;var u,c,f,h,p,d,v;var g,m,y,x;var b=e["_"+r];var _=e[r+"axis"];var w=_._gridlines=[];var k=_._minorgridlines=[];var M=_._boundarylines=[];var A=e["_"+i];var T=e[i+"axis"];if(_.tickmode==="array"){_.tickvals=b.slice()}var S=e._xctrl;var E=e._yctrl;var C=S[0].length;var L=S.length;var I=e._a.length;var z=e._b.length;n.prepTicks(_);if(_.tickmode==="array")delete _.tickvals;var P=_.smoothing?3:1;function O(t){var n,a,o,s,l,u,c,f,h,d,v,g;var m=[];var y=[];var x={};if(r==="b"){a=e.b2j(t);o=Math.floor(Math.max(0,Math.min(z-2,a)));s=a-o;x.length=z;x.crossLength=I;x.xy=function(t){return e.evalxy([],t,a)};x.dxy=function(t,r){return e.dxydi([],t,o,r,s)};for(n=0;n0){h=e.dxydi([],n-1,o,0,s);m.push(l[0]+h[0]/3);y.push(l[1]+h[1]/3);d=e.dxydi([],n-1,o,1,s);m.push(f[0]-d[0]/3);y.push(f[1]-d[1]/3)}m.push(f[0]);y.push(f[1]);l=f}}else{n=e.a2i(t);u=Math.floor(Math.max(0,Math.min(I-2,n)));c=n-u;x.length=I;x.crossLength=z;x.xy=function(t){return e.evalxy([],n,t)};x.dxy=function(t,r){return e.dxydj([],u,t,c,r)};for(a=0;a0){v=e.dxydj([],u,a-1,c,0);m.push(l[0]+v[0]/3);y.push(l[1]+v[1]/3);g=e.dxydj([],u,a-1,c,1);m.push(f[0]-g[0]/3);y.push(f[1]-g[1]/3)}m.push(f[0]);y.push(f[1]);l=f}}x.axisLetter=r;x.axis=_;x.crossAxis=T;x.value=t;x.constvar=i;x.index=p;x.x=m;x.y=y;x.smoothing=T.smoothing;return x}function D(t){var n,a,o,s,l;var u=[];var c=[];var f={};f.length=b.length;f.crossLength=A.length;if(r==="b"){o=Math.max(0,Math.min(z-2,t));l=Math.min(1,Math.max(0,t-o));f.xy=function(r){return e.evalxy([],r,t)};f.dxy=function(t,r){return e.dxydi([],t,o,r,l)};for(n=0;nb.length-1)continue;w.push(a(D(s),{color:_.gridcolor,width:_.gridwidth}))}for(p=f;pb.length-1)continue;if(g<0||g>b.length-1)continue;m=b[l];y=b[g];for(o=0;o<_.minorgridcount;o++){x=g-l;if(x<=0)continue;v=m+(y-m)*(o+1)/(_.minorgridcount+1)*(_.arraydtick/x);if(vb[b.length-1])continue;k.push(a(O(v),{color:_.minorgridcolor,width:_.minorgridwidth}))}}if(_.startline){M.push(a(D(0),{color:_.startlinecolor,width:_.startlinewidth}))}if(_.endline){M.push(a(D(b.length-1),{color:_.endlinecolor,width:_.endlinewidth}))}}else{u=5e-15;c=[Math.floor((b[b.length-1]-_.tick0)/_.dtick*(1+u)),Math.ceil((b[0]-_.tick0)/_.dtick/(1+u))].sort(function(t,e){return t-e});f=c[0];h=c[1];for(p=f;p<=h;p++){d=_.tick0+_.dtick*p;w.push(a(O(d),{color:_.gridcolor,width:_.gridwidth}))}for(p=f-1;pb[b.length-1])continue;k.push(a(O(v),{color:_.minorgridcolor,width:_.minorgridwidth}))}}if(_.startline){M.push(a(O(b[0]),{color:_.startlinecolor,width:_.startlinewidth}))}if(_.endline){M.push(a(O(b[b.length-1]),{color:_.endlinecolor,width:_.endlinewidth}))}}}},{"../../lib/extend":673,"../../plots/cartesian/axes":732}],864:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");var a=t("../../lib/extend").extendFlat;e.exports=function t(e,r){var i,o,s,l,u;var c=r._labels=[];var f=r._gridlines;for(i=0;ir.length){e=e.slice(0,r.length)}for(i=0;i90){d-=180;u=-u}return{angle:d,flip:u,p:e.c2p(a,r,n),offsetMultplier:c}}},{}],878:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../components/drawing");var i=t("./map_1d_array");var o=t("./makepath");var s=t("./orient_text");var l=t("../../lib/svg_text_utils");var u=t("../../lib");var c=t("../../constants/alignment");var f=t("../../plots/get_data").getUidsFromCalcData;e.exports=function t(e,r,a,i){var o=f(a);i.selectAll("g.trace").each(function(){var t=n.select(this).attr("class");var e=t.split("carpet")[1].split(/\s/)[0];if(!o[e]){n.select(this).remove()}});for(var s=0;s0?"start":"end","data-notex":1}).call(a.font,o.font).text(o.text).call(l.convertToTspans,t);var g=a.bBox(this);v.attr("transform","translate("+c.p[0]+","+c.p[1]+") "+"rotate("+c.angle+")"+"translate("+o.axis.labelpadding*h+","+g.height*.3+")");p=Math.max(p,g.width+o.axis.labelpadding)});h.exit().remove();d.maxExtent=p;return d}function g(t,e,r,n,a,i,o,l){var c,f,h,p;c=.5*(r.a[0]+r.a[r.a.length-1]);f=r.b[0];h=r.ab2xy(c,f,true);p=r.dxyda_rough(c,f);if(o.angle===undefined){u.extendFlat(o,s(r,a,i,h,r.dxydb_rough(c,f)))}x(t,e,r,n,h,p,r.aaxis,a,i,o,"a-title");c=r.a[0];f=.5*(r.b[0]+r.b[r.b.length-1]);h=r.ab2xy(c,f,true);p=r.dxydb_rough(c,f);if(l.angle===undefined){u.extendFlat(l,s(r,a,i,h,r.dxyda_rough(c,f)))}x(t,e,r,n,h,p,r.baxis,a,i,l,"b-title")}var m=c.LINE_SPACING;var y=(1-c.MID_SHIFT)/m+1;function x(t,e,r,i,o,u,c,f,h,p,d){var v=[];if(c.title)v.push(c.title);var g=e.selectAll("text."+d).data(v);var x=p.maxExtent;g.enter().append("text").classed(d,true);g.each(function(){var e=s(r,f,h,o,u);if(["start","both"].indexOf(c.showticklabels)===-1){x=0}var i=c.titlefont.size;x+=i+c.titleoffset;var d=p.angle+(p.flip<0?180:0);var v=(d-e.angle+450)%360;var g=v>90&&v<270;var b=n.select(this);b.text(c.title||"").call(l.convertToTspans,t);if(g){x=(-l.lineCount(b)+y)*m*i-x}b.attr("transform","translate("+e.p[0]+","+e.p[1]+") "+"rotate("+e.angle+") "+"translate(0,"+x+")").classed("user-select-none",true).attr("text-anchor","middle").call(a.font,c.titlefont)});g.exit().remove()}},{"../../components/drawing":583,"../../constants/alignment":656,"../../lib":684,"../../lib/svg_text_utils":708,"../../plots/get_data":768,"./makepath":875,"./map_1d_array":876,"./orient_text":877,d3:147}],879:[function(t,e,r){"use strict";var n=t("./constants");var a=t("../../lib/search").findBin;var i=t("./compute_control_points");var o=t("./create_spline_evaluator");var s=t("./create_i_derivative_evaluator");var l=t("./create_j_derivative_evaluator");e.exports=function t(e){var r=e._a;var u=e._b;var c=r.length;var f=u.length;var h=e.aaxis;var p=e.baxis;var d=r[0];var v=r[c-1];var g=u[0];var m=u[f-1];var y=r[r.length-1]-r[0];var x=u[u.length-1]-u[0];var b=y*n.RELATIVE_CULL_TOLERANCE;var _=x*n.RELATIVE_CULL_TOLERANCE;d-=b;v+=b;g-=_;m+=_;e.isVisible=function(t,e){return t>d&&tg&&ev||em};e.setScale=function(){var t=e._x;var r=e._y;var n=i(e._xctrl,e._yctrl,t,r,h.smoothing,p.smoothing);e._xctrl=n[0];e._yctrl=n[1];e.evalxy=o([e._xctrl,e._yctrl],c,f,h.smoothing,p.smoothing);e.dxydi=s([e._xctrl,e._yctrl],h.smoothing,p.smoothing);e.dxydj=l([e._xctrl,e._yctrl],h.smoothing,p.smoothing)};e.i2a=function(t){var e=Math.max(0,Math.floor(t[0]),c-2);var n=t[0]-e;return(1-n)*r[e]+n*r[e+1]};e.j2b=function(t){var e=Math.max(0,Math.floor(t[1]),c-2);var r=t[1]-e;return(1-r)*u[e]+r*u[e+1]};e.ij2ab=function(t){return[e.i2a(t[0]),e.j2b(t[1])]};e.a2i=function(t){var e=Math.max(0,Math.min(a(t,r),c-2));var n=r[e];var i=r[e+1];return Math.max(0,Math.min(c-1,e+(t-n)/(i-n)))};e.b2j=function(t){var e=Math.max(0,Math.min(a(t,u),f-2));var r=u[e];var n=u[e+1];return Math.max(0,Math.min(f-1,e+(t-r)/(n-r)))};e.ab2ij=function(t){return[e.a2i(t[0]),e.b2j(t[1])]};e.i2c=function(t,r){return e.evalxy([],t,r)};e.ab2xy=function(t,n,a){if(!a&&(tr[c-1]|nu[f-1])){return[false,false]}var i=e.a2i(t);var o=e.b2j(n);var s=e.evalxy([],i,o);if(a){var l=0;var h=0;var p=[];var d,v,g,m;if(tr[c-1]){d=c-2;v=1;l=(t-r[c-1])/(r[c-1]-r[c-2])}else{d=Math.max(0,Math.min(c-2,Math.floor(i)));v=i-d}if(nu[f-1]){g=f-2;m=1;h=(n-u[f-1])/(u[f-1]-u[f-2])}else{g=Math.max(0,Math.min(f-2,Math.floor(o)));m=o-g}if(l){e.dxydi(p,d,g,v,m);s[0]+=p[0]*l;s[1]+=p[1]*l}if(h){e.dxydj(p,d,g,v,m);s[0]+=p[0]*h;s[1]+=p[1]*h}}return s};e.c2p=function(t,e,r){return[e.c2p(t[0]),r.c2p(t[1])]};e.p2x=function(t,e,r){return[e.p2c(t[0]),r.p2c(t[1])]};e.dadi=function(t){var e=Math.max(0,Math.min(r.length-2,t));return r[e+1]-r[e]};e.dbdj=function(t){var e=Math.max(0,Math.min(u.length-2,t));return u[e+1]-u[e]};e.dxyda=function(t,r,n,a){var i=e.dxydi(null,t,r,n,a);var o=e.dadi(t,n);return[i[0]/o,i[1]/o]};e.dxydb=function(t,r,n,a){var i=e.dxydj(null,t,r,n,a);var o=e.dbdj(r,a);return[i[0]/o,i[1]/o]};e.dxyda_rough=function(t,r,n){var a=y*(n||.1);var i=e.ab2xy(t+a,r,true);var o=e.ab2xy(t-a,r,true);return[(i[0]-o[0])*.5/a,(i[1]-o[1])*.5/a]};e.dxydb_rough=function(t,r,n){var a=x*(n||.1);var i=e.ab2xy(t,r+a,true);var o=e.ab2xy(t,r-a,true);return[(i[0]-o[0])*.5/a,(i[1]-o[1])*.5/a]};e.dpdx=function(t){return t._m};e.dpdy=function(t){return t._m}}},{"../../lib/search":703,"./compute_control_points":867,"./constants":868,"./create_i_derivative_evaluator":869,"./create_j_derivative_evaluator":870,"./create_spline_evaluator":871}],880:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function t(e,r,a){var i,o,s;var l=[];var u=[];var c=e[0].length;var f=e.length;function h(t,r){var n=0;var a;var i=0;if(t>0&&(a=e[r][t-1])!==undefined){i++;n+=a}if(t0&&(a=e[r-1][t])!==undefined){i++;n+=a}if(r0&&o0&&iA);n.log("Smoother converged to",T,"after",E,"iterations");return e}},{"../../lib":684}],881:[function(t,e,r){"use strict";var n=t("../../lib").isArray1D;e.exports=function t(e,r,a){var i=a("x");var o=i&&i.length;var s=a("y");var l=s&&s.length;if(!o&&!l)return false;r._cheater=!i;if((!o||n(i))&&(!l||n(s))){var u=o?i.length:Infinity;if(l)u=Math.min(u,s.length);if(r.a&&r.a.length)u=Math.min(u,r.a.length);if(r.b&&r.b.length)u=Math.min(u,r.b.length);r._length=u}else r._length=null;return true}},{"../../lib":684}],882:[function(t,e,r){"use strict";var n=t("../scattergeo/attributes");var a=t("../../components/colorscale/attributes");var i=t("../../components/colorbar/attributes");var o=t("../../plots/attributes");var s=t("../../lib/extend").extendFlat;var l=n.marker.line;e.exports=s({locations:{valType:"data_array",editType:"calc"},locationmode:n.locationmode,z:{valType:"data_array",editType:"calc"},text:s({},n.text,{}),marker:{line:{color:l.color,width:s({},l.width,{dflt:1}),editType:"calc"},opacity:{valType:"number",arrayOk:true,min:0,max:1,dflt:1,editType:"style"},editType:"calc"},selected:{marker:{opacity:n.selected.marker.opacity,editType:"plot"},editType:"plot"},unselected:{marker:{opacity:n.unselected.marker.opacity,editType:"plot"},editType:"plot"},hoverinfo:s({},o.hoverinfo,{editType:"calc",flags:["location","z","text","name"]})},a("",{cLetter:"z",editTypeOverride:"calc"}),{colorbar:i})},{"../../components/colorbar/attributes":559,"../../components/colorscale/attributes":565,"../../lib/extend":673,"../../plots/attributes":729,"../scattergeo/attributes":1053}],883:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("../../constants/numerical").BADNUM;var i=t("../../components/colorscale/calc");var o=t("../scatter/arrays_to_calcdata");var s=t("../scatter/calc_selection");e.exports=function t(e,r){var l=r._length;var u=new Array(l);for(var c=0;c")}},{"../../plots/cartesian/axes":732,"../scatter/fill_hover_text":1022,"./attributes":882}],887:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes");n.supplyDefaults=t("./defaults");n.colorbar=t("../heatmap/colorbar");n.calc=t("./calc");n.plot=t("./plot");n.style=t("./style").style;n.styleOnSelect=t("./style").styleOnSelect;n.hoverPoints=t("./hover");n.eventData=t("./event_data");n.selectPoints=t("./select");n.moduleType="trace";n.name="choropleth";n.basePlotModule=t("../../plots/geo");n.categories=["geo","noOpacity"];n.meta={};e.exports=n},{"../../plots/geo":762,"../heatmap/colorbar":928,"./attributes":882,"./calc":883,"./defaults":884,"./event_data":885,"./hover":886,"./plot":888,"./select":889,"./style":890}],888:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../lib");var i=t("../../lib/polygon");var o=t("../../lib/topojson_utils").getTopojsonFeatures;var s=t("../../lib/geo_location_utils").locationToFeature;var l=t("./style").style;e.exports=function t(e,r,i){for(var o=0;o0&&t[e+1][0]<0)return e}return null}if(n==="RUS"||n==="FJI"){o=function(t){var e;if(c(t)===null){e=t}else{e=new Array(t.length);for(u=0;ue){r[n++]=[t[u][0]+360,t[u][1]]}else if(u===e){r[n++]=t[u];r[n++]=[t[u][0],-90]}else{r[n++]=t[u]}}var o=i.tester(r);o.pts.pop();a.push(o)}}else{o=function(t){a.push(i.tester(t))}}switch(e.type){case"MultiPolygon":for(s=0;s":if(f.value>h){s.prefixBoundary=true}break;case"<":if(f.valueh){s.prefixBoundary=true}break;case"][":i=Math.min.apply(null,f.value);o=Math.max.apply(null,f.value);if(ih){s.prefixBoundary=true}break}}},{}],899:[function(t,e,r){"use strict";var n=t("../../components/colorbar/draw");var a=t("./make_color_map");var i=t("./end_plus");e.exports=function t(e,r){var o=r[0].trace,s="cb"+o.uid;e._fullLayout._infolayer.selectAll("."+s).remove();if(!o.showscale)return;var l=n(e,s);r[0].t.cb=l;var u=o.contours,c=o.line,f=u.size||1,h=u.coloring;var p=a(o,{isColorbar:true});if(h==="heatmap"){l.filllevels({start:o.zmin,end:o.zmax,size:(o.zmax-o.zmin)/254})}l.fillcolor(h==="fill"||h==="heatmap"?p:"").line({color:h==="lines"?p:c.color,width:u.showlines!==false?c.width:0,dash:c.dash}).levels({start:u.start,end:i(u),size:f}).options(o.colorbar)()}},{"../../components/colorbar/draw":563,"./end_plus":907,"./make_color_map":912}],900:[function(t,e,r){"use strict";e.exports={BOTTOMSTART:[1,9,13,104,713],TOPSTART:[4,6,7,104,713],LEFTSTART:[8,12,14,208,1114],RIGHTSTART:[2,3,11,208,1114],NEWDELTA:[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]],CHOOSESADDLE:{104:[4,1],208:[2,8],713:[7,13],1114:[11,14]},SADDLEREMAINDER:{1:4,2:8,4:1,7:13,8:2,11:14,13:7,14:11},LABELDISTANCE:2,LABELINCREASE:10,LABELMIN:3,LABELMAX:10,LABELOPTIMIZER:{EDGECOST:1,ANGLECOST:1,NEIGHBORCOST:5,SAMELEVELFACTOR:10,SAMELEVELDISTANCE:5,MAXCOST:100,INITIALSEARCHPOINTS:10,ITERATIONS:5}}},{}],901:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("./label_defaults");var i=t("../../components/color");var o=i.addOpacity;var s=i.opacity;var l=t("../../constants/filter_ops");var u=l.CONSTRAINT_REDUCTION;var c=l.COMPARISON_OPS2;e.exports=function t(e,r,n,i,l,c){var h=r.contours;var p,d,v;var g=n("contours.operation");h._operation=u[g];f(n,h);if(g==="="){p=h.showlines=true}else{p=n("contours.showlines");v=n("fillcolor",o((e.line||{}).color||l,.5))}if(p){var m=v&&s(v)?o(r.fillcolor,1):l;d=n("line.color",m);n("line.width",2);n("line.dash")}n("line.smoothing");a(n,i,d,c)};function f(t,e){var r;if(c.indexOf(e.operation)===-1){t("contours.value",[0,1]);if(!Array.isArray(e.value)){if(n(e.value)){r=parseFloat(e.value);e.value=[r,r+1]}}else if(e.value.length>2){e.value=e.value.slice(2)}else if(e.length===0){e.value=[0,1]}else if(e.length<2){r=parseFloat(e.value[0]);e.value=[r,r+1]}else{e.value=[parseFloat(e.value[0]),parseFloat(e.value[1])]}}else{t("contours.value",0);if(!n(e.value)){if(Array.isArray(e.value)){e.value=parseFloat(e.value[0])}else{e.value=0}}}}},{"../../components/color":558,"../../constants/filter_ops":657,"./label_defaults":911,"fast-isnumeric":214}],902:[function(t,e,r){"use strict";var n=t("../../constants/filter_ops");var a=t("fast-isnumeric");e.exports={"[]":o("[]"),"][":o("]["),">":s(">"),"<":s("<"),"=":s("=")};function i(t,e){var r=Array.isArray(e);var i;function o(t){return a(t)?+t:null}if(n.COMPARISON_OPS2.indexOf(t)!==-1){i=r?o(e[0]):o(e)}else if(n.INTERVAL_OPS.indexOf(t)!==-1){i=r?[o(e[0]),o(e[1])]:[o(e),o(e)]}else if(n.SET_OPS.indexOf(t)!==-1){i=r?e.map(o):[o(e)]}return i}function o(t){return function(e){e=i(t,e);var r=Math.min(e[0],e[1]);var n=Math.max(e[0],e[1]);return{start:r,end:n,size:n-r}}}function s(t){return function(e){e=i(t,e);return{start:e,end:Infinity,size:Infinity}}}},{"../../constants/filter_ops":657,"fast-isnumeric":214}],903:[function(t,e,r){"use strict";e.exports=function t(e,r,n,a){var i=a("contours.start");var o=a("contours.end");var s=i===false||o===false;var l=n("contours.size");var u;if(s)u=r.autocontour=true;else u=n("autocontour",false);if(u||!l)n("ncontours")}},{}],904:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){var r,i,o;var s=function(t){return t.reverse()};var l=function(t){return t};switch(e){case"=":case"<":return t;case">":if(t.length!==1){n.warn("Contour data invalid for the specified inequality operation.")}i=t[0];for(r=0;r1e3){n.warn("Too many contours, clipping at 1000",e);break}}return u}},{"../../lib":684,"./constraint_mapping":902,"./end_plus":907}],907:[function(t,e,r){"use strict";e.exports=function t(e){return e.end+e.size/1e6}},{}],908:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("./constants");e.exports=function t(e,r,a){var i,o,l,u,c;r=r||.01;a=a||.01;for(l=0;l20){p=a.CHOOSESADDLE[p][(d[0]||d[1])<0?0:1];t.crossings[h]=a.SADDLEREMAINDER[p]}else{delete t.crossings[h]}d=a.NEWDELTA[p];if(!d){n.log("Found bad marching index:",p,e,t.level);break}v.push(u(t,e,d));e[0]+=d[0];e[1]+=d[1];if(i(v[v.length-1],v[v.length-2],s,c))v.pop();h=e.join(",");var b=d[0]&&(e[0]<0||e[0]>y-2)||d[1]&&(e[1]<0||e[1]>m-2),_=h===f&&d.join(",")===g;if(_||r&&b)break;p=t.crossings[h]}if(x===1e4){n.log("Infinite loop in contour?")}var w=i(v[0],v[v.length-1],s,c);var k=0;var M=.2*t.smoothing;var A=[];var T=0;var S,E,C,L,I,z,P,O,D,R,B;for(x=1;x=T;x--){S=A[x];if(S=T;E--){if(S+A[E]O)D--;t.edgepaths[D]=B.concat(v,R)}break}}if(!V){t.edgepaths[O]=v.concat(R)}}}for(O=0;O20&&e){if(t===208||t===1114){n=r[0]===0?1:-1}else{i=r[1]===0?1:-1}}else if(a.BOTTOMSTART.indexOf(t)!==-1)i=1;else if(a.LEFTSTART.indexOf(t)!==-1)n=1;else if(a.TOPSTART.indexOf(t)!==-1)i=-1;else n=-1;return[n,i]}function u(t,e,r){var n=e[0]+Math.max(r[0],0),a=e[1]+Math.max(r[1],0),i=t.z[a][n],o=t.xaxis,s=t.yaxis;if(r[1]){var l=(t.level-i)/(t.z[a][n+1]-i);return[o.c2p((1-l)*t.x[n]+l*t.x[n+1],true),s.c2p(t.y[a],true),n+l,a]}else{var u=(t.level-i)/(t.z[a+1][n]-i);return[o.c2p(t.x[n],true),s.c2p((1-u)*t.y[a]+u*t.y[a+1],true),n,a+u]}}},{"../../lib":684,"./constants":900}],909:[function(t,e,r){"use strict";var n=t("../../components/color");var a=t("../heatmap/hover");e.exports=function t(e,r,i,o,s){var l=a(e,r,i,o,s,true);if(l){l.forEach(function(t){var e=t.trace;if(e.contours.type==="constraint"){if(e.fillcolor&&n.opacity(e.fillcolor)){t.color=n.addOpacity(e.fillcolor,1)}else if(e.contours.showlines&&n.opacity(e.line.color)){t.color=n.addOpacity(e.line.color,1)}}})}return l}},{"../../components/color":558,"../heatmap/hover":932}],910:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes");n.supplyDefaults=t("./defaults");n.calc=t("./calc");n.plot=t("./plot").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","svg","2dMap","contour","showLegend"];n.meta={};e.exports=n},{"../../plots/cartesian":743,"./attributes":896,"./calc":897,"./colorbar":899,"./defaults":905,"./hover":909,"./plot":914,"./style":916}],911:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function t(e,r,a,i){if(!i)i={};var o=e("contours.showlabels");if(o){var s=r.font;n.coerceFont(e,"contours.labelfont",{family:s.family,size:s.size,color:a});e("contours.labelformat")}if(i.hasHover!==false)e("zhoverformat")}},{"../../lib":684}],912:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../components/colorscale");var i=t("./end_plus");e.exports=function t(e){var r=e.contours,o=r.start,s=i(r),l=r.size||1,u=Math.floor((s-o)/l)+1,c=r.coloring==="lines"?0:1;if(!isFinite(l)){l=1;u=1}var f=e.colorscale,h=f.length;var p=new Array(h),d=new Array(h);var v,g;if(r.coloring==="heatmap"){if(e.zauto&&e.autocontour===false){e.zmin=o-l/2;e.zmax=e.zmin+u*l}for(g=0;gt?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(r===5||r===10){var n=(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4;if(t>n)return r===5?713:1114;return r===5?104:208}return r===15?0:r}},{"./constants":900}],914:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../lib");var i=t("../../components/drawing");var o=t("../../lib/svg_text_utils");var s=t("../../plots/cartesian/axes");var l=t("../../plots/cartesian/set_convert");var u=t("../../plots/get_data").getUidsFromCalcData;var c=t("../heatmap/plot");var f=t("./make_crossings");var h=t("./find_all_paths");var p=t("./empty_pathinfo");var d=t("./convert_to_constraints");var v=t("./close_boundaries");var g=t("./constants");var m=g.LABELOPTIMIZER;r.plot=function t(e,r,a,i){var o=u(a);i.selectAll("g.contour").each(function(t){if(!o[t.trace.uid]){n.select(this).remove()}});for(var s=0;st.level}if(r){return"M"+e.join("L")+"Z"}return""}function w(t,e){var r=_(t,e),n=0,o=t.edgepaths.map(function(t,e){return e}),s=true,l,u,c,f,h,p;function d(t){return Math.abs(t[1]-e[0][1])<.01}function v(t){return Math.abs(t[1]-e[2][1])<.01}function g(t){return Math.abs(t[0]-e[0][0])<.01}function m(t){return Math.abs(t[0]-e[2][0])<.01}while(o.length){p=i.smoothopen(t.edgepaths[n],t.smoothing);r+=s?p:p.replace(/^M/,"L");o.splice(o.indexOf(n),1);l=t.edgepaths[n][t.edgepaths[n].length-1];f=-1;for(c=0;c<4;c++){if(!l){a.log("Missing end?",n,t);break}if(d(l)&&!m(l))u=e[1];else if(g(l))u=e[0];else if(v(l))u=e[3];else if(m(l))u=e[2];for(h=0;h=0){u=y;f=h}}else if(Math.abs(l[1]-u[1])<.01){if(Math.abs(l[1]-y[1])<.01&&(y[0]-l[0])*(u[0]-y[0])>=0){u=y;f=h}}else{a.log("endpt to newendpt is not vert. or horz.",l,u,y)}}l=u;if(f>=0)break;r+="L"+u}if(f===t.edgepaths.length){a.log("unclosed perimeter path");break}n=f;s=o.indexOf(n)===-1;if(s){n=o[0];r+="Z"}}for(n=0;nm.MAXCOST*2)break;if(p)l/=2;s=c-l/2;u=s+l*1.5}if(h<=m.MAXCOST)return f};function M(t,e,r,n){var i=e.width/2;var o=e.height/2;var s=t.x;var l=t.y;var u=t.theta;var c=Math.cos(u)*i;var f=Math.sin(u)*i;var h=(s>n.center?n.right-s:s-n.left)/(c+Math.abs(Math.sin(u)*o));var p=(l>n.middle?n.bottom-l:l-n.top)/(Math.abs(f)+Math.cos(u)*o);if(h<1||p<1)return Infinity;var d=m.EDGECOST*(1/(h-1)+1/(p-1));d+=m.ANGLECOST*u*u;var v=s-c;var g=l-f;var y=s+c;var x=l+f;for(var b=0;br.end){r.start=r.end=(r.start+r.end)/2}if(!e._input.contours)e._input.contours={};a.extendFlat(e._input.contours,{start:r.start,end:r.end,size:r.size});e._input.autocontour=true}else if(r.type!=="constraint"){var u=r.start,c=r.end,f=e._input.contours;if(u>c){r.start=f.start=c;c=r.end=f.end=u;u=r.start}if(!(r.size>0)){var h;if(u===c)h=1;else h=i(u,c,e.ncontours).dtick;f.size=r.size=h}}};function i(t,e,r){var a={type:"linear",range:[t,e]};n.autoTicks(a,(e-t)/(r||15));return a}},{"../../lib":684,"../../plots/cartesian/axes":732}],916:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../components/drawing");var i=t("../heatmap/style");var o=t("./make_color_map");e.exports=function t(e){var r=n.select(e).selectAll("g.contour");r.style("opacity",function(t){return t.trace.opacity});r.each(function(t){var e=n.select(this);var r=t.trace;var i=r.contours;var s=r.line;var l=i.size||1;var u=i.start;var c=i.type==="constraint";var f=!c&&i.coloring==="lines";var h=!c&&i.coloring==="fill";var p=f||h?o(r):null;e.selectAll("g.contourlevel").each(function(t){n.select(this).selectAll("path").call(a.lineGroupStyle,s.width,f?p(t.level):s.color,s.dash)});var d=i.labelfont;e.selectAll("g.contourlabels text").each(function(t){a.font(n.select(this),{family:d.family,size:d.size,color:d.color||(f?p(t.level):s.color)})});if(c){e.selectAll("g.contourfill path").style("fill",r.fillcolor)}else if(h){var v;e.selectAll("g.contourfill path").style("fill",function(t){if(v===undefined)v=t.level;return p(t.level+.5*l)});if(v===undefined)v=u;e.selectAll("g.contourbg path").style("fill",p(v-.5*l))}});i(e)}},{"../../components/drawing":583,"../heatmap/style":938,"./make_color_map":912,d3:147}],917:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults");var a=t("./label_defaults");e.exports=function t(e,r,i,o,s){var l=i("contours.coloring");var u;var c="";if(l==="fill")u=i("contours.showlines");if(u!==false){if(l!=="lines")c=i("line.color","#000");i("line.width",.5);i("line.dash")}if(l!=="none"){n(e,r,o,i,{prefix:"",cLetter:"z"})}i("line.smoothing");a(i,o,c,s)}},{"../../components/colorscale/defaults":568,"./label_defaults":911}],918:[function(t,e,r){"use strict";var n=t("../heatmap/attributes");var a=t("../contour/attributes");var i=a.contours;var o=t("../scatter/attributes");var s=t("../../components/colorscale/attributes");var l=t("../../components/colorbar/attributes");var u=t("../../lib/extend").extendFlat;var c=o.line;e.exports=u({carpet:{valType:"string",editType:"calc"},z:n.z,a:n.x,a0:n.x0,da:n.dx,b:n.y,b0:n.y0,db:n.dy,text:n.text,transpose:n.transpose,atype:n.xtype,btype:n.ytype,fillcolor:a.fillcolor,autocontour:a.autocontour,ncontours:a.ncontours,contours:{type:i.type,start:i.start,end:i.end,size:i.size,coloring:{valType:"enumerated",values:["fill","lines","none"],dflt:"fill",editType:"calc"},showlines:i.showlines,showlabels:i.showlabels,labelfont:i.labelfont,labelformat:i.labelformat,operation:i.operation,value:i.value,editType:"calc",impliedEdits:{autocontour:false}},line:{color:u({},c.color,{}),width:c.width,dash:c.dash,smoothing:u({},c.smoothing,{}),editType:"plot"}},s("",{cLetter:"z",autoColorDflt:false}),{colorbar:l})},{"../../components/colorbar/attributes":559,"../../components/colorscale/attributes":565,"../../lib/extend":673,"../contour/attributes":896,"../heatmap/attributes":925,"../scatter/attributes":1015}],919:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");var a=t("../../lib").isArray1D;var i=t("../heatmap/convert_column_xyz");var o=t("../heatmap/clean_2d_array");var s=t("../heatmap/max_row_length");var l=t("../heatmap/interp2d");var u=t("../heatmap/find_empties");var c=t("../heatmap/make_bound_array");var f=t("./defaults");var h=t("../carpet/lookup_carpetid");var p=t("../contour/set_contours");e.exports=function t(e,r){var n=r._carpetTrace=h(e,r);if(!n||!n.visible||n.visible==="legendonly")return;if(!r.a||!r.b){var a=e.data[n.index];var i=e.data[r.index];if(!i.a)i.a=a.a;if(!i.b)i.b=a.b;f(i,r,r._defaultColor,e._fullLayout)}var o=d(e,r);p(r);return o};function d(t,e){var r=e._carpetTrace;var f=r.aaxis;var h=r.baxis;var p,d,v,g,m,y,x;f._minDtick=0;h._minDtick=0;if(a(e.z))i(e,f,h,"a","b",["z"]);p=e._a=e._a||e.a;g=e._b=e._b||e.b;p=p?f.makeCalcdata(e,"_a"):[];g=g?h.makeCalcdata(e,"_b"):[];d=e.a0||0;v=e.da||1;m=e.b0||0;y=e.db||1;x=e._z=o(e._z||e.z,e.transpose);e._emptypoints=u(x);l(x,e._emptypoints);var b=s(x),_=e.xtype==="scaled"?"":p,w=c(e,_,d,v,b,f),k=e.ytype==="scaled"?"":g,M=c(e,k,m,y,x.length,h);var A={a:w,b:M,z:x};if(e.contours.type==="levels"&&e.contours.coloring!=="none"){n(e,x,"","z")}return[A]}},{"../../components/colorscale/calc":566,"../../lib":684,"../carpet/lookup_carpetid":874,"../contour/set_contours":915,"../heatmap/clean_2d_array":927,"../heatmap/convert_column_xyz":929,"../heatmap/find_empties":931,"../heatmap/interp2d":934,"../heatmap/make_bound_array":935,"../heatmap/max_row_length":936,"./defaults":920}],920:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("../heatmap/xyz_defaults");var i=t("./attributes");var o=t("../contour/constraint_defaults");var s=t("../contour/contours_defaults");var l=t("../contour/style_defaults");e.exports=function t(e,r,u,c){function f(t,a){return n.coerce(e,r,i,t,a)}function h(t){return n.coerce2(e,r,i,t)}f("carpet");if(e.a&&e.b){var p=a(e,r,f,c,"a","b");if(!p){r.visible=false;return}f("text");var d=f("contours.type")==="constraint";if(!d)delete r.showlegend;if(d){o(e,r,f,c,u,{hasHover:false})}else{s(e,r,f,h);l(e,r,f,c,{hasHover:false})}}else{r._defaultColor=u;r._length=null}}},{"../../lib":684,"../contour/constraint_defaults":901,"../contour/contours_defaults":903,"../contour/style_defaults":917,"../heatmap/xyz_defaults":940,"./attributes":918}],921:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes");n.supplyDefaults=t("./defaults");n.colorbar=t("../contour/colorbar");n.calc=t("./calc");n.plot=t("./plot");n.style=t("../contour/style");n.moduleType="trace";n.name="contourcarpet";n.basePlotModule=t("../../plots/cartesian");n.categories=["cartesian","svg","carpet","contour","symbols","showLegend","hasLines","carpetDependent"];n.meta={};e.exports=n},{"../../plots/cartesian":743,"../contour/colorbar":899,"../contour/style":916,"./attributes":918,"./calc":919,"./defaults":920,"./plot":924}],922:[function(t,e,r){"use strict";var n=t("../../components/drawing");var a=t("../carpet/axis_aligned_line");var i=t("../../lib");e.exports=function t(e,r,o,s,l,u,c,f){var h;var p="";var d=r.edgepaths.map(function(t,e){return e});var v=true;var g,m,y,x,b,_;var w=Math.abs(o[0][0]-o[2][0])*1e-4;var k=Math.abs(o[0][1]-o[2][1])*1e-4;function M(t){return Math.abs(t[1]-o[0][1])=0){m=L;x=b}}else if(Math.abs(g[1]-m[1])=0){m=L;x=b}}else{i.log("endpt to newendpt is not vert. or horz.",g,m,L)}}if(x>=0)break;p+=E(g,m);g=m}if(x===r.edgepaths.length){i.log("unclosed perimeter path");break}h=x;v=d.indexOf(h)===-1;if(v){h=d[0];p+=E(g,m)+"Z";g=null}}for(h=0;h=0;V--){F=h.clipsegments[V];N=a([],F.x,k.c2p);j=a([],F.y,M.c2p);N.reverse();j.reverse();U.push(i(N,j,F.bicubic))}var q="M"+U.join("L")+"Z";A(B,h.clipsegments,k,M,C,I);T(s,B,k,M,R,P,z,l,h,I,q);b(B,E,t,r[0],_,e,l);o.setClipUrl(B,l._clipPathId)}function b(t,e,r,a,i,l,u){var c=s.ensureSingle(t,"g","contourlines");var p=i.showlines!==false;var d=i.showlabels;var v=p&&d;var g=f.createLines(c,p||d,e);var m=f.createLineClip(c,v,r._fullLayout._defs,a.trace.uid);var y=t.selectAll("g.contourlabels").data(d?[0]:[]);y.exit().remove();y.enter().append("g").classed("contourlabels",true);if(d){var x=l.xaxis;var b=l.yaxis;var w=x._length;var k=b._length;var M=[[[0,0],[w,0],[w,k],[0,k]]];var A=[];s.clearLocationCache();var T=f.labelFormatter(i,a.t.cb,r._fullLayout);var S=o.tester.append("text").attr("data-notex",1).call(o.font,i.labelfont);var E={left:0,right:w,center:w/2,top:0,bottom:k,middle:k/2};var C=Math.sqrt(w*w+k*k);var L=h.LABELDISTANCE*C/Math.max(1,e.length/h.LABELINCREASE);g.each(function(t){var e=f.calcTextOpts(t.level,T,S,r);n.select(this).selectAll("path").each(function(r){var n=this;var a=s.getVisibleSegment(n,E,e.height/2);if(!a)return;_(n,r,t,a,u,e.height);if(a.len<(e.width+e.height)*h.LABELMIN)return;var i=Math.min(Math.ceil(a.len/L),h.LABELMAX);for(var o=0;og)n.max=g;n.len=n.max-n.min}function w(t,e,r){var n=t.getPointAtLength(e);var a=t.getPointAtLength(r);var i=a.x-n.x;var o=a.y-n.y;var s=Math.sqrt(i*i+o*o);return[i/s,o/s]}function k(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]}function M(t,e){var r=Math.abs(t[0]*e[0]+t[1]*e[1]);var n=Math.sqrt(1-r*r);return n/r}function A(t,e,r,n,o,l){var u,c,f,h;var p=s.ensureSingle(t,"g","contourbg");var d=p.selectAll("path").data(l==="fill"&&!o?[0]:[]);d.enter().append("path");d.exit().remove();var v=[];for(h=0;hz){L("x scale is not linear");break}}}if(k.length&&x==="fast"){var P=(k[k.length-1]-k[0])/(k.length-1),O=Math.abs(P/100);for(S=0;SO){L("y scale is not linear");break}}}}}var D=u(T);var R=r.xtype==="scaled"?"":b;var B=p(r,R,_,w,D,d);var F=r.ytype==="scaled"?"":k;var N=p(r,F,M,A,T.length,v);if(!y){i.expand(d,B);i.expand(v,N)}var j={x:B,y:N,z:T,text:r._text||r.text};if(R&&R.length===B.length-1)j.xCenter=R;if(F&&F.length===N.length-1)j.yCenter=F;if(m){j.xRanges=E.xRanges;j.yRanges=E.yRanges;j.pts=E.pts}if(!g||r.contours.type!=="constraint"){s(r,T,"","z")}if(g&&r.contours&&r.contours.coloring==="heatmap"){var V={type:r.type==="contour"?"heatmap":"histogram2d",xcalendar:r.xcalendar,ycalendar:r.ycalendar};j.xfill=p(V,R,_,w,D,d);j.yfill=p(V,F,M,A,T.length,v)}return[j]}},{"../../components/colorscale/calc":566,"../../lib":684,"../../plots/cartesian/axes":732,"../../registry":817,"../histogram2d/calc":957,"./clean_2d_array":927,"./convert_column_xyz":929,"./find_empties":931,"./interp2d":934,"./make_bound_array":935,"./max_row_length":936}],927:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function t(e,r){var a,i,o,s,l,u;function c(t){if(!n(t))return undefined;return+t}if(r){a=0;for(l=0;l=0;d--){p=i[d];f=p[0];h=p[1];v=((a[[f-1,h]]||l)[2]+(a[[f+1,h]]||l)[2]+(a[[f,h-1]]||l)[2]+(a[[f,h+1]]||l)[2])/20;if(v){g[p]=[f,h,v];i.splice(d,1);m=true}}if(!m){throw"findEmpties iterated with no new neighbors"}for(p in g){a[p]=g[p];r.push(g[p])}}return r.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":936}],932:[function(t,e,r){"use strict";var n=t("../../components/fx");var a=t("../../lib");var i=t("../../plots/cartesian/axes");e.exports=function t(e,r,o,s,l,u){var c=e.cd[0];var f=c.trace;var h=e.xa;var p=e.ya;var d=c.x;var v=c.y;var g=c.z;var m=c.xCenter;var y=c.yCenter;var x=c.zmask;var b=[f.zmin,f.zmax];var _=f.zhoverformat;var w=d;var k=v;var M,A,T,S;if(e.index!==false){try{T=Math.round(e.index[1]);S=Math.round(e.index[0])}catch(t){a.error("Error hovering on heatmap, "+"pointNumber must be [row,col], found:",e.index);return}if(T<0||T>=g[0].length||S<0||S>g.length){return}}else if(n.inbox(r-d[0],r-d[d.length-1],0)>0||n.inbox(o-v[0],o-v[v.length-1],0)>0){return}else{if(u){var E;w=[2*d[0]-d[1]];for(E=1;Ea;l++){i=s(e,r,o(i))}if(i>a){n.log("interp2d didn't converge quickly",i)}return e};function s(t,e,r){var n=0,a,o,s,l,u,c,f,h,p,d,v,g,m;for(l=0;lg){n=Math.max(n,Math.abs(t[o][s]-v)/(m-g))}}}return n}},{"../../lib":684}],935:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("../../lib").isArrayOrTypedArray;e.exports=function t(e,r,i,o,s,l){var u=[],c=n.traceIs(e,"contour"),f=n.traceIs(e,"histogram"),h=n.traceIs(e,"gl2d"),p,d,v;var g=a(r)&&r.length>1;if(g&&!f&&l.type!=="category"){var m=r.length;if(m<=s){if(c||h)u=r.slice(0,s);else if(s===1){u=[r[0]-.5,r[0]+.5]}else{u=[1.5*r[0]-.5*r[1]];for(v=1;v image").each(function(t){var e=t.trace||{};if(!i[e.uid]){n.select(this.parentNode).remove()}});for(var o=0;o0){L=v.c2p(x[O]);O--}if(L0){P=g.c2p(b[O]);O--}if(P0)r=true;for(var l=0;li){var o=i-r[t];r[t]=i;return o}}return 0},max:function(t,e,r,a){var i=a[e];if(n(i)){i=Number(i);if(!n(r[t])){r[t]=i;return i}else if(r[t]g&&go){var x=m===a?1:6;var b=m===a?"M12":"M1";return function(t,r){var n=i.c2d(t,a,s);var o=n.indexOf("-",x);if(o>0)n=n.substr(0,o);var l=i.d2c(n,0,s);if(lu){if(t>o){if(t>a*1.1)return a;if(t>i*1.1)return i;return o}if(t>s)return s;if(t>l)return l;return u}return Math.pow(10,Math.floor(Math.log(t)/Math.LN10))}function p(t,e,r,n,i,s){if(n&&t>o){var l=d(e,i,s);var u=d(r,i,s);var c=t===a?0:1;return l[c]!==u[c]}return Math.floor(r/t)-Math.floor(e/t)>.1}function d(t,e,r){var n=e.c2d(t,a,r).split("-");if(n[0]===""){n.unshift();n[0]="-"+n[0]}return n}},{"../../constants/numerical":661,"../../plots/cartesian/axes":732}],949:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("../../lib");var i=t("../../plots/cartesian/axes");var o=t("../bar/arrays_to_calcdata");var s=t("./bin_functions");var l=t("./norm_functions");var u=t("./average");var c=t("./clean_bins");var f=t("../../constants/numerical").ONEAVGMONTH;var h=t("./bin_label_vals");e.exports=function t(e,r){if(r.visible!==true)return;var f=[];var d=[];var v=i.getFromId(e,r.orientation==="h"?r.yaxis||"y":r.xaxis||"x");var g=r.orientation==="h"?"y":"x";var m={x:"y",y:"x"}[g];var x=r[g+"calendar"];var b=r.cumulative;var _;c(r,v,g);var w=p(e,r,v,g);var k=w[0];var M=w[1];var A=typeof k.size==="string";var T=[];var S=A?T:k;var E=[];var C=[];var L=[];var I=0;var z=r.histnorm;var P=r.histfunc;var O=z.indexOf("density")!==-1;var D,R,B;if(b.enabled&&O){z=z.replace(/ ?density$/,"");O=false}var F=P==="max"||P==="min";var N=F?null:0;var j=s.count;var V=l[z];var U=false;var q=function(t){return v.r2c(t,0,x)};var H;if(a.isArrayOrTypedArray(r[m])&&P!=="count"){H=r[m];U=P==="avg";j=s[P]}_=q(k.start);R=q(k.end)+(_-i.tickIncrement(_,k.size,false,x))/1e6;while(_=0&&B=tt;_--){if(d[_]){et=_;break}}for(_=tt;_<=et;_++){if(n(f[_])&&n(d[_])){var rt={p:f[_],s:d[_],b:0};if(!b.enabled){rt.pts=L[_];if(W){rt.p0=rt.p1=L[_].length?M[L[_][0]]:f[_]}else{rt.p0=J(T[_]);rt.p1=J(T[_+1],true)}}Q.push(rt)}}if(Q.length===1){Q[0].width1=i.tickIncrement(Q[0].p,k.size,false,x)-Q[0].p}o(Q,r);if(a.isArrayOrTypedArray(r.selectedpoints)){a.tagSelected(Q,r,Z)}return Q};function p(t,e,r,a,o){var s=a+"bins";var l=t._fullLayout.barmode==="overlay";var u,c,f,h,p;if(e._autoBinFinished){delete e._autoBinFinished}else{var m=l?[e]:v(t,e);var y=[];var x=Infinity;var b=Infinity;var _=-Infinity;var w="autobin"+a;for(u=0;uh.size/1.9)x=h.size;else x=h.size/Math.ceil(h.size/x);var A=h.start+(h.size-x)/2;b=A-x*Math.ceil((A-b)/x)}for(u=0;u=0;n--){s(n)}}}else if(e==="increasing"){for(n=1;n=0;n--){t[n]+=t[n+1]}if(r==="exclude"){t.push(0);t.shift()}}}},{"../../constants/numerical":661,"../../lib":684,"../../plots/cartesian/axes":732,"../bar/arrays_to_calcdata":826,"./average":945,"./bin_functions":947,"./bin_label_vals":948,"./clean_bins":950,"./norm_functions":955,"fast-isnumeric":214}],950:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("../../lib").cleanDate;var i=t("../../constants/numerical");var o=i.ONEDAY;var s=i.BADNUM;e.exports=function t(e,r,i){var l=r.type,u=i+"bins",c=e[u];if(!c)c=e[u]={};var f=l==="date"?function(t){return t||t===0?a(t,s,c.calendar):null}:function(t){return n(t)?Number(t):null};c.start=f(c.start);c.end=f(c.end);var h=l==="date"?o:1,p=c.size;if(n(p)){c.size=p>0?Number(p):h}else if(typeof p!=="string"){c.size=h}else{var d=p.charAt(0),v=p.substr(1);v=n(v)?Number(v):0;if(v<=0||!(l==="date"&&d==="M"&&v===Math.round(v))){c.size=h}}var g="autobin"+i;if(typeof e[g]!=="boolean"){e[g]=e._fullInput[g]=e._input[g]=!((c.start||c.start===0)&&(c.end||c.end===0))}if(!e[g]){delete e["nbins"+i];delete e._fullInput["nbins"+i]}}},{"../../constants/numerical":661,"../../lib":684,"fast-isnumeric":214}],951:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("../../lib");var i=t("../../components/color");var o=t("./bin_defaults");var s=t("../bar/style_defaults");var l=t("./attributes");e.exports=function t(e,r,u,c){function f(t,n){return a.coerce(e,r,l,t,n)}var h=f("x");var p=f("y");var d=f("cumulative.enabled");if(d){f("cumulative.direction");f("cumulative.currentbin")}f("text");var v=f("orientation",p&&!h?"h":"v");var g=v==="v"?"x":"y";var m=v==="v"?"y":"x";var y=h&&p?Math.min(h.length&&p.length):(r[g]||[]).length;if(!y){r.visible=false;return}r._length=y;var x=n.getComponentMethod("calendars","handleTraceDefaults");x(e,r,["x","y"],c);var b=r[m];if(b)f("histfunc");o(e,r,f,[g]);s(e,r,f,u,c);var _=n.getComponentMethod("errorbars","supplyDefaults");_(e,r,i.defaultLine,{axis:"y"});_(e,r,i.defaultLine,{axis:"x",inherit:"y"});a.coerceSelectionMarkerOpacity(r,f)}},{"../../components/color":558,"../../lib":684,"../../registry":817,"../bar/style_defaults":839,"./attributes":944,"./bin_defaults":946}],952:[function(t,e,r){"use strict";e.exports=function t(e,r,n,a,i){e.x="xVal"in r?r.xVal:r.x;e.y="yVal"in r?r.yVal:r.y;if(r.xa)e.xaxis=r.xa;if(r.ya)e.yaxis=r.ya;if(!(n.cumulative||{}).enabled){var o=Array.isArray(i)?a[0].pts[i[0]][i[1]]:a[i].pts;e.pointNumbers=o;e.binNumber=e.pointNumber;delete e.pointNumber;delete e.pointIndex;var s;if(n._indexToPoints){s=[];for(var l=0;lT)u.splice(T,u.length-T);if(v.length>T)v.splice(T,v.length-T);c(r,"x",u,l,y,b,g);c(r,"y",v,d,x,_,m);var S=[];var E=[];var C=[];var L=typeof r.xbins.size==="string";var I=typeof r.ybins.size==="string";var z=[];var P=[];var O=L?z:r.xbins;var D=I?P:r.ybins;var R=0;var B=[];var F=[];var N=r.histnorm;var j=r.histfunc;var V=N.indexOf("density")!==-1;var U=j==="max"||j==="min";var q=U?null:0;var H=i.count;var G=o[N];var W=false;var Y=[];var X=[];var Z="z"in r?r.z:"marker"in r&&Array.isArray(r.marker.color)?r.marker.color:"";if(Z&&j!=="count"){W=j==="avg";H=i[j]}var $=r.xbins,J=y($.start),K=y($.end)+(J-a.tickIncrement(J,$.size,false,g))/1e6;for(w=J;w=0&&M=0&&A0){f=i(t.alphahull,c)}else{var p=["x","y","z"].indexOf(t.delaunayaxis);f=a(c.map(function(t){return[t[(p+1)%3],t[(p+2)%3]]}))}var d={positions:c,cells:f,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:l(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};if(t.intensity){this.color="#fff";d.vertexIntensity=t.intensity;d.vertexIntensityBounds=[t.cmin,t.cmax];d.colormap=s(t.colorscale)}else if(t.vertexcolor){this.color=t.vertexcolor[0];d.vertexColors=h(t.vertexcolor)}else if(t.facecolor){this.color=t.facecolor[0];d.cellColors=h(t.facecolor)}else{this.color=t.color;d.meshColor=l(t.color)}this.mesh.update(d)};f.dispose=function(){this.scene.glplot.remove(this.mesh);this.mesh.dispose()};function p(t,e){var r=t.glplot.gl;var a=n({gl:r});var i=new c(t,a,e.uid);a._trace=i;i.update(e);t.glplot.add(a);return i}e.exports=p},{"../../lib/gl_format_color":680,"../../lib/str2rgbarray":707,"../../plots/gl3d/zip3":785,"alpha-shape":55,"convex-hull":117,"delaunay-triangulate":149,"gl-mesh3d":268}],968:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("../../lib");var i=t("../../components/colorscale/defaults");var o=t("./attributes");e.exports=function t(e,r,s,l){function u(t,n){return a.coerce(e,r,o,t,n)}function c(t){var e=t.map(function(t){var e=u(t);if(e&&a.isArrayOrTypedArray(e))return e;return null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var f=c(["x","y","z"]);var h=c(["i","j","k"]);if(!f){r.visible=false;return}if(h){h.forEach(function(t){for(var e=0;ed}else p=_>y;d=_;var w=s(y,x,b,_);w.pos=m;w.yc=(y+_)/2;w.i=g;w.dir=p?"increasing":"decreasing";if(h)w.tx=e.text[g];v.push(w)}}i.expand(n,c.concat(u),{padded:true});if(v.length){v[0].t={labels:{open:a(t,"open:")+" ",high:a(t,"high:")+" ",low:a(t,"low:")+" ",close:a(t,"close:")+" "}}}return v}function c(t,e,r){var a=r._minDiff;if(!a){var i=t._fullData,o=[];a=Infinity;var s;for(s=0;s");e.y0=e.y1=h.c2p(L.yc,true);return[e]}},{"../../components/color":558,"../../components/fx":600,"../../plots/cartesian/axes":732,"../scatter/fill_hover_text":1022}],974:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc").calc,plot:t("./plot"),style:t("./style"),hoverPoints:t("./hover"),selectPoints:t("./select")}},{"../../plots/cartesian":743,"./attributes":970,"./calc":971,"./defaults":972,"./hover":973,"./plot":976,"./select":977,"./style":978}],975:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function t(e,r,a,i){var o=a("x");var s=a("open");var l=a("high");var u=a("low");var c=a("close");var f=n.getComponentMethod("calendars","handleTraceDefaults");f(e,r,["x"],i);if(!(s&&l&&u&&c))return;var h=Math.min(s.length,l.length,u.length,c.length);if(o)h=Math.min(h,o.length);r._length=h;return h}},{"../../registry":817}],976:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../lib");e.exports=function t(e,r,i,o){var s=r.xaxis;var l=r.yaxis;var u=o.selectAll("g.trace").data(i,function(t){return t[0].trace.uid});u.enter().append("g").attr("class","trace ohlc");u.exit().remove();u.order();u.each(function(t){var e=t[0];var i=e.t;var o=e.trace;var u=n.select(this);if(!r.isRangePlot)e.node3=u;if(o.visible!==true||i.empty){u.remove();return}var c=i.tickLen;var f=u.selectAll("path").data(a.identity);f.enter().append("path");f.exit().remove();f.attr("d",function(t){var e=s.c2p(t.pos,true);var r=s.c2p(t.pos-c,true);var n=s.c2p(t.pos+c,true);var a=l.c2p(t.o,true);var i=l.c2p(t.h,true);var o=l.c2p(t.l,true);var u=l.c2p(t.c,true);return"M"+r+","+a+"H"+e+"M"+e+","+i+"V"+o+"M"+n+","+u+"H"+e})})}},{"../../lib":684,d3:147}],977:[function(t,e,r){"use strict";e.exports=function t(e,r){var n=e.cd;var a=e.xaxis;var i=e.yaxis;var o=[];var s;var l=n[0].t.bPos||0;if(r===false){for(s=0;s=0;i--){var o=t[i];if(e>f(n,o))return u(n,a);if(e>o||i===t.length-1)return u(o,n);a=n;n=o}}function d(t,e){for(var r=0;r=e[r][0]&&t<=e[r][1])return true}return false}function v(t){t.attr("x",-n.bar.captureWidth/2).attr("width",n.bar.captureWidth)}function g(t){t.attr("visibility","visible").style("visibility","visible").attr("fill","yellow").attr("opacity",0)}function m(t){if(!t.brush.filterSpecified){return"0,"+t.height}var e=y(t.brush.filter.getConsolidated(),t.height);var r=[0];var n,a,i;var o=e.length?e[0][0]:null;for(var s=0;st[1]+r||e=.9*t[1]+.1*t[0])return"n";if(e<=.9*t[0]+.1*t[1])return"s";return"ns"}function b(){a.select(document.body).style("cursor",null)}function _(t){t.attr("stroke-dasharray",m)}function w(t,e){var r=a.select(t).selectAll(".highlight, .highlight-shadow");var i=e?r.transition().duration(n.bar.snapDuration).each("end",e):r;_(i)}function k(t,e){var r=t.brush;var n=r.filterSpecified;var a=NaN;var i={};var o;if(n){var s=t.height;var l=r.filter.getConsolidated();var u=y(l,s);var c=NaN;var f=NaN;var h=NaN;for(o=0;o<=u.length;o++){var p=u[o];if(p&&p[0]<=e&&e<=p[1]){c=o;break}else{f=o?o-1:NaN;if(p&&p[0]>e){h=o;break}}}a=c;if(isNaN(a)){if(isNaN(f)||isNaN(h)){a=isNaN(f)?h:f}else{a=e-u[f][1]=b[0]&&m<=b[1]){i.clickableOrdinalRange=b;break}}}return i}function M(t){t.on("mousemove",function(t){a.event.preventDefault();if(!t.parent.inBrushDrag){var e=t.height-a.mouse(this)[1]-2*n.verticalPadding;var r=k(t,e);var i="crosshair";if(r.clickableOrdinalRange)i="pointer";else if(r.region)i=r.region+"-resize";a.select(document.body).style("cursor",i)}}).on("mouseleave",function(t){if(!t.parent.inBrushDrag)b()}).call(a.behavior.drag().on("dragstart",function(t){a.event.sourceEvent.stopPropagation();var e=t.height-a.mouse(this)[1]-2*n.verticalPadding;var r=t.unitToPaddedPx.invert(e);var i=t.brush;var o=k(t,e);var s=o.interval;var l=i.svgBrush;l.wasDragged=false;l.grabbingBar=o.region==="ns";if(l.grabbingBar){var u=s.map(t.unitToPaddedPx);l.grabPoint=e-u[0]-n.verticalPadding;l.barLength=u[1]-u[0]}l.clickableOrdinalRange=o.clickableOrdinalRange;l.stayingIntervals=t.multiselect&&i.filterSpecified?i.filter.getConsolidated():[];if(s){l.stayingIntervals=l.stayingIntervals.filter(function(t){return t[0]!==s[0]&&t[1]!==s[1]})}l.startExtent=o.region?s[o.region==="s"?1:0]:r;t.parent.inBrushDrag=true;l.brushStartCallback()}).on("drag",function(t){a.event.sourceEvent.stopPropagation();var e=t.height-a.mouse(this)[1]-2*n.verticalPadding;var r=t.brush.svgBrush;r.wasDragged=true;if(r.grabbingBar){r.newExtent=[e-r.grabPoint,e+r.barLength-r.grabPoint].map(t.unitToPaddedPx.invert)}else{r.newExtent=[r.startExtent,t.unitToPaddedPx.invert(e)].sort(s)}var i=Math.max(0,-r.newExtent[0]);var o=Math.max(0,r.newExtent[1]-1);r.newExtent[0]+=i;r.newExtent[1]-=o;if(r.grabbingBar){r.newExtent[1]+=i;r.newExtent[0]-=o}t.brush.filterSpecified=true;r.extent=r.stayingIntervals.concat([r.newExtent]);r.brushCallback(t);w(this.parentNode)}).on("dragend",function(t){var e=a.event;e.sourceEvent.stopPropagation();var r=t.brush;var n=r.filter;var i=r.svgBrush;var o=i.grabbingBar;i.grabbingBar=false;i.grabLocation=undefined;t.parent.inBrushDrag=false;b();if(!i.wasDragged){i.wasDragged=undefined;if(i.clickableOrdinalRange){if(r.filterSpecified&&t.multiselect){i.extent.push(i.clickableOrdinalRange)}else{i.extent=[i.clickableOrdinalRange];r.filterSpecified=true}}else if(o){i.extent=i.stayingIntervals;if(i.extent.length===0){C(r)}}else{C(r)}i.brushCallback(t);w(this.parentNode);i.brushEndCallback(r.filterSpecified?n.getConsolidated():[]);return}var s=function(){n.set(n.getConsolidated())};if(t.ordinal){var l=t.unitTickvals;if(l[l.length-1]i.newExtent[0];i.extent=i.stayingIntervals.concat(u?[i.newExtent]:[]);if(!i.extent.length){C(r)}i.brushCallback(t);if(u){w(this.parentNode,s)}else{s();w(this.parentNode)}}else{s()}i.brushEndCallback(r.filterSpecified?n.getConsolidated():[])}))}function A(t,e){return t[0]-e[0]}function T(t){var e=t.selectAll(".background").data(o);e.enter().append("rect").classed("background",true).call(v).call(g).style("pointer-events","auto").attr("transform","translate(0 "+n.verticalPadding+")");e.call(M).attr("height",function(t){return t.height-n.verticalPadding});var r=t.selectAll(".highlight-shadow").data(o);r.enter().append("line").classed("highlight-shadow",true).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width+n.bar.strokeWidth).attr("stroke",n.bar.strokeColor).attr("opacity",n.bar.strokeOpacity).attr("stroke-linecap","butt");r.attr("y1",function(t){return t.height}).call(_);var a=t.selectAll(".highlight").data(o);a.enter().append("line").classed("highlight",true).attr("x",-n.bar.width/2).attr("stroke-width",n.bar.width-n.bar.strokeWidth).attr("stroke",n.bar.fillColor).attr("opacity",n.bar.fillOpacity).attr("stroke-linecap","butt");a.attr("y1",function(t){return t.height}).call(_)}function S(t){var e=t.selectAll("."+n.cn.axisBrush).data(o,i);e.enter().append("g").classed(n.cn.axisBrush,true);T(e)}function E(t){return t.svgBrush.extent.map(function(t){return t.slice()})}function C(t){t.filterSpecified=false;t.svgBrush.extent=[[0,1]]}function L(t){return function e(r){var n=r.brush;var a=E(n);var i=a.slice();n.filter.set(i);t()}}function I(t){var e=t.slice();var r=[];var n;var a=e.shift();while(a){n=a.slice();while((a=e.shift())&&a[0]<=n[1]){n[1]=Math.max(n[1],a[1])}r.push(n)}return r}function z(){var t=[];var e;var r;return{set:function(n){t=n.map(function(t){return t.slice().sort(s)}).sort(A);e=I(t);r=t.reduce(function(t,e){return[Math.min(t[0],e[0]),Math.max(t[1],e[1])]},[Infinity,-Infinity])},get:function(){return t.slice()},getConsolidated:function(){return e},getBounds:function(){return r}}}function P(t,e,r,n,a,i){var o=z();o.set(r);return{filter:o,filterSpecified:e,svgBrush:{extent:[],brushStartCallback:n,brushCallback:L(a),brushEndCallback:i}}}function O(t,e){if(Array.isArray(t[0])){t=t.map(function(t){return t.sort(s)});if(!e.multiselect)t=[t[0]];else t=I(t.sort(A))}else t=[t.sort(s)];if(e.tickvals){var r=e.tickvals.slice().sort(s);t=t.map(function(t){var e=[h(r,t[0],[]),p(r,t[1],[])];if(e[1]>e[0])return e}).filter(function(t){return t});if(!t.length)return}return t.length>1?t:t[0]}e.exports={makeBrush:P,ensureAxisBrush:S,cleanRanges:O}},{"../../lib":684,"../../lib/gup":681,"./constants":983,d3:147}],981:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../plots/get_data").getModuleCalcData;var i=t("./plot");var o=t("../../constants/xmlns_namespaces");var s="parcoords";r.name=s;r.plot=function(t){var e=a(t.calcdata,s)[0];if(e.length)i(t,e)};r.clean=function(t,e,r,n){var a=n._has&&n._has(s);var i=e._has&&e._has(s);if(a&&!i){n._paperdiv.selectAll(".parcoords").remove();n._glimages.selectAll("*").remove()}};r.toSVG=function(t){var e=t._fullLayout._glimages;var r=n.select(t).selectAll(".svg-container");var a=r.filter(function(t,e){return e===r.size()-1}).selectAll(".gl-canvas-context, .gl-canvas-focus");function i(){var t=this;var r=t.toDataURL("image/png");var n=e.append("svg:image");n.attr({xmlns:o.svg,"xlink:href":r,preserveAspectRatio:"none",x:0,y:0,width:t.width,height:t.height})}a.each(i);window.setTimeout(function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)}},{"../../constants/xmlns_namespaces":663,"../../plots/get_data":768,"./plot":989,d3:147}],982:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale");var a=t("../../components/colorscale/calc");var i=t("../../lib");var o=t("../../lib/gup").wrap;e.exports=function t(e,r){var l=!!r.line.colorscale&&i.isArrayOrTypedArray(r.line.color);var u=l?r.line.color:s(r._length);var c=l?r.line.colorscale:[[0,r.line.color],[1,r.line.color]];if(n(r,"line")){a(r,u,"line","c")}return o({lineColor:u,cscale:c})};function s(t){var e=new Array(t);for(var r=0;rc){n.log("parcoords traces support up to "+c+" dimensions at the moment");d.splice(c)}var v=s(e,r,{name:"dimensions",handleItemDefaults:p});var g=h(e,r,a,i,u);o(r,i,u);if(!Array.isArray(v)||!v.length){r.visible=false}f(r,v,"values",g);var m={family:i.font.family,size:Math.round(i.font.size/1.2),color:i.font.color};n.coerceFont(u,"labelfont",m);n.coerceFont(u,"tickfont",m);n.coerceFont(u,"rangefont",m)}},{"../../components/colorscale/defaults":568,"../../components/colorscale/has_colorscale":572,"../../lib":684,"../../plots/array_container_defaults":728,"../../plots/domain":757,"./attributes":979,"./axisbrush":980,"./constants":983,"./merge_length":987}],985:[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={container:"line",min:"cmin",max:"cmax"};n.moduleType="trace";n.name="parcoords";n.basePlotModule=t("./base_plot");n.categories=["gl","regl","noOpacity"];n.meta={};e.exports=n},{"./attributes":979,"./base_plot":981,"./calc":982,"./defaults":984,"./plot":989}],986:[function(t,e,r){"use strict";var n=t("glslify");var a=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 p0, p1, p2, p3,\n p4, p5, p6, p7,\n p8, p9, pa, pb,\n pc, pd, pe;\n\nattribute vec4 pf;\n\nuniform mat4 dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD;\n\nuniform vec2 resolution,\n viewBoxPosition,\n viewBoxSize;\n\nuniform sampler2D palette;\nuniform sampler2D mask;\nuniform float maskHeight;\n\nuniform vec2 colorClamp;\n\nvarying vec4 fragColor;\n\nvec4 unit_1 = vec4(1, 1, 1, 1);\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * unit_1, unit_1);\n}\n\nfloat axisY(\n float x,\n mat4 d[4],\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D\n ) {\n\n float y1 = val(d[0], dim1A) + val(d[1], dim1B) + val(d[2], dim1C) + val(d[3], dim1D);\n float y2 = val(d[0], dim2A) + val(d[1], dim2B) + val(d[2], dim2C) + val(d[3], dim2D);\n return y1 * (1.0 - x) + y2 * x;\n}\n\nconst int bitsPerByte = 8;\n\nint mod2(int a) {\n return a - 2 * (a / 2);\n}\n\nint mod8(int a) {\n return a - 8 * (a / 8);\n}\n\nvec4 zero = vec4(0, 0, 0, 0);\nvec4 unit_0 = vec4(1, 1, 1, 1);\nvec2 xyProjection = vec2(1, 1);\n\nmat4 mclamp(mat4 m, mat4 lo, mat4 hi) {\n return mat4(clamp(m[0], lo[0], hi[0]),\n clamp(m[1], lo[1], hi[1]),\n clamp(m[2], lo[2], hi[2]),\n clamp(m[3], lo[3], hi[3]));\n}\n\nbool mshow(mat4 p, mat4 lo, mat4 hi) {\n return mclamp(p, lo, hi) == p;\n}\n\nbool withinBoundingBox(\n mat4 d[4],\n mat4 loA, mat4 hiA, mat4 loB, mat4 hiB, mat4 loC, mat4 hiC, mat4 loD, mat4 hiD\n ) {\n\n return mshow(d[0], loA, hiA) &&\n mshow(d[1], loB, hiB) &&\n mshow(d[2], loC, hiC) &&\n mshow(d[3], loD, hiD);\n}\n\nbool withinRasterMask(mat4 d[4], sampler2D mask, float height) {\n bool result = true;\n int bitInByteStepper;\n float valY, valueY, scaleX;\n int hit, bitmask, valX;\n for(int i = 0; i < 4; i++) {\n for(int j = 0; j < 4; j++) {\n for(int k = 0; k < 4; k++) {\n bitInByteStepper = mod8(j * 4 + k);\n valX = i * 2 + j / 2;\n valY = d[i][j][k];\n valueY = valY * (height - 1.0) + 0.5;\n scaleX = (float(valX) + 0.5) / 8.0;\n hit = int(texture2D(mask, vec2(scaleX, (valueY + 0.5) / height))[3] * 255.0) / int(pow(2.0, float(bitInByteStepper)));\n result = result && mod2(hit) == 1;\n }\n }\n }\n return result;\n}\n\nvec4 position(\n float depth,\n vec2 resolution, vec2 viewBoxPosition, vec2 viewBoxSize,\n mat4 dims[4],\n float signum,\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D,\n mat4 loA, mat4 hiA, mat4 loB, mat4 hiB, mat4 loC, mat4 hiC, mat4 loD, mat4 hiD,\n sampler2D mask, float maskHeight\n ) {\n\n float x = 0.5 * signum + 0.5;\n float y = axisY(x, dims, dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D);\n\n float show = float(\n withinBoundingBox(dims, loA, hiA, loB, hiB, loC, hiC, loD, hiD)\n && withinRasterMask(dims, mask, maskHeight)\n );\n\n vec2 viewBoxXY = viewBoxPosition + viewBoxSize * vec2(x, y);\n float depthOrHide = depth + 2.0 * (1.0 - show);\n\n return vec4(\n xyProjection * (2.0 * viewBoxXY / resolution - 1.0),\n depthOrHide,\n 1.0\n );\n}\n\nvoid main() {\n\n float prominence = abs(pf[3]);\n\n mat4 p[4];\n p[0] = mat4(p0, p1, p2, p3);\n p[1] = mat4(p4, p5, p6, p7);\n p[2] = mat4(p8, p9, pa, pb);\n p[3] = mat4(pc, pd, pe, abs(pf));\n\n gl_Position = position(\n 1.0 - prominence,\n resolution, viewBoxPosition, viewBoxSize,\n p,\n sign(pf[3]),\n dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD,\n mask, maskHeight\n );\n\n float clampedColorIndex = clamp((prominence - colorClamp[0]) / (colorClamp[1] - colorClamp[0]), 0.0, 1.0);\n fragColor = texture2D(palette, vec2((clampedColorIndex * 255.0 + 0.5) / 256.0, 0.5));\n}\n"]);var i=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 p0, p1, p2, p3,\n p4, p5, p6, p7,\n p8, p9, pa, pb,\n pc, pd, pe;\n\nattribute vec4 pf;\n\nuniform mat4 dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D;\n\nuniform vec2 resolution,\n viewBoxPosition,\n viewBoxSize;\n\nuniform sampler2D palette;\n\nuniform vec2 colorClamp;\n\nvarying vec4 fragColor;\n\nvec2 xyProjection = vec2(1, 1);\n\nvec4 unit = vec4(1, 1, 1, 1);\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * unit, unit);\n}\n\nfloat axisY(\n float x,\n mat4 d[4],\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D\n ) {\n\n float y1 = val(d[0], dim1A) + val(d[1], dim1B) + val(d[2], dim1C) + val(d[3], dim1D);\n float y2 = val(d[0], dim2A) + val(d[1], dim2B) + val(d[2], dim2C) + val(d[3], dim2D);\n return y1 * (1.0 - x) + y2 * x;\n}\n\nvec4 position(\n float depth,\n vec2 resolution, vec2 viewBoxPosition, vec2 viewBoxSize,\n mat4 dims[4],\n float signum,\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D\n ) {\n\n float x = 0.5 * signum + 0.5;\n float y = axisY(x, dims, dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D);\n\n vec2 viewBoxXY = viewBoxPosition + viewBoxSize * vec2(x, y);\n\n return vec4(\n xyProjection * (2.0 * viewBoxXY / resolution - 1.0),\n depth,\n 1.0\n );\n}\n\nvoid main() {\n\n float prominence = abs(pf[3]);\n\n mat4 p[4];\n p[0] = mat4(p0, p1, p2, p3);\n p[1] = mat4(p4, p5, p6, p7);\n p[2] = mat4(p8, p9, pa, pb);\n p[3] = mat4(pc, pd, pe, abs(pf));\n\n gl_Position = position(\n 1.0 - prominence,\n resolution, viewBoxPosition, viewBoxSize,\n p,\n sign(pf[3]),\n dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D\n );\n\n float clampedColorIndex = clamp((prominence - colorClamp[0]) / (colorClamp[1] - colorClamp[0]), 0.0, 1.0);\n fragColor = texture2D(palette, vec2((clampedColorIndex * 255.0 + 0.5) / 256.0, 0.5));\n}\n"]);var o=n(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 p0, p1, p2, p3,\n p4, p5, p6, p7,\n p8, p9, pa, pb,\n pc, pd, pe;\n\nattribute vec4 pf;\n\nuniform mat4 dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD;\n\nuniform vec2 resolution,\n viewBoxPosition,\n viewBoxSize;\n\nuniform sampler2D mask;\nuniform float maskHeight;\n\nuniform vec2 colorClamp;\n\nvarying vec4 fragColor;\n\nvec4 unit_1 = vec4(1, 1, 1, 1);\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * unit_1, unit_1);\n}\n\nfloat axisY(\n float x,\n mat4 d[4],\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D\n ) {\n\n float y1 = val(d[0], dim1A) + val(d[1], dim1B) + val(d[2], dim1C) + val(d[3], dim1D);\n float y2 = val(d[0], dim2A) + val(d[1], dim2B) + val(d[2], dim2C) + val(d[3], dim2D);\n return y1 * (1.0 - x) + y2 * x;\n}\n\nconst int bitsPerByte = 8;\n\nint mod2(int a) {\n return a - 2 * (a / 2);\n}\n\nint mod8(int a) {\n return a - 8 * (a / 8);\n}\n\nvec4 zero = vec4(0, 0, 0, 0);\nvec4 unit_0 = vec4(1, 1, 1, 1);\nvec2 xyProjection = vec2(1, 1);\n\nmat4 mclamp(mat4 m, mat4 lo, mat4 hi) {\n return mat4(clamp(m[0], lo[0], hi[0]),\n clamp(m[1], lo[1], hi[1]),\n clamp(m[2], lo[2], hi[2]),\n clamp(m[3], lo[3], hi[3]));\n}\n\nbool mshow(mat4 p, mat4 lo, mat4 hi) {\n return mclamp(p, lo, hi) == p;\n}\n\nbool withinBoundingBox(\n mat4 d[4],\n mat4 loA, mat4 hiA, mat4 loB, mat4 hiB, mat4 loC, mat4 hiC, mat4 loD, mat4 hiD\n ) {\n\n return mshow(d[0], loA, hiA) &&\n mshow(d[1], loB, hiB) &&\n mshow(d[2], loC, hiC) &&\n mshow(d[3], loD, hiD);\n}\n\nbool withinRasterMask(mat4 d[4], sampler2D mask, float height) {\n bool result = true;\n int bitInByteStepper;\n float valY, valueY, scaleX;\n int hit, bitmask, valX;\n for(int i = 0; i < 4; i++) {\n for(int j = 0; j < 4; j++) {\n for(int k = 0; k < 4; k++) {\n bitInByteStepper = mod8(j * 4 + k);\n valX = i * 2 + j / 2;\n valY = d[i][j][k];\n valueY = valY * (height - 1.0) + 0.5;\n scaleX = (float(valX) + 0.5) / 8.0;\n hit = int(texture2D(mask, vec2(scaleX, (valueY + 0.5) / height))[3] * 255.0) / int(pow(2.0, float(bitInByteStepper)));\n result = result && mod2(hit) == 1;\n }\n }\n }\n return result;\n}\n\nvec4 position(\n float depth,\n vec2 resolution, vec2 viewBoxPosition, vec2 viewBoxSize,\n mat4 dims[4],\n float signum,\n mat4 dim1A, mat4 dim2A, mat4 dim1B, mat4 dim2B, mat4 dim1C, mat4 dim2C, mat4 dim1D, mat4 dim2D,\n mat4 loA, mat4 hiA, mat4 loB, mat4 hiB, mat4 loC, mat4 hiC, mat4 loD, mat4 hiD,\n sampler2D mask, float maskHeight\n ) {\n\n float x = 0.5 * signum + 0.5;\n float y = axisY(x, dims, dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D);\n\n float show = float(\n withinBoundingBox(dims, loA, hiA, loB, hiB, loC, hiC, loD, hiD)\n && withinRasterMask(dims, mask, maskHeight)\n );\n\n vec2 viewBoxXY = viewBoxPosition + viewBoxSize * vec2(x, y);\n float depthOrHide = depth + 2.0 * (1.0 - show);\n\n return vec4(\n xyProjection * (2.0 * viewBoxXY / resolution - 1.0),\n depthOrHide,\n 1.0\n );\n}\n\nvoid main() {\n\n float prominence = abs(pf[3]);\n\n mat4 p[4];\n p[0] = mat4(p0, p1, p2, p3);\n p[1] = mat4(p4, p5, p6, p7);\n p[2] = mat4(p8, p9, pa, pb);\n p[3] = mat4(pc, pd, pe, abs(pf));\n\n gl_Position = position(\n 1.0 - prominence,\n resolution, viewBoxPosition, viewBoxSize,\n p,\n sign(pf[3]),\n dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD,\n mask, maskHeight\n );\n\n fragColor = vec4(pf.rgb, 1.0);\n}\n"]);var s=n(["precision lowp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}\n"]);var l=t("../../lib");var u=1e-6;var c=1e-7;var f=2048;var h=64;var p=2;var d=4;var v=8;var g=h/v;var m=[119,119,119];var y=new Uint8Array(4);var x=new Uint8Array(4);var b={shape:[256,1],format:"rgba",type:"uint8",mag:"nearest",min:"nearest"};function _(t){t.read({x:0,y:0,width:1,height:1,data:y})}function w(t,e,r,n,a){var i=t._gl;i.enable(i.SCISSOR_TEST);i.scissor(e,r,n,a);t.clear({color:[0,0,0,0],depth:1})}function k(t,e,r,n,a,i){var o=i.key;function s(l){var u;u=Math.min(n,a-l*n);i.offset=p*l*n;i.count=p*u;if(l===0){window.cancelAnimationFrame(r.currentRafs[o]);delete r.currentRafs[o];w(t,i.scissorX,i.scissorY,i.scissorWidth,i.viewBoxSize[1])}if(r.clearOnly){return}e(i);if(l*n+u>>8*e)%256/255}function S(t,e,r){var n=e.length;var a=[];for(var i=0;i=h-4?T(i,h-2-o):.5)}}return a}function E(t,e,r){var n,a,i;var o=[];for(a=0;ac){c=t[i].dim2.canvasX;s=i}if(t[i].dim1.canvasXn._length){S=S.slice(0,n._length)}var E=n.tickvals;var C;function L(t,e){return{val:t,text:C[e]}}function I(t,e){return t.val-e.val}if(Array.isArray(E)&&E.length){C=n.ticktext;if(!Array.isArray(C)||!C.length){C=E.map(o.format(n.tickformat))}else if(C.length>E.length){C=C.slice(0,E.length)}else if(E.length>C.length){E=E.slice(0,C.length)}for(var z=1;z=r||s>=n){return}var l=t.lineLayer.readPixel(i,n-1-s);var u=l[3]!==0;var c=u?l[2]+256*(l[1]+256*l[0]):null;var f={x:i,y:s,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:c};if(c!==y){if(u){d.hover(f)}else if(d.unhover){d.unhover(f)}y=c}}});m.style("opacity",function(t){return t.pick?.01:1});e.style("background","rgba(255, 255, 255, 0)");var b=e.selectAll("."+a.cn.parcoords).data(g,u);b.exit().remove();b.enter().append("g").classed(a.cn.parcoords,true).style("shape-rendering","crispEdges").style("pointer-events","none");b.attr("transform",function(t){return"translate("+t.model.translateX+","+t.model.translateY+")"});var T=b.selectAll("."+a.cn.parcoordsControlView).data(c,u);T.enter().append("g").classed(a.cn.parcoordsControlView,true);T.attr("transform",function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"});var S=T.selectAll("."+a.cn.yAxis).data(function(t){return t.dimensions},u);function E(t,e){var r=e.panels||(e.panels=[]);var n=t.data();var a=n.length-1;for(var i=0;iline").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px");L.selectAll("text").style("text-shadow","1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff").style("cursor","default").style("user-select","none");var I=C.selectAll("."+a.cn.axisHeading).data(c,u);I.enter().append("g").classed(a.cn.axisHeading,true);var z=I.selectAll("."+a.cn.axisTitle).data(c,u);z.enter().append("text").classed(a.cn.axisTitle,true).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto");z.attr("transform","translate(0,"+-a.axisTitleOffset+")").text(function(t){return t.label}).each(function(t){s.font(o.select(this),t.model.labelFont)});var P=C.selectAll("."+a.cn.axisExtent).data(c,u);P.enter().append("g").classed(a.cn.axisExtent,true);var O=P.selectAll("."+a.cn.axisExtentTop).data(c,u);O.enter().append("g").classed(a.cn.axisExtentTop,true);O.attr("transform","translate("+0+","+-a.axisExtentOffset+")");var D=O.selectAll("."+a.cn.axisExtentTopText).data(c,u);function R(t,e){if(t.ordinal)return"";var r=t.domainScale.domain();return o.format(t.tickFormat)(r[e?r.length-1:0])}D.enter().append("text").classed(a.cn.axisExtentTopText,true).call(M);D.text(function(t){return R(t,true)}).each(function(t){s.font(o.select(this),t.model.rangeFont)});var B=P.selectAll("."+a.cn.axisExtentBottom).data(c,u);B.enter().append("g").classed(a.cn.axisExtentBottom,true);B.attr("transform",function(t){return"translate("+0+","+(t.model.height+a.axisExtentOffset)+")"});var F=B.selectAll("."+a.cn.axisExtentBottomText).data(c,u);F.enter().append("text").classed(a.cn.axisExtentBottomText,true).attr("dy","0.75em").call(M);F.text(function(t){return R(t)}).each(function(t){s.font(o.select(this),t.model.rangeFont)});h.ensureAxisBrush(C)}},{"../../components/drawing":583,"../../lib":684,"../../lib/gup":681,"./axisbrush":980,"./constants":983,"./lines":986,d3:147}],989:[function(t,e,r){"use strict";var n=t("./parcoords");var a=t("../../lib/prepare_regl");e.exports=function t(e,r){var i=e._fullLayout;var o=i._toppaper;var s=i._paperdiv;var l=i._glcontainer;var u=a(e);if(!u)return;var c={};var f={};var h=i._size;r.forEach(function(t,r){c[r]=e.data[r].dimensions;f[r]=e.data[r].dimensions.slice()});var p=function(t,r,n){var a=f[t][r];var i=n.map(function(t){return t.slice()});if(!i.length){delete a.constraintrange;i=null}else{if(i.length===1)i=i[0];a.constraintrange=i;i=[i]}var o={};var s="dimensions["+r+"].constraintrange";o[s]=i;e.emit("plotly_restyle",[o,[t]])};var d=function(t){e.emit("plotly_hover",t)};var v=function(t){e.emit("plotly_unhover",t)};var g=function(t,r){function n(t){return!("visible"in t)||t.visible}function a(t,e,r){var n=e.indexOf(r);var a=t.indexOf(n);if(a===-1){a+=e.length}return a}function i(t){return function e(n,i){var o=a(r,t,n);var s=a(r,t,i);return o-s}}var o=i(f[t].filter(n));c[t].sort(o);f[t].filter(function(t){return!n(t)}).sort(function(e){return f[t].indexOf(e)}).forEach(function(e){c[t].splice(c[t].indexOf(e),1);c[t].splice(f[t].indexOf(e),0,e)});e.emit("plotly_restyle")};n(s,o,l,r,{width:h.w,height:h.h,margin:{t:h.t,r:h.r,b:h.b,l:h.l}},{filterChanged:p,hover:d,unhover:v,axesMoved:g})}},{"../../lib/prepare_regl":697,"./parcoords":988}],990:[function(t,e,r){"use strict";var n=t("../../components/color/attributes");var a=t("../../plots/font_attributes");var i=t("../../plots/attributes");var o=t("../../plots/domain").attributes;var s=t("../../lib/extend").extendFlat;var l=a({editType:"calc",colorEditType:"style"});e.exports={labels:{valType:"data_array",editType:"calc"},label0:{valType:"number",dflt:0,editType:"calc"},dlabel:{valType:"number",dflt:1,editType:"calc"},values:{valType:"data_array",editType:"calc"},marker:{colors:{valType:"data_array",editType:"calc"},line:{color:{valType:"color",dflt:n.defaultLine,arrayOk:true,editType:"style"},width:{valType:"number",min:0,dflt:0,arrayOk:true,editType:"style"},editType:"calc"},editType:"calc"},text:{valType:"data_array",editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:true,editType:"style"},scalegroup:{valType:"string",dflt:"",editType:"calc"},textinfo:{valType:"flaglist",flags:["label","text","value","percent"],extras:["none"],editType:"calc"},hoverinfo:s({},i.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:true,editType:"calc"},textfont:s({},l,{}),insidetextfont:s({},l,{}),outsidetextfont:s({},l,{}),domain:o({name:"pie",trace:true,editType:"calc"}),hole:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},sort:{valType:"boolean",dflt:true,editType:"calc"},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise",editType:"calc"},rotation:{valType:"number",min:-360,max:360,dflt:0,editType:"calc"},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:true,editType:"calc"}}},{"../../components/color/attributes":557,"../../lib/extend":673,"../../plots/attributes":729,"../../plots/domain":757,"../../plots/font_attributes":758}],991:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("../../plots/get_data").getModuleCalcData;r.name="pie";r.plot=function(t){var e=n.getModule("pie");var r=a(t.calcdata,e)[0];if(r.length)e.plot(t,r)};r.clean=function(t,e,r,n){var a=n._has&&n._has("pie");var i=e._has&&e._has("pie");if(a&&!i){n._pielayer.selectAll("g.trace").remove()}}},{"../../plots/get_data":768,"../../registry":817}],992:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("../../lib").isArrayOrTypedArray;var i=t("tinycolor2");var o=t("../../components/color");var s=t("./helpers");e.exports=function t(e,r){var l=r.values;var f=a(l)&&l.length;var h=r.labels;var p=r.marker.colors||[];var d=[];var v=e._fullLayout;var g=v.colorway;var m=v._piecolormap;var y={};var x=0;var b=v.hiddenlabels||[];var _,w,k,M,A;if(!v._piecolorway&&g!==o.defaults){v._piecolorway=c(g)}if(r.dlabel){h=new Array(l.length);for(_=0;_")}}return d};var l;function u(t,e){if(!l){var r=o.defaults;l=c(r)}var n=e||l;return n[t%n.length]}function c(t){var e;var r=t.slice();for(e=0;e"),name:l.indexOf("name")!==-1?s.name:undefined,idealAlign:t.pxmid[0]<0?"left":"right",color:u.castOption(k.bgcolor,t.pts)||t.color,borderColor:u.castOption(k.bordercolor,t.pts),fontFamily:u.castOption(M.family,t.pts),fontSize:u.castOption(M.size,t.pts),fontColor:u.castOption(M.color,t.pts)},{container:o._hoverlayer.node(),outerContainer:o._paper.node(),gd:e});_=true}e.emit("plotly_hover",{points:[c(t,s)],event:n.event});w=true}function M(r){var i=e._fullLayout;var o=e._fullData[y.index];if(w){r.originalEvent=n.event;e.emit("plotly_unhover",{points:[c(t,o)],event:n.event});w=false}if(_){a.loneUnhover(i._hoverlayer.node());_=false}}function A(){var r=e._fullLayout;var i=e._fullData[y.index];if(e._dragging||r.hovermode===false)return;e._hoverdata=[c(t,i)];a.click(e,n.event)}b.enter().append("path").classed("surface",true).style({"pointer-events":"all"});d.select("path.textline").remove();d.on("mouseover",k).on("mouseout",M).on("click",A);if(y.pull){var T=+u.castOption(y.pull,t.pts)||0;if(T>0){r+=T*t.pxmid[0];i+=T*t.pxmid[1]}}t.cxFinal=r;t.cyFinal=i;function S(e,r,n,a){return"a"+a*v.r+","+a*v.r+" 0 "+t.largeArc+(n?" 1 ":" 0 ")+a*(r[0]-e[0])+","+a*(r[1]-e[1])}var E=y.hole;if(t.v===v.vTotal){var C="M"+(r+t.px0[0])+","+(i+t.px0[1])+S(t.px0,t.pxmid,true,1)+S(t.pxmid,t.px0,true,1)+"Z";if(E){b.attr("d","M"+(r+E*t.px0[0])+","+(i+E*t.px0[1])+S(t.px0,t.pxmid,false,E)+S(t.pxmid,t.px0,false,E)+"Z"+C)}else b.attr("d",C)}else{var L=S(t.px0,t.px1,true,1);if(E){var I=1-E;b.attr("d","M"+(r+E*t.px1[0])+","+(i+E*t.px1[1])+S(t.px1,t.px0,false,E)+"l"+I*t.px0[0]+","+I*t.px0[1]+L+"Z")}else{b.attr("d","M"+r+","+i+"l"+t.px0[0]+","+t.px0[1]+L+"Z")}}var z=u.castOption(y.textposition,t.pts);var P=d.selectAll("g.slicetext").data(t.text&&z!=="none"?[0]:[]);P.enter().append("g").classed("slicetext",true);P.exit().remove();P.each(function(){var a=s.ensureSingle(n.select(this),"text","",function(t){t.attr("data-notex",1)});a.text(t.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(o.font,z==="outside"?y.outsidetextfont:y.insidetextfont).call(l.convertToTspans,e);var u=o.bBox(a.node());var c;if(z==="outside"){c=p(u,t)}else{c=f(u,t,v);if(z==="auto"&&c.scale<1){a.call(o.font,y.outsidetextfont);if(y.outsidetextfont.family!==y.insidetextfont.family||y.outsidetextfont.size!==y.insidetextfont.size){u=o.bBox(a.node())}c=p(u,t)}}var h=r+t.pxmid[0]*c.rCenter+(c.x||0);var d=i+t.pxmid[1]*c.rCenter+(c.y||0);if(c.outside){t.yLabelMin=d-u.height/2;t.yLabelMid=d;t.yLabelMax=d+u.height/2;t.labelExtraX=0;t.labelExtraY=0;x=true}a.attr("transform","translate("+h+","+d+")"+(c.scale<1?"scale("+c.scale+")":"")+(c.rotate?"rotate("+c.rotate+")":"")+"translate("+-(u.left+u.right)/2+","+-(u.top+u.bottom)/2+")")})});if(x)d(g,y);r.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=n.select(this);var r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var a=t.cxFinal+t.pxmid[0];var o=t.cyFinal+t.pxmid[1];var s="M"+a+","+o;var l=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var u=t.labelExtraX*t.pxmid[1]/t.pxmid[0];var c=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);if(Math.abs(u)>Math.abs(c)){s+="l"+c*t.pxmid[0]/t.pxmid[1]+","+c+"H"+(a+t.labelExtraX+l)}else{s+="l"+t.labelExtraX+","+u+"v"+(c-u)+"h"+l}}else{s+="V"+(t.yLabelMid+t.labelExtraY)+"h"+l}e.append("path").classed("textline",true).call(i.stroke,y.outsidetextfont.color).attr({"stroke-width":Math.min(2,y.outsidetextfont.size/8),d:s,fill:"none"})}})})});setTimeout(function(){y.selectAll("tspan").each(function(){var t=n.select(this);if(t.attr("dy"))t.attr("dy",t.attr("dy"))})},0)};function f(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height);var a=t.width/t.height;var i=Math.PI*Math.min(e.v/r.vTotal,.5);var o=1-r.trace.hole;var s=h(e,r),l={scale:s*r.r*2/n,rCenter:1-s,rotate:0};if(l.scale>=1)return l;var u=a+1/(2*Math.tan(i));var c=r.r*Math.min(1/(Math.sqrt(u*u+.5)+u),o/(Math.sqrt(a*a+o/2)+a));var f={scale:c*2/t.height,rCenter:Math.cos(c/r.r)-c*a/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90};var p=1/a;var d=p+1/(2*Math.tan(i));var v=r.r*Math.min(1/(Math.sqrt(d*d+.5)+d),o/(Math.sqrt(p*p+o/2)+p));var g={scale:v*2/t.width,rCenter:Math.cos(v/r.r)-v/a/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90};var m=g.scale>f.scale?g:f;if(l.scale<1&&m.scale>l.scale)return m;return l}function h(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 p(t,e){var r=e.pxmid[0];var n=e.pxmid[1];var a=t.width/2;var i=t.height/2;if(r<0)a*=-1;if(n<0)i*=-1;return{scale:1,rCenter:1,rotate:0,x:a+Math.abs(i)*(a>0?1:-1)/2,y:i/(1+r*r/(n*n)),outside:true}}function d(t,e){var r,n,a,i,o,s,l,c,f,h,p,d,v;function g(t,e){return t.pxmid[1]-e.pxmid[1]}function m(t,e){return e.pxmid[1]-t.pxmid[1]}function y(t,r){if(!r)r={};var a=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin);var c=n?t.yLabelMin:t.yLabelMax;var f=n?t.yLabelMax:t.yLabelMin;var p=t.cyFinal+o(t.px0[1],t.px1[1]);var d=a-c;var v,g,m,y,x,b;if(d*l>0)t.labelExtraY=d;if(!Array.isArray(e.pull))return;for(g=0;g=(u.castOption(e.pull,m.pts)||0)){continue}if((t.pxmid[1]-m.pxmid[1])*l>0){y=m.cyFinal+o(m.px0[1],m.px1[1]);d=y-c-t.labelExtraY;if(d*l>0)t.labelExtraY+=d}else if((f+t.labelExtraY-p)*l>0){v=3*s*Math.abs(g-h.indexOf(t));x=m.cxFinal+i(m.px0[0],m.px1[0]);b=x+v-(t.cxFinal+t.pxmid[0])-t.labelExtraX;if(b*s>0)t.labelExtraX+=b}}}for(n=0;n<2;n++){a=n?g:m;o=n?Math.max:Math.min;l=n?1:-1;for(r=0;r<2;r++){i=r?Math.max:Math.min;s=r?1:-1;c=t[n][r];c.sort(a);f=t[1-n][r];h=f.concat(c);d=[];for(p=0;pu)u=l.pull[o]}}s.r=Math.min(n,a)/(2+2*u);s.cx=e.l+e.w*(l.domain.x[1]+l.domain.x[0])/2;s.cy=e.t+e.h*(2-l.domain.y[1]-l.domain.y[0])/2;if(l.scalegroup&&r.indexOf(l.scalegroup)===-1){r.push(l.scalegroup)}}for(o=0;oe.vTotal/2?1:0}}},{"../../components/color":558,"../../components/drawing":583,"../../components/fx":600,"../../lib":684,"../../lib/svg_text_utils":708,"./event_data":994,"./helpers":995,d3:147}],1000:[function(t,e,r){"use strict";var n=t("d3");var a=t("./style_one");e.exports=function t(e){e._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0];var r=e.trace;var i=n.select(this);i.style({opacity:r.opacity});i.selectAll("path.surface").each(function(t){n.select(this).call(a,t,r)})})}},{"./style_one":1001,d3:147}],1001:[function(t,e,r){"use strict";var n=t("../../components/color");var a=t("./helpers").castOption;e.exports=function t(e,r,i){var o=i.marker.line;var s=a(o.color,r.pts)||n.defaultLine;var l=a(o.width,r.pts)||0;e.style({"stroke-width":l}).call(n.fill,r.color).call(n.stroke,s)}},{"../../components/color":558,"./helpers":995}],1002:[function(t,e,r){"use strict";var n=t("../scatter/attributes");e.exports={x:n.x,y:n.y,xy:{valType:"data_array",editType:"calc"},indices:{valType:"data_array",editType:"calc"},xbounds:{valType:"data_array",editType:"calc"},ybounds:{valType:"data_array",editType:"calc"},text:n.text,marker:{color:{valType:"color",arrayOk:false,editType:"calc"},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:false,editType:"calc"},blend:{valType:"boolean",dflt:null,editType:"calc"},sizemin:{valType:"number",min:.1,max:2,dflt:.5,editType:"calc"},sizemax:{valType:"number",min:.1,dflt:20,editType:"calc"},border:{color:{valType:"color",arrayOk:false,editType:"calc"},arearatio:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},editType:"calc"},editType:"calc"}}},{"../scatter/attributes":1015}],1003:[function(t,e,r){"use strict";var n=t("gl-pointcloud2d");var a=t("../../lib/str2rgbarray");var i=t("../../plots/cartesian/autorange").expand;var o=t("../scatter/get_trace_color");function s(t,e){this.scene=t;this.uid=e;this.type="pointcloud";this.pickXData=[];this.pickYData=[];this.xData=[];this.yData=[];this.textLabels=[];this.color="rgb(0, 0, 0)";this.name="";this.hoverinfo="all";this.idToIndex=new Int32Array(0);this.bounds=[0,0,0,0];this.pointcloudOptions={positions:new Float32Array(0),idToIndex:this.idToIndex,sizemin:.5,sizemax:12,color:[0,0,0,1],areaRatio:1,borderColor:[0,0,0,1]};this.pointcloud=n(t.glplot,this.pointcloudOptions);this.pointcloud._trace=this}var l=s.prototype;l.handlePick=function(t){var e=this.idToIndex[t.pointId];return{trace:this,dataCoord:t.dataCoord,traceCoord:this.pickXYData?[this.pickXYData[e*2],this.pickXYData[e*2+1]]:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:this.color,name:this.name,pointIndex:e,hoverinfo:this.hoverinfo}};l.update=function(t){this.index=t.index;this.textLabels=t.text;this.name=t.name;this.hoverinfo=t.hoverinfo;this.bounds=[Infinity,Infinity,-Infinity,-Infinity];this.updateFast(t);this.color=o(t,{})};l.updateFast=function(t){var e=this.xData=this.pickXData=t.x;var r=this.yData=this.pickYData=t.y;var n=this.pickXYData=t.xy;var i=t.xbounds&&t.ybounds;var o=t.indices;var s,l,u,c=this.bounds;var f,h,p;if(n){u=n;s=n.length>>>1;if(i){c[0]=t.xbounds[0];c[2]=t.xbounds[1];c[1]=t.ybounds[0];c[3]=t.ybounds[1]}else{for(p=0;pc[2])c[2]=f;if(hc[3])c[3]=h}}if(o){l=o}else{l=new Int32Array(s);for(p=0;pc[2])c[2]=f;if(hc[3])c[3]=h}}this.idToIndex=l;this.pointcloudOptions.idToIndex=l;this.pointcloudOptions.positions=u;var d=a(t.marker.color),v=a(t.marker.border.color),g=t.opacity*t.marker.opacity;d[3]*=g;this.pointcloudOptions.color=d;var m=t.marker.blend;if(m===null){var y=100;m=e.length1})}e.exports=function t(e,r){if(o(r.node.label,r.link.source,r.link.target)){a.error("Circularity is present in the Sankey data. Removing all nodes and links.");r.link.label=[];r.link.source=[];r.link.target=[];r.link.value=[];r.link.color=[];r.node.label=[];r.node.color=[]}return i({link:r.link,node:r.node})}},{"../../lib":684,"../../lib/gup":681,"strongly-connected-components":491}],1009:[function(t,e,r){"use strict";e.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"cubic-in-out",cn:{sankey:"sankey",sankeyLinks:"sankey-links",sankeyLink:"sankey-link",sankeyNodeSet:"sankey-node-set",sankeyNode:"sankey-node",nodeRect:"node-rect",nodeCapture:"node-capture",nodeCentered:"node-entered",nodeLabelGuide:"node-label-guide",nodeLabel:"node-label",nodeLabelTextPath:"node-label-text-path"}}},{}],1010:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("./attributes");var i=t("../../components/color");var o=t("tinycolor2");var s=t("../../plots/domain").defaults;e.exports=function t(e,r,l,u){function c(t,i){return n.coerce(e,r,a,t,i)}c("node.label");c("node.pad");c("node.thickness");c("node.line.color");c("node.line.width");var f=u.colorway;var h=function(t){return f[t%f.length]};c("node.color",r.node.label.map(function(t,e){return i.addOpacity(h(e),.8)}));c("link.label");c("link.source");c("link.target");c("link.value");c("link.line.color");c("link.line.width");c("link.color",r.link.value.map(function(){return o(u.paper_bgcolor).getLuminance()<.333?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)"}));s(r,u,c);c("orientation");c("valueformat");c("valuesuffix");c("arrangement");n.coerceFont(c,"textfont",n.extendFlat({},u.font));r._length=null}},{"../../components/color":558,"../../lib":684,"../../plots/domain":757,"./attributes":1006,tinycolor2:499}],1011:[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.moduleType="trace";n.name="sankey";n.basePlotModule=t("./base_plot");n.categories=["noOpacity"];n.meta={};e.exports=n},{"./attributes":1006,"./base_plot":1007,"./calc":1008,"./defaults":1010,"./plot":1012}],1012:[function(t,e,r){"use strict";var n=t("d3");var a=t("./render");var i=t("../../components/fx");var o=t("../../components/color");var s=t("../../lib");var l=t("./constants").cn;var u=s._;function c(t){return t!==""}function f(t,e){return t.filter(function(t){return t.key===e.traceId})}function h(t,e){n.select(t).select("path").style("fill-opacity",e);n.select(t).select("rect").style("fill-opacity",e)}function p(t){n.select(t).select("text.name").style("fill","black")}function d(t){return function(e){return t.node.sourceLinks.indexOf(e.link)!==-1||t.node.targetLinks.indexOf(e.link)!==-1}}function v(t){return function(e){return e.node.sourceLinks.indexOf(t.link)!==-1||e.node.targetLinks.indexOf(t.link)!==-1}}function g(t,e,r){if(e&&r){f(r,e).selectAll("."+l.sankeyLink).filter(d(e)).call(y.bind(0,e,r,false))}}function m(t,e,r){if(e&&r){f(r,e).selectAll("."+l.sankeyLink).filter(d(e)).call(x.bind(0,e,r,false))}}function y(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",.4);if(a){f(e,t).selectAll("."+l.sankeyLink).filter(function(t){return t.link.label===a}).style("fill-opacity",.4)}if(r){f(e,t).selectAll("."+l.sankeyNode).filter(v(t)).call(g)}}function x(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",function(t){return t.tinyColorAlpha});if(a){f(e,t).selectAll("."+l.sankeyLink).filter(function(t){return t.link.label===a}).style("fill-opacity",function(t){return t.tinyColorAlpha})}if(r){f(e,t).selectAll(l.sankeyNode).filter(v(t)).call(m)}}function b(t,e){var r=t.hoverlabel||{};var n=s.nestedProperty(r,e).get();return Array.isArray(n)?false:n}e.exports=function t(e,r){var s=e._fullLayout;var f=s._paper;var d=s._size;var v=function(t,r){var a=r.link;a.originalEvent=n.event;e._hoverdata=[a];i.click(e,{target:true})};var _=function(t,r,a){n.select(t).call(y.bind(0,r,a,true));e.emit("plotly_hover",{event:n.event,points:[r.link]})};var w=u(e,"source:")+" ";var k=u(e,"target:")+" ";var M=u(e,"incoming flow count:")+" ";var A=u(e,"outgoing flow count:")+" ";var T=function(t,r){var a=r.link.trace;var l=e._fullLayout._paperdiv.node().getBoundingClientRect();var u=t.getBoundingClientRect();var f=u.left+u.width/2;var d=u.top+u.height/2;var v=i.loneHover({x:f-l.left,y:d-l.top,name:n.format(r.valueFormat)(r.link.value)+r.valueSuffix,text:[r.link.label||"",w+r.link.source.label,k+r.link.target.label].filter(c).join("
"),color:b(a,"bgcolor")||o.addOpacity(r.tinyColorHue,1),borderColor:b(a,"bordercolor"),fontFamily:b(a,"font.family"),fontSize:b(a,"font.size"),fontColor:b(a,"font.color"),idealAlign:n.event.x"),color:b(a,"bgcolor")||r.tinyColorHue,borderColor:b(a,"bordercolor"),fontFamily:b(a,"font.family"),fontSize:b(a,"font.size"),fontColor:b(a,"font.color"),idealAlign:"left"},{container:s._hoverlayer.node(),outerContainer:s._paper.node(),gd:e});h(m,.85);p(m)};var I=function(t,r,a){n.select(t).call(m,r,a);e.emit("plotly_unhover",{event:n.event,points:[r.node]});i.loneUnhover(s._hoverlayer.node())};a(f,r,{width:d.w,height:d.h,margin:{t:d.t,r:d.r,b:d.b,l:d.l}},{linkEvents:{hover:_,follow:T,unhover:S,select:v},nodeEvents:{hover:C,follow:L,unhover:I,select:E}})}},{"../../components/color":558,"../../components/fx":600,"../../lib":684,"./constants":1009,"./render":1013,d3:147}],1013:[function(t,e,r){"use strict";var n=t("./constants");var a=t("d3");var i=t("tinycolor2");var o=t("../../components/color");var s=t("../../components/drawing");var l=t("@plotly/d3-sankey").sankey;var u=t("d3-force");var c=t("../../lib");var f=c.isArrayOrTypedArray;var h=c.isIndex;var p=t("../../lib/gup");var d=p.keyFun;var v=p.repeat;var g=p.unwrap;function m(t){var e,r=[];for(e=0;e0&&h(z,C)&&h(P,C))){continue}z=+z;P=+P;E[z]=E[P]=true;T.push({pointNumber:L,label:s.label[L],color:S?s.color[L]:s.color,source:z,target:P,value:+I})}var O=f(o.color);var D=[];var R=false;var B={};for(L=0;L1||t.linkLineWidth>0}function I(t){var e="translate("+t.translateX+","+t.translateY+")";return e+(t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)")}function z(t){return"translate("+(t.horizontal?0:t.labelY)+" "+(t.horizontal?t.labelY:0)+")"}function P(t){return a.svg.line()([[t.horizontal?t.left?-t.sizeAcross:t.visibleWidth+n.nodeTextOffsetHorizontal:n.nodeTextOffsetHorizontal,0],[t.horizontal?t.left?-n.nodeTextOffsetHorizontal:t.sizeAcross:t.visibleHeight-n.nodeTextOffsetHorizontal,0]])}function O(t){return t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)"}function D(t){return t.horizontal?"scale(1 1)":"scale(-1 1)"}function R(t){return t.darkBackground&&!t.horizontal?"rgb(255,255,255)":"rgb(0,0,0)"}function B(t){return t.horizontal&&t.left?"100%":"0%"}function F(t,e,r){t.on(".basic",null).on("mouseover.basic",function(t){if(!t.interactionState.dragInProgress){r.hover(this,t,e);t.interactionState.hovered=[this,t]}}).on("mousemove.basic",function(t){if(!t.interactionState.dragInProgress){r.follow(this,t);t.interactionState.hovered=[this,t]}}).on("mouseout.basic",function(t){if(!t.interactionState.dragInProgress){r.unhover(this,t,e);t.interactionState.hovered=false}}).on("click.basic",function(t){if(t.interactionState.hovered){r.unhover(this,t,e);t.interactionState.hovered=false}if(!t.interactionState.dragInProgress){r.select(this,t,e)}})}function N(t,e,r){var n=a.behavior.drag().origin(function(t){return t.node}).on("dragstart",function(n){if(n.arrangement==="fixed")return;c.raiseToTop(this);n.interactionState.dragInProgress=n.node;y(n.node);if(n.interactionState.hovered){r.nodeEvents.unhover.apply(0,n.interactionState.hovered);n.interactionState.hovered=false}if(n.arrangement==="snap"){var a=n.traceId+"|"+Math.floor(n.node.originalX);if(n.forceLayouts[a]){n.forceLayouts[a].alpha(1)}else{j(t,a,n)}V(t,e,n,a)}}).on("drag",function(r){if(r.arrangement==="fixed")return;var n=a.event.x;var i=a.event.y;if(r.arrangement==="snap"){r.node.x=n;r.node.y=i}else{if(r.arrangement==="freeform"){r.node.x=n}r.node.y=Math.max(r.node.dy/2,Math.min(r.size-r.node.dy/2,i))}y(r.node);if(r.arrangement!=="snap"){r.sankey.relayout();E(t.filter(x(r)),e)}}).on("dragend",function(t){t.interactionState.dragInProgress=false});t.on(".drag",null).call(n)}function j(t,e,r){var a=r.sankey.nodes().filter(function(t){return t.originalX===r.node.originalX});r.forceLayouts[e]=u.forceSimulation(a).alphaDecay(0).force("collide",u.forceCollide().radius(function(t){return t.dy/2+r.nodePad/2}).strength(1).iterations(n.forceIterations)).force("constrain",U(t,e,a,r)).stop()}function V(t,e,r,a){window.requestAnimationFrame(function i(){for(var o=0;o0){window.requestAnimationFrame(i)}})}function U(t,e,r,a){return function t(){var i=0;for(var o=0;o0){a.forceLayouts[e].alpha(0)}}}e.exports=function(t,e,r,a){var l=t.selectAll("."+n.cn.sankey).data(e.filter(function(t){return g(t).trace.visible}).map(w.bind(null,r)),d);l.exit().remove();l.enter().append("g").classed(n.cn.sankey,true).style("box-sizing","content-box").style("position","absolute").style("left",0).style("shape-rendering","geometricPrecision").style("pointer-events","auto").attr("transform",I);l.transition().ease(n.ease).duration(n.duration).attr("transform",I);var u=l.selectAll("."+n.cn.sankeyLinks).data(v,d);u.enter().append("g").classed(n.cn.sankeyLinks,true).style("fill","none");var c=u.selectAll("."+n.cn.sankeyLink).data(function(t){var e={};return t.sankey.links().filter(function(t){return t.value}).map(k.bind(null,e,t))},d);c.enter().append("path").classed(n.cn.sankeyLink,true).attr("d",T).call(F,l,a.linkEvents);c.style("stroke",function(t){return L(t)?o.tinyRGB(i(t.linkLineColor)):t.tinyColorHue}).style("stroke-opacity",function(t){return L(t)?o.opacity(t.linkLineColor):t.tinyColorAlpha}).style("stroke-width",function(t){return L(t)?t.linkLineWidth:1}).style("fill",function(t){return t.tinyColorHue}).style("fill-opacity",function(t){return t.tinyColorAlpha});c.transition().ease(n.ease).duration(n.duration).attr("d",T);c.exit().transition().ease(n.ease).duration(n.duration).style("opacity",0).remove();var f=l.selectAll("."+n.cn.sankeyNodeSet).data(v,d);f.enter().append("g").classed(n.cn.sankeyNodeSet,true);f.style("cursor",function(t){switch(t.arrangement){case"fixed":return"default";case"perpendicular":return"ns-resize";default:return"move"}});var h=f.selectAll("."+n.cn.sankeyNode).data(function(t){var e=t.sankey.nodes();var r={};m(e);return e.filter(function(t){return t.value}).map(M.bind(null,r,t))},d);h.enter().append("g").classed(n.cn.sankeyNode,true).call(A).call(F,l,a.nodeEvents);h.call(N,c,a);h.transition().ease(n.ease).duration(n.duration).call(A);h.exit().transition().ease(n.ease).duration(n.duration).style("opacity",0).remove();var p=h.selectAll("."+n.cn.nodeRect).data(v);p.enter().append("rect").classed(n.cn.nodeRect,true).call(C);p.style("stroke-width",function(t){return t.nodeLineWidth}).style("stroke",function(t){return o.tinyRGB(i(t.nodeLineColor))}).style("stroke-opacity",function(t){return o.opacity(t.nodeLineColor)}).style("fill",function(t){return t.tinyColorHue}).style("fill-opacity",function(t){return t.tinyColorAlpha});p.transition().ease(n.ease).duration(n.duration).call(C);var y=h.selectAll("."+n.cn.nodeCapture).data(v);y.enter().append("rect").classed(n.cn.nodeCapture,true).style("fill-opacity",0);y.attr("x",function(t){return t.zoneX}).attr("y",function(t){return t.zoneY}).attr("width",function(t){return t.zoneWidth}).attr("height",function(t){return t.zoneHeight});var x=h.selectAll("."+n.cn.nodeCentered).data(v);x.enter().append("g").classed(n.cn.nodeCentered,true).attr("transform",z);x.transition().ease(n.ease).duration(n.duration).attr("transform",z);var b=x.selectAll("."+n.cn.nodeLabelGuide).data(v);b.enter().append("path").classed(n.cn.nodeLabelGuide,true).attr("id",function(t){return t.uniqueNodeLabelPathId}).attr("d",P).attr("transform",O);b.transition().ease(n.ease).duration(n.duration).attr("d",P).attr("transform",O);var _=x.selectAll("."+n.cn.nodeLabel).data(v);_.enter().append("text").classed(n.cn.nodeLabel,true).attr("transform",D).style("user-select","none").style("cursor","default").style("fill","black");_.style("text-shadow",function(t){return t.horizontal?"-1px 1px 1px #fff, 1px 1px 1px #fff, 1px -1px 1px #fff, -1px -1px 1px #fff":"none"}).each(function(t){s.font(_,t.textFont)});_.transition().ease(n.ease).duration(n.duration).attr("transform",D);var S=_.selectAll("."+n.cn.nodeLabelTextPath).data(v);S.enter().append("textPath").classed(n.cn.nodeLabelTextPath,true).attr("alignment-baseline","middle").attr("xlink:href",function(t){return"#"+t.uniqueNodeLabelPathId}).attr("startOffset",B).style("fill",R);S.text(function(t){return t.horizontal||t.node.dy>5?t.node.label:""}).attr("text-anchor",function(t){return t.horizontal&&t.left?"end":"start"});S.transition().ease(n.ease).duration(n.duration).attr("startOffset",B).style("fill",R)}},{"../../components/color":558,"../../components/drawing":583,"../../lib":684,"../../lib/gup":681,"./constants":1009,"@plotly/d3-sankey":49,d3:147,"d3-force":143,tinycolor2:499}],1014:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function t(e,r){for(var a=0;a=0;i--){var o=e[i];if(o.type==="scatter"&&o.xaxis===n.xaxis&&o.yaxis===n.yaxis){o.opacity=undefined;break}}}}}},{}],1019:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale");var a=t("../../components/colorscale/calc");var i=t("./subtypes");e.exports=function t(e){if(i.hasLines(e)&&n(e,"line")){a(e,e.line.color,"line","c")}if(i.hasMarkers(e)){if(n(e,"marker")){a(e,e.marker.color,"marker","c")}if(n(e,"marker.line")){a(e,e.marker.line.color,"marker.line","c")}}}},{"../../components/colorscale/calc":566,"../../components/colorscale/has_colorscale":572,"./subtypes":1037}],1020:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20,minTolerance:.2,toleranceGrowth:10,maxScreensAway:20}},{}],1021:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("../../registry");var i=t("./attributes");var o=t("./constants");var s=t("./subtypes");var l=t("./xy_defaults");var u=t("./marker_defaults");var c=t("./line_defaults");var f=t("./line_shape_defaults");var h=t("./text_defaults");var p=t("./fillcolor_defaults");e.exports=function t(e,r,d,v){function g(t,a){return n.coerce(e,r,i,t,a)}var m=l(e,r,v,g),y=mH!==q>=H){j=F[R-1][0];V=F[R][0];if(q-U){N=j+(V-j)*(H-U)/(q-U);I=Math.min(I,N);z=Math.max(z,N)}}}}I=Math.max(I,0);z=Math.min(z,p._length);var G=s.defaultLine;if(s.opacity(h.fillcolor))G=h.fillcolor;else if(s.opacity((h.line||{}).color)){G=h.line.color}n.extendFlat(e,{distance:e.maxHoverDistance,x0:I,x1:z,y0:H,y1:H,color:G});delete e.index;if(h.text&&!Array.isArray(h.text)){e.text=String(h.text)}else e.text=h.name;return[e]}}}},{"../../components/color":558,"../../components/fx":600,"../../lib":684,"../../registry":817,"./fill_hover_text":1022,"./get_trace_color":1024}],1026:[function(t,e,r){"use strict";var n={};var a=t("./subtypes");n.hasLines=a.hasLines;n.hasMarkers=a.hasMarkers;n.hasText=a.hasText;n.isBubble=a.isBubble;n.attributes=t("./attributes");n.supplyDefaults=t("./defaults");n.cleanData=t("./clean_data");n.calc=t("./calc").calc;n.arraysToCalcdata=t("./arrays_to_calcdata");n.plot=t("./plot");n.colorbar=t("./marker_colorbar");n.style=t("./style").style;n.styleOnSelect=t("./style").styleOnSelect;n.hoverPoints=t("./hover");n.selectPoints=t("./select");n.animatable=true;n.moduleType="trace";n.name="scatter";n.basePlotModule=t("../../plots/cartesian");n.categories=["cartesian","svg","symbols","errorBarsOK","showLegend","scatter-like","zoomScale"];n.meta={};e.exports=n},{"../../plots/cartesian":743,"./arrays_to_calcdata":1014,"./attributes":1015,"./calc":1016,"./clean_data":1018,"./defaults":1021,"./hover":1025,"./marker_colorbar":1032,"./plot":1034,"./select":1035,"./style":1036,"./subtypes":1037}],1027:[function(t,e,r){"use strict";var n=t("../../lib").isArrayOrTypedArray;var a=t("../../components/colorscale/has_colorscale");var i=t("../../components/colorscale/defaults");e.exports=function t(e,r,o,s,l,u){var c=(e.marker||{}).color;l("line.color",o);if(a(e,"line")){i(e,r,s,l,{prefix:"line.",cLetter:"c"})}else{var f=(n(c)?false:c)||o;l("line.color",f)}l("line.width");if(!(u||{}).noDash)l("line.dash")}},{"../../components/colorscale/defaults":568,"../../components/colorscale/has_colorscale":572,"../../lib":684}],1028:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM;var a=t("../../lib");var i=a.segmentsIntersect;var o=a.constrain;var s=t("./constants");e.exports=function t(e,r){var l=r.xaxis;var u=r.yaxis;var c=r.simplify;var f=r.connectGaps;var h=r.baseTolerance;var p=r.shape;var d=p==="linear";var v=[];var g=s.minTolerance;var m=new Array(e.length);var y=0;var x;var b,_,w,k;var M;var A;var T;var S;var E,C,L,I;var z,P,O;if(!c){h=g=-1}function D(t){var r=e[t];if(!r)return false;var a=l.c2p(r.x);var i=u.c2p(r.y);if(a===n||i===n)return r.intoCenter||false;return[a,i]}function R(t,e,r,n){var a=r-t;var i=n-e;var o=.5-t;var s=.5-e;var l=a*a+i*i;var u=a*o+i*s;if(u>0&&u1||Math.abs(s.y-r[0][1])>1)){s=[s.x,s.y];if(n&&j(s,t)q||t[1]G){return[o(t[0],U,q),o(t[1],H,G)]}}function et(t,e){if(t[0]===e[0]&&(t[0]===U||t[0]===q))return true;if(t[1]===e[1]&&(t[1]===H||t[1]===G))return true}function rt(t,e){var r=[];var n=tt(t);var a=tt(e);if(n&&a&&et(n,a))return r;if(n)r.push(n);if(a)r.push(a);return r}function nt(t,e,r){return function(n,i){var o=tt(n);var s=tt(i);var l=[];if(o&&s&&et(o,s))return l;if(o)l.push(o);if(s)l.push(s);var u=2*a.constrain((n[t]+i[t])/2,e,r)-((o||n)[t]+(s||i)[t]);if(u){var c;if(o&&s){c=u>0===o[t]>s[t]?o:s}else c=o||s;c[t]+=u}return l}}var at;if(p==="linear"||p==="spline"){at=Q}else if(p==="hv"||p==="vh"){at=rt}else if(p==="hvh")at=nt(0,U,q);else if(p==="vhv")at=nt(1,H,G);function it(t,e){var r=e[0]-t[0];var n=(e[1]-t[1])/r;var a=(t[1]*e[0]-e[1]*t[0])/r;if(a>0)return[n>0?U:q,G];else return[n>0?q:U,H]}function ot(t){var e=t[0];var r=t[1];var n=e===m[y-1][0];var a=r===m[y-1][1];if(n&&a)return;if(y>1){var i=e===m[y-2][0];var o=r===m[y-2][1];if(n&&(e===U||e===q)&&i){if(o)y--;else m[y-1]=t}else if(a&&(r===H||r===G)&&o){if(i)y--;else m[y-1]=t}else m[y++]=t}else m[y++]=t}function st(t){if(m[y-1][0]!==t[0]&&m[y-1][1]!==t[1]){ot([Z,$])}ot(t);J=null;Z=$=0}function lt(t){B=t[0]/l._length;F=t[1]/u._length;Y=t[0]q?q:0;X=t[1]G?G:0;if(Y||X){if(!y){m[y++]=[Y||t[0],X||t[1]]}else if(J){var e=at(J,t);if(e.length>1){st(e[0]);m[y++]=e[1]}}else{K=at(m[y-1],t)[0];m[y++]=K}var r=m[y-1];if(Y&&X&&(r[0]!==Y||r[1]!==X)){if(J){if(Z!==Y&&$!==X){if(Z&&$){ot(it(J,t))}else{ot([Z||Y,$||X])}}else if(Z&&$){ot([Z,$])}}ot([Y,X])}else if(Z-Y&&$-X){ot([Y||Z,X||$])}J=t;Z=Y;$=X}else{if(J){st(at(J,t)[0])}m[y++]=t}}for(x=0;xN(M,ut))break;_=M;I=S[0]*T[0]+S[1]*T[1];if(I>C){C=I;w=M;A=false}else if(I=e.length||!M)break;lt(M);b=M}if(J)ot([Z||J[0],$||J[1]]);v.push(m.slice(0,y))}return v}},{"../../constants/numerical":661,"../../lib":684,"./constants":1020}],1029:[function(t,e,r){"use strict";e.exports=function t(e,r,n){var a=n("line.shape");if(a==="spline")n("line.smoothing")}},{}],1030:[function(t,e,r){"use strict";e.exports=function t(e,r,n){var a,i;var o=null;for(i=0;i0?Math.max(e,i):0}}},{"fast-isnumeric":214}],1032:[function(t,e,r){"use strict";e.exports={container:"marker",min:"cmin",max:"cmax"}},{}],1033:[function(t,e,r){"use strict";var n=t("../../components/color");var a=t("../../components/colorscale/has_colorscale");var i=t("../../components/colorscale/defaults");var o=t("./subtypes");e.exports=function t(e,r,s,l,u,c){var f=o.isBubble(e),h=(e.line||{}).color,p;c=c||{};if(h)s=h;u("marker.symbol");u("marker.opacity",f?.7:1);u("marker.size");u("marker.color",s);if(a(e,"marker")){i(e,r,l,u,{prefix:"marker.",cLetter:"c"})}if(!c.noSelect){u("selected.marker.color");u("unselected.marker.color");u("selected.marker.size");u("unselected.marker.size")}if(!c.noLine){if(h&&!Array.isArray(h)&&r.marker.color!==h){p=h}else if(f)p=n.background;else p=n.defaultLine;u("marker.line.color",p);if(a(e,"marker.line")){i(e,r,l,u,{prefix:"marker.line.",cLetter:"c"})}u("marker.line.width",f?1:0)}if(f){u("marker.sizeref");u("marker.sizemin");u("marker.sizemode")}if(c.gradient){var d=u("marker.gradient.type");if(d!=="none"){u("marker.gradient.color")}}}},{"../../components/color":558,"../../components/colorscale/defaults":568,"../../components/colorscale/has_colorscale":572,"./subtypes":1037}],1034:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../registry");var i=t("../../lib");var o=t("../../components/drawing");var s=t("./subtypes");var l=t("./line_points");var u=t("./link_traces");var c=t("../../lib/polygon").tester;e.exports=function t(e,r,a,i,o,s){var l,c,p,d;var v=!o;var g=!!o&&o.duration>0;p=i.selectAll("g.trace").data(a,function(t){return t[0].trace.uid});p.enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2);u(e,r,a);f(e,i,r);for(l=0,c={};ln?1:-1});if(g){if(s){d=s()}var m=n.transition().duration(o.duration).ease(o.easing).each("end",function(){d&&d()}).each("interrupt",function(){d&&d()});m.each(function(){i.selectAll("g.trace").each(function(t,n){h(e,n,r,t,a,this,o)})})}else{i.selectAll("g.trace").each(function(t,n){h(e,n,r,t,a,this,o)})}if(v){p.exit().remove()}i.selectAll("path:not([d])").remove()};function f(t,e,r){var a;e.selectAll("g.trace").each(function(t){var e=n.select(this);a=t[0].trace;if(a._nexttrace){a._nextFill=e.select(".js-fill.js-tonext");if(!a._nextFill.size()){var i=":first-child";if(e.select(".js-fill.js-tozero").size()){i+=" + *"}a._nextFill=e.insert("path",i).attr("class","js-fill js-tonext")}}else{e.selectAll(".js-fill.js-tonext").remove();a._nextFill=null}if(a.fill&&(a.fill.substr(0,6)==="tozero"||a.fill==="toself"||a.fill.substr(0,2)==="to"&&!a._prevtrace)){a._ownFill=e.select(".js-fill.js-tozero");if(!a._ownFill.size()){a._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero")}}else{e.selectAll(".js-fill.js-tozero").remove();a._ownFill=null}e.selectAll(".js-fill").call(o.setClipUrl,r.layerClipId)})}function h(t,e,r,u,f,h,d){var v,g;p(t,e,r,u,f);var m=!!d&&d.duration>0;function y(t){return m?t.transition():t}var x=r.xaxis,b=r.yaxis;var _=u[0].trace,w=_.line,k=n.select(h);a.getComponentMethod("errorbars","plot")(k,r,d);if(_.visible!==true)return;y(k).style("opacity",_.opacity);var M,A;var T=_.fill.charAt(_.fill.length-1);if(T!=="x"&&T!=="y")T="";if(!r.isRangePlot)u[0].node3=k;var S="";var E=[];var C=_._prevtrace;if(C){S=C._prevRevpath||"";A=C._nextFill;E=C._polygons}var L,I,z="",P="",O,D,R,B,F,N,j;var V=[],U=i.noop;M=_._ownFill;if(s.hasLines(_)||_.fill!=="none"){if(A){A.datum(u)}if(["hv","vh","hvh","vhv"].indexOf(w.shape)!==-1){O=o.steps(w.shape);D=o.steps(w.shape.split("").reverse().join(""))}else if(w.shape==="spline"){O=D=function(t){var e=t[t.length-1];if(t.length>1&&t[0][0]===e[0]&&t[0][1]===e[1]){return o.smoothclosed(t.slice(1),w.smoothing)}else{return o.smoothopen(t,w.smoothing)}}}else{O=D=function(t){return"M"+t.join("L")}}R=function(t){return D(t.reverse())};V=l(u,{xaxis:x,yaxis:b,connectGaps:_.connectgaps,baseTolerance:Math.max(w.width||1,3)/4,shape:w.shape,simplify:w.simplify});j=_._polygons=new Array(V.length);for(g=0;g1){var r=n.select(this);r.datum(u);if(t){y(r.style("opacity",0).attr("d",L).call(o.lineGroupStyle)).style("opacity",1)}else{var a=y(r);a.attr("d",L);o.singleLineStyle(u,a)}}}}}var q=k.selectAll(".js-line").data(V);y(q.exit()).style("opacity",0).remove();q.each(U(false));q.enter().append("path").classed("js-line",true).style("vector-effect","non-scaling-stroke").call(o.lineGroupStyle).each(U(true));o.setClipUrl(q,r.layerClipId);function H(t){y(t).attr("d","M0,0Z")}if(V.length){if(M){if(B&&N){if(T){if(T==="y"){B[1]=N[1]=b.c2p(0,true)}else if(T==="x"){B[0]=N[0]=x.c2p(0,true)}y(M).attr("d","M"+N+"L"+B+"L"+z.substr(1)).call(o.singleFillStyle)}else{y(M).attr("d",z+"Z").call(o.singleFillStyle)}}}else if(A){if(_.fill.substr(0,6)==="tonext"&&z&&S){if(_.fill==="tonext"){y(A).attr("d",z+"Z"+S+"Z").call(o.singleFillStyle)}else{y(A).attr("d",z+"L"+S.substr(1)+"Z").call(o.singleFillStyle)}_._polygons=_._polygons.concat(E)}else{H(A);_._polygons=null}}_._prevRevpath=P;_._prevPolygons=j}else{if(M)H(M);else if(A)H(A);_._polygons=_._prevRevpath=_._prevPolygons=null}function G(t){return t.filter(function(t){return t.vis})}function W(t){return t.id}function Y(t){if(t.ids){return W}}function X(){return false}function Z(e){var a,l,u;var c=e[0].trace;var f=n.select(this);var h=s.hasMarkers(c);var p=s.hasText(c);var d=Y(c);var v=X;var g=X;if(h){v=c.marker.maxdisplayed||c._needsCull?G:i.identity}if(p){g=c.marker.maxdisplayed||c._needsCull?G:i.identity}l=f.selectAll("path.point");a=l.data(v,d);var _=a.enter().append("path").classed("point",true);if(m){_.call(o.pointStyle,c,t).call(o.translatePoints,x,b).style("opacity",0).transition().style("opacity",1)}a.order();var w;if(h){w=o.makePointStyleFns(c)}a.each(function(e){var a=n.select(this);var i=y(a);u=o.translatePoint(e,i,x,b);if(u){o.singlePointStyle(e,i,c,w,t);if(r.layerClipId){o.hideOutsideRangePoint(e,i,x,b,c.xcalendar,c.ycalendar)}if(c.customdata){a.classed("plotly-customdata",e.data!==null&&e.data!==undefined)}}else{i.remove()}});if(m){a.exit().transition().style("opacity",0).remove()}else{a.exit().remove()}l=f.selectAll("g");a=l.data(g,d);a.enter().append("g").classed("textpoint",true).append("text");a.order();a.each(function(t){var e=n.select(this);var a=y(e.select("text"));u=o.translatePoint(t,a,x,b);if(u){if(r.layerClipId){o.hideOutsideRangePoint(t,e,x,b,c.xcalendar,c.ycalendar)}}else{e.remove()}});a.selectAll("text").call(o.textPointStyle,c,t).each(function(t){var e=x.c2p(t.x);var r=b.c2p(t.y);n.select(this).selectAll("tspan.line").each(function(){y(n.select(this)).attr({x:e,y:r})})});a.exit().remove()}var $=k.selectAll(".points");v=$.data([u]);$.each(Z);v.enter().append("g").classed("points",true).each(Z);v.exit().remove();v.each(function(t){var e=t[0].trace.cliponaxis===false;o.setClipUrl(n.select(this),e?null:r.layerClipId)})}function p(t,e,r,a,o){var l=r.xaxis,u=r.yaxis,c=n.extent(i.simpleMap(l.range,l.r2c)),f=n.extent(i.simpleMap(u.range,u.r2c));var h=a[0].trace;if(!s.hasMarkers(h))return;var p=h.marker.maxdisplayed;if(p===0)return;var d=a.filter(function(t){return t.x>=c[0]&&t.x<=c[1]&&t.y>=f[0]&&t.y<=f[1]}),v=Math.ceil(d.length/p),g=0;o.forEach(function(t,r){var n=t[0].trace;if(s.hasMarkers(n)&&n.marker.maxdisplayed>0&&r=0)e[1]+=1;if(t.indexOf("top")>=0)e[1]-=1;if(t.indexOf("left")>=0)e[0]-=1;if(t.indexOf("right")>=0)e[0]+=1;return e}function b(t,e){return e(t*4)}function _(t){return p[t]}function w(t,e,r,n,a){var i=null;if(l.isArrayOrTypedArray(t)){i=[];for(var o=0;o=0){var d=m(f.position,f.delaunayColor,f.delaunayAxis);d.opacity=t.opacity;if(this.delaunayMesh){this.delaunayMesh.update(d)}else{d.gl=e;this.delaunayMesh=o(d);this.delaunayMesh._trace=this;this.scene.glplot.add(this.delaunayMesh)}}else if(this.delaunayMesh){this.scene.glplot.remove(this.delaunayMesh);this.delaunayMesh.dispose();this.delaunayMesh=null}};g.dispose=function(){if(this.linePlot){this.scene.glplot.remove(this.linePlot);this.linePlot.dispose()}if(this.scatterPlot){this.scene.glplot.remove(this.scatterPlot);this.scatterPlot.dispose()}if(this.errorBars){this.scene.glplot.remove(this.errorBars);this.errorBars.dispose()}if(this.textMarkers){this.scene.glplot.remove(this.textMarkers);this.textMarkers.dispose()}if(this.delaunayMesh){this.scene.glplot.remove(this.delaunayMesh);this.delaunayMesh.dispose()}};function A(t,e){var r=new v(t,e.uid);r.update(e);return r}e.exports=A},{"../../constants/gl3d_dashes":658,"../../constants/gl3d_markers":659,"../../lib":684,"../../lib/gl_format_color":680,"../../lib/str2rgbarray":707,"../scatter/make_bubble_size_func":1031,"./calc_errors":1042,"delaunay-triangulate":149,"gl-error3d":237,"gl-line3d":245,"gl-mesh3d":268,"gl-scatter3d":283}],1044:[function(t,e,r){"use strict";var n=t("../../registry");var a=t("../../lib");var i=t("../scatter/subtypes");var o=t("../scatter/marker_defaults");var s=t("../scatter/line_defaults");var l=t("../scatter/text_defaults");var u=t("./attributes");e.exports=function t(e,r,f,h){function p(t,n){return a.coerce(e,r,u,t,n)}var d=c(e,r,p,h);if(!d){r.visible=false;return}p("text");p("hovertext");p("mode");if(i.hasLines(r)){p("connectgaps");s(e,r,f,h,p)}if(i.hasMarkers(r)){o(e,r,f,h,p,{noSelect:true})}if(i.hasText(r)){l(e,r,h,p,{noSelect:true})}var v=(r.line||{}).color,g=(r.marker||{}).color;if(p("surfaceaxis")>=0)p("surfacecolor",v||g);var m=["x","y","z"];for(var y=0;y<3;++y){var x="projection."+m[y];if(p(x+".show")){p(x+".opacity");p(x+".scale")}}var b=n.getComponentMethod("errorbars","supplyDefaults");b(e,r,f,{axis:"z"});b(e,r,f,{axis:"y",inherit:"z"});b(e,r,f,{axis:"x",inherit:"z"})};function c(t,e,r,a){var i=0,o=r("x"),s=r("y"),l=r("z");var u=n.getComponentMethod("calendars","handleTraceDefaults");u(t,e,["x","y","z"],a);if(o&&s&&l){i=Math.min(o.length,s.length,l.length);e._length=e._xlength=e._ylength=e._zlength=i}return i}},{"../../lib":684,"../../registry":817,"../scatter/line_defaults":1027,"../scatter/marker_defaults":1033,"../scatter/subtypes":1037,"../scatter/text_defaults":1038,"./attributes":1040}],1045:[function(t,e,r){"use strict";var n={};n.plot=t("./convert");n.attributes=t("./attributes");n.markerSymbols=t("../../constants/gl3d_markers");n.supplyDefaults=t("./defaults");n.colorbar=t("../scatter/marker_colorbar");n.calc=t("./calc");n.moduleType="trace";n.name="scatter3d";n.basePlotModule=t("../../plots/gl3d");n.categories=["gl3d","symbols","showLegend"];n.meta={};e.exports=n},{"../../constants/gl3d_markers":659,"../../plots/gl3d":774,"../scatter/marker_colorbar":1032,"./attributes":1040,"./calc":1041,"./convert":1043,"./defaults":1044}],1046:[function(t,e,r){"use strict";var n=t("../scatter/attributes");var a=t("../../plots/attributes");var i=t("../../components/colorscale/attributes");var o=t("../../components/colorbar/attributes");var s=t("../../lib/extend").extendFlat;var l=n.marker,u=n.line,c=l.line;e.exports={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:s({},n.mode,{dflt:"markers"}),text:s({},n.text,{}),line:{color:u.color,width:u.width,dash:u.dash,shape:s({},u.shape,{values:["linear","spline"]}),smoothing:u.smoothing,editType:"calc"},connectgaps:n.connectgaps,fill:s({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:s({symbol:l.symbol,opacity:l.opacity,maxdisplayed:l.maxdisplayed,size:l.size,sizeref:l.sizeref,sizemin:l.sizemin,sizemode:l.sizemode,line:s({width:c.width,editType:"calc"},i("marker.line")),gradient:l.gradient,editType:"calc"},i("marker"),{colorbar:o}),textfont:n.textfont,textposition:n.textposition,selected:n.selected,unselected:n.unselected,hoverinfo:s({},a.hoverinfo,{flags:["a","b","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":559,"../../components/colorscale/attributes":565,"../../lib/extend":673,"../../plots/attributes":729,"../scatter/attributes":1015}],1047:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("../scatter/colorscale_calc");var i=t("../scatter/arrays_to_calcdata");var o=t("../scatter/calc_selection");var s=t("../scatter/calc").calcMarkerSize;var l=t("../carpet/lookup_carpetid");e.exports=function t(e,r){var u=r._carpetTrace=l(e,r);if(!u||!u.visible||u.visible==="legendonly")return;var c;r.xaxis=u.xaxis;r.yaxis=u.yaxis;var f=r._length;var h=new Array(f);var p,d;var v=false;for(c=0;c0){r=t.labelprefix.replace(/ = $/,"")}else{r=t._hovertitle}m.push(r+": "+e.toFixed(3)+t.labelsuffix)}if(g.indexOf("all")!==-1)g=["a","b"];if(g.indexOf("a")!==-1)y(d.aaxis,h.a);if(g.indexOf("b")!==-1)y(d.baxis,h.b);var x=d.ab2ij([h.a,h.b]);var b=Math.floor(x[0]);var _=x[0]-b;var w=Math.floor(x[1]);var k=x[1]-w;var M=d.evalxy([],b,w,_,k);m.push("y: "+M[1].toFixed(3));s.extraText=m.join("
");return o}},{"../scatter/hover":1025}],1051:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes");n.supplyDefaults=t("./defaults");n.colorbar=t("../scatter/marker_colorbar");n.calc=t("./calc");n.plot=t("./plot");n.style=t("../scatter/style").style;n.styleOnSelect=t("../scatter/style").styleOnSelect;n.hoverPoints=t("./hover");n.selectPoints=t("../scatter/select");n.eventData=t("./event_data");n.moduleType="trace";n.name="scattercarpet";n.basePlotModule=t("../../plots/cartesian");n.categories=["svg","carpet","symbols","showLegend","carpetDependent","zoomScale"];n.meta={};e.exports=n},{"../../plots/cartesian":743,"../scatter/marker_colorbar":1032,"../scatter/select":1035,"../scatter/style":1036,"./attributes":1046,"./calc":1047,"./defaults":1048,"./event_data":1049,"./hover":1050,"./plot":1052}],1052:[function(t,e,r){"use strict";var n=t("../scatter/plot");var a=t("../../plots/cartesian/axes");var i=t("../../components/drawing");e.exports=function t(e,r,o,s){var l,u,c;var f=o[0][0].carpet;var h={xaxis:a.getFromId(e,f.xaxis||"x"),yaxis:a.getFromId(e,f.yaxis||"y"),plot:r.plot};n(e,h,o,s);for(l=0;l")}},{"../../components/fx":600,"../../constants/numerical":661,"../../plots/cartesian/axes":732,"../scatter/fill_hover_text":1022,"../scatter/get_trace_color":1024,"./attributes":1053}],1058:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes");n.supplyDefaults=t("./defaults");n.colorbar=t("../scatter/marker_colorbar");n.calc=t("./calc");n.plot=t("./plot");n.style=t("./style");n.styleOnSelect=t("../scatter/style").styleOnSelect;n.hoverPoints=t("./hover");n.eventData=t("./event_data");n.selectPoints=t("./select");n.moduleType="trace";n.name="scattergeo";n.basePlotModule=t("../../plots/geo");n.categories=["geo","symbols","showLegend","scatter-like"];n.meta={};e.exports=n},{"../../plots/geo":762,"../scatter/marker_colorbar":1032,"../scatter/style":1036,"./attributes":1053,"./calc":1054,"./defaults":1055,"./event_data":1056,"./hover":1057,"./plot":1059,"./select":1060,"./style":1061}],1059:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../lib");var i=t("../../constants/numerical").BADNUM;var o=t("../../lib/topojson_utils").getTopojsonFeatures;var s=t("../../lib/geo_location_utils").locationToFeature;var l=t("../../lib/geojson_utils");var u=t("../scatter/subtypes");var c=t("./style");e.exports=function t(e,r,o){for(var s=0;sd.TOO_MANY_POINTS?"rect":h.hasMarkers(e)?"rect":"round";if(o&&e.connectgaps){var l=a[0];var u=a[1];for(i=0;i1?l[o]:l[0]:l;var d=Array.isArray(u)?u.length>1?u[o]:u[0]:u;var v=g[p];var m=g[d];var y=c?c/.8+1:0;var x=-m*y-m*.5;i.offset[o]=[v*y/f,x/f]}}return i}e.exports={style:m,markerStyle:x,markerSelection:b,linePositions:C,errorBarPositions:L,textPosition:I}},{"../../components/drawing":583,"../../constants/interactions":660,"../../lib":684,"../../lib/gl_format_color":680,"../../plots/cartesian/axes":732,"../../plots/cartesian/axis_ids":735,"../../registry":817,"../scatter/make_bubble_size_func":1031,"../scatter/subtypes":1037,"./constants":1063,"color-normalize":107,"fast-isnumeric":214,"svg-path-sdf":497}],1065:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("../../registry");var i=t("./attributes");var o=t("../scatter/constants");var s=t("../scatter/subtypes");var l=t("../scatter/xy_defaults");var u=t("../scatter/marker_defaults");var c=t("../scatter/line_defaults");var f=t("../scatter/fillcolor_defaults");var h=t("../scatter/text_defaults");e.exports=function t(e,r,p,d){function v(t,a){return n.coerce(e,r,i,t,a)}var g=e.marker?/-open/.test(e.marker.symbol):false;var m=s.isBubble(e);var y=l(e,r,d,v);if(!y){r.visible=false;return}var x=y=k){_.marker.cluster=u.tree}M.lineOptions.push(_.line);M.errorXOptions.push(_.errorX);M.errorYOptions.push(_.errorY);M.fillOptions.push(_.fill);M.markerOptions.push(_.marker);M.markerSelectedOptions.push(_.markerSel);M.markerUnselectedOptions.push(_.markerUnsel);M.textOptions.push(_.text);M.textSelectedOptions.push(_.textSel);M.textUnselectedOptions.push(_.textUnsel);M.count++;u._scene=M;u.index=M.count-1;u.x=d;u.y=y;u.positions=x;u.count=s;t.firstscatter=false;return[{x:false,y:false,t:u,trace:e}]}function T(t,e,r,n,a,i){var o=_.style(t,r);if(o.marker){o.marker.positions=n}if(o.line&&n.length>1){c.extendFlat(o.line,_.linePositions(t,r,n))}if(o.errorX||o.errorY){var s=_.errorBarPositions(t,r,n,a,i);if(o.errorX){c.extendFlat(o.errorX,s.x)}if(o.errorY){c.extendFlat(o.errorY,s.y)}}if(o.text){c.extendFlat(o.text,{positions:n},_.textPosition(t,r,o.text,o.marker));c.extendFlat(o.textSel,{positions:n},_.textPosition(t,r,o.text,o.markerSel));c.extendFlat(o.textUnsel,{positions:n},_.textPosition(t,r,o.text,o.markerUnsel))}return o}function S(t,e){var r=e._scene;var n=t._fullLayout;var a={count:0,dirty:true,lineOptions:[],fillOptions:[],markerOptions:[],markerSelectedOptions:[],markerUnselectedOptions:[],errorXOptions:[],errorYOptions:[],textOptions:[],textSelectedOptions:[],textUnselectedOptions:[]};var i={selectBatch:null,unselectBatch:null,fill2d:false,scatter2d:false,error2d:false,line2d:false,glText:false,select2d:null};if(!e._scene){r=e._scene={};r.init=function t(){c.extendFlat(r,i,a)};r.init();r.update=function t(e){var n;var a=new Array(r.count);for(n=0;n=0?Math.floor((r+180)/360):Math.ceil((r-180)/360);var v=d*360;var g=r-v;function m(t){var e=t.lonlat;if(e[0]===s)return Infinity;var r=a.wrap180(e[0]);var n=e[1];var i=p.project([r,n]);var l=i.x-f.c2p([g,n]);var u=i.y-h.c2p([r,o]);var c=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(l*l+u*u)-c,1-3/c)}n.getClosest(u,m,e);if(e.index===false)return;var y=u[e.index];var x=y.lonlat;var b=[a.wrap180(x[0])+v,x[1]];var _=f.c2p(b);var w=h.c2p(b);var k=y.mrc||1;e.x0=_-k;e.x1=_+k;e.y0=w-k;e.y1=w+k;e.color=i(c,y);e.extraText=l(c,y,u[0].t.labels);return[e]};function l(t,e,r){var n=e.hi||t.hoverinfo;var a=n.split("+");var i=a.indexOf("all")!==-1;var s=a.indexOf("lon")!==-1;var l=a.indexOf("lat")!==-1;var u=e.lonlat;var c=[];function f(t){return t+"\xb0"}if(i||s&&l){c.push("("+f(u[0])+", "+f(u[1])+")")}else if(s){c.push(r.lon+f(u[0]))}else if(l){c.push(r.lat+f(u[1]))}if(i||a.indexOf("text")!==-1){o(e,t,c)}return c.join("
")}},{"../../components/fx":600,"../../constants/numerical":661,"../../lib":684,"../scatter/fill_hover_text":1022,"../scatter/get_trace_color":1024}],1072:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes");n.supplyDefaults=t("./defaults");n.colorbar=t("../scatter/marker_colorbar");n.calc=t("../scattergeo/calc");n.plot=t("./plot");n.hoverPoints=t("./hover");n.eventData=t("./event_data");n.selectPoints=t("./select");n.style=function(t,e){if(e){var r=e[0].trace;r._glTrace.update(e)}};n.moduleType="trace";n.name="scattermapbox";n.basePlotModule=t("../../plots/mapbox");n.categories=["mapbox","gl","symbols","showLegend","scatterlike"];n.meta={};e.exports=n},{"../../plots/mapbox":789,"../scatter/marker_colorbar":1032,"../scattergeo/calc":1054,"./attributes":1067,"./defaults":1069,"./event_data":1070,"./hover":1071,"./plot":1073,"./select":1074}],1073:[function(t,e,r){"use strict";var n=t("./convert");function a(t,e){this.subplot=t;this.uid=e;this.sourceIds={fill:e+"-source-fill",line:e+"-source-line",circle:e+"-source-circle",symbol:e+"-source-symbol"};this.layerIds={fill:e+"-layer-fill",line:e+"-layer-line",circle:e+"-layer-circle",symbol:e+"-layer-symbol"};this.order=["fill","line","circle","symbol"]}var i=a.prototype;i.addSource=function(t,e){this.subplot.map.addSource(this.sourceIds[t],{type:"geojson",data:e.geojson})};i.setSourceData=function(t,e){this.subplot.map.getSource(this.sourceIds[t]).setData(e.geojson)};i.addLayer=function(t,e){this.subplot.map.addLayer({type:t,id:this.layerIds[t],source:this.sourceIds[t],layout:e.layout,paint:e.paint})};i.update=function t(e){var r=this.subplot;var a=n(e);for(var i=0;i")}e.exports={hoverPoints:o,makeHoverPointText:s}},{"../../lib":684,"../../plots/cartesian/axes":732,"../scatter/hover":1025}],1079:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"scatterpolar",basePlotModule:t("../../plots/polar"),categories:["polar","symbols","showLegend","scatter-like"],attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,hoverPoints:t("./hover").hoverPoints,selectPoints:t("../scatter/select"),meta:{}}},{"../../plots/polar":798,"../scatter/marker_colorbar":1032,"../scatter/select":1035,"../scatter/style":1036,"./attributes":1075,"./calc":1076,"./defaults":1077,"./hover":1078,"./plot":1080}],1080:[function(t,e,r){"use strict";var n=t("../scatter/plot");var a=t("../../constants/numerical").BADNUM;e.exports=function t(e,r,i){var o,s;var l={xaxis:r.xaxis,yaxis:r.yaxis,plot:r.framework,layerClipId:r._hasClipOnAxisFalse?r.clipIds.forTraces:null};var u=r.radialAxis;var c=u.range;var f;if(c[0]>c[1]){f=function(t){return t<=0}}else{f=function(t){return t>=0}}for(o=0;o=0){_=o.c2r(b)-l[0];k=L(w);E[x]=S[x*2]=_*Math.cos(k);C[x]=S[x*2+1]=_*Math.sin(k)}else{E[x]=C[x]=S[x*2]=S[x*2+1]=NaN}}var I=i.sceneOptions(t,e,v,S);if(I.fill&&!f.fill2d)f.fill2d=true;if(I.marker&&!f.scatter2d)f.scatter2d=true;if(I.line&&!f.line2d)f.line2d=true;if((I.errorX||I.errorY)&&!f.error2d)f.error2d=true;g.tree=n(S);if(I.marker&&T>=c){I.marker.cluster=g.tree}if(u.hasMarkers(v)){I.markerSel.positions=I.markerUnsel.positions=I.marker.positions}f.lineOptions.push(I.line);f.errorXOptions.push(I.errorX);f.errorYOptions.push(I.errorY);f.fillOptions.push(I.fill);f.markerOptions.push(I.marker);f.markerSelectedOptions.push(I.markerSel);f.markerUnselectedOptions.push(I.markerUnsel);f.count=r.length;g._scene=f;g.index=p;g.x=E;g.y=C;g.rawx=E;g.rawy=C;g.r=m;g.theta=y;g.positions=S;g.count=T});return i.plot(t,e,r)}function p(t,e,r,n){var a=t.cd;var o=a[0].t;var s=o.r;var u=o.theta;var c=i.hoverPoints(t,e,r,n);if(!c||c[0].index===false)return;var f=c[0];if(f.index===undefined){return c}var h=t.subplot;var p=h.angularAxis;var d=f.cd[f.index];var v=f.trace;d.r=s[f.index];d.theta=u[f.index];d.rad=p.c2rad(d.theta,v.thetaunit);if(!h.isPtWithinSector(d))return;f.xLabelVal=undefined;f.yLabelVal=undefined;f.extraText=l(d,v,h);return c}e.exports={moduleType:"trace",name:"scatterpolargl",basePlotModule:t("../../plots/polar"),categories:["gl","regl","polar","symbols","showLegend","scatter-like"],attributes:t("./attributes"),supplyDefaults:t("./defaults"),colorbar:t("../scatter/marker_colorbar"),calc:f,plot:h,hoverPoints:p,style:i.style,selectPoints:i.selectPoints,meta:{}}},{"../../plots/cartesian/axes":732,"../../plots/polar":798,"../scatter/colorscale_calc":1019,"../scatter/marker_colorbar":1032,"../scatter/subtypes":1037,"../scattergl":1066,"../scattergl/constants":1063,"../scatterpolar/hover":1078,"./attributes":1081,"./defaults":1082,"fast-isnumeric":214,"point-cluster":436}],1084:[function(t,e,r){"use strict";var n=t("../scatter/attributes");var a=t("../../plots/attributes");var i=t("../../components/colorscale/attributes");var o=t("../../components/colorbar/attributes");var s=t("../../components/drawing/attributes").dash;var l=t("../../lib/extend").extendFlat;var u=n.marker,c=n.line,f=u.line;e.exports={a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},c:{valType:"data_array",editType:"calc"},sum:{valType:"number",dflt:0,min:0,editType:"calc"},mode:l({},n.mode,{dflt:"markers"}),text:l({},n.text,{}),hovertext:l({},n.hovertext,{}),line:{color:c.color,width:c.width,dash:s,shape:l({},c.shape,{values:["linear","spline"]}),smoothing:c.smoothing,editType:"calc"},connectgaps:n.connectgaps,cliponaxis:n.cliponaxis,fill:l({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:l({symbol:u.symbol,opacity:u.opacity,maxdisplayed:u.maxdisplayed,size:u.size,sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,line:l({width:f.width,editType:"calc"},i("marker.line")),gradient:u.gradient,editType:"calc"},i("marker"),{colorbar:o}),textfont:n.textfont,textposition:n.textposition,selected:n.selected,unselected:n.unselected,hoverinfo:l({},a.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":559,"../../components/colorscale/attributes":565,"../../components/drawing/attributes":582,"../../lib/extend":673,"../../plots/attributes":729,"../scatter/attributes":1015}],1085:[function(t,e,r){"use strict";var n=t("fast-isnumeric");var a=t("../scatter/colorscale_calc");var i=t("../scatter/arrays_to_calcdata");var o=t("../scatter/calc_selection");var s=t("../scatter/calc").calcMarkerSize;var l=["a","b","c"];var u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function t(e,r){var c=e._fullLayout[r.subplot];var f=c.sum;var h=r.sum||f;var p={a:r.a,b:r.b,c:r.c};var d,v,g,m,y,x;for(d=0;d");return s}},{"../../plots/cartesian/axes":732,"../scatter/hover":1025}],1089:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes");n.supplyDefaults=t("./defaults");n.colorbar=t("../scatter/marker_colorbar");n.calc=t("./calc");n.plot=t("./plot");n.style=t("../scatter/style").style;n.styleOnSelect=t("../scatter/style").styleOnSelect;n.hoverPoints=t("./hover");n.selectPoints=t("../scatter/select");n.eventData=t("./event_data");n.moduleType="trace";n.name="scatterternary";n.basePlotModule=t("../../plots/ternary");n.categories=["ternary","symbols","showLegend","scatter-like"];n.meta={};e.exports=n},{"../../plots/ternary":810,"../scatter/marker_colorbar":1032,"../scatter/select":1035,"../scatter/style":1036,"./attributes":1084,"./calc":1085,"./defaults":1086,"./event_data":1087,"./hover":1088,"./plot":1090}],1090:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function t(e,r,a){var i=r.plotContainer;i.select(".scatterlayer").selectAll("*").remove();var o={xaxis:r.xaxis,yaxis:r.yaxis,plot:i,layerClipId:r._hasClipOnAxisFalse?r.clipIdRelative:null};var s=r.layers.frontplot.select("g.scatterlayer");n(e,o,a,s)}},{"../scatter/plot":1034}],1091:[function(t,e,r){"use strict";var n=t("../scattergl/attributes");var a=t("../../plots/cartesian/constants").idRegex;var i=t("../../plot_api/plot_template").templatedArray;function o(t){return{valType:"info_array",freeLength:true,editType:"calc",items:{valType:"subplotid",regex:a[t],editType:"plot"}}}e.exports={dimensions:i("dimension",{visible:{valType:"boolean",dflt:true,editType:"calc"},label:{valType:"string",editType:"calc"},values:{valType:"data_array",editType:"calc+clearAxisTypes"},editType:"calc+clearAxisTypes"}),text:n.text,marker:n.marker,xaxes:o("x"),yaxes:o("y"),diagonal:{visible:{valType:"boolean",dflt:true,editType:"calc"},editType:"calc"},showupperhalf:{valType:"boolean",dflt:true,editType:"calc"},showlowerhalf:{valType:"boolean",dflt:true,editType:"calc"},selected:{marker:n.selected.marker,editType:"calc"},unselected:{marker:n.unselected.marker,editType:"calc"},opacity:n.opacity}},{"../../plot_api/plot_template":722,"../../plots/cartesian/constants":737,"../scattergl/attributes":1062}],1092:[function(t,e,r){"use strict";var n=t("regl-line2d");var a=t("../../registry");var i=t("../../lib");var o=t("../../lib/prepare_regl");var s=t("../../plots/get_data").getModuleCalcData;var l=t("../../plots/cartesian");var u=t("../../plots/cartesian/axis_ids");var c="splom";function f(t){var e=t._fullLayout;var r=a.getModule(c);var n=s(t.calcdata,r)[0];var i=o(t,["ANGLE_instanced_arrays","OES_element_index_uint"]);if(!i)return;if(e._hasOnlyLargeSploms){d(t)}r.plot(t,{},n)}function h(t){var e=t.calcdata;var r=t._fullLayout;if(r._hasOnlyLargeSploms){d(t)}for(var n=0;n1&&rc&&o){r._splomSubplots[y]=1}else if(um;for(v=0,g=0;v2){r=t.slice(1,e-1)}else if(e===2){r=[(t[0]+t[1])/2]}else{r=t}return r}function p(t){var e=t.length;if(e===1){return[.5,.5]}else{return[t[1]-t[0],t[e-1]-t[e-2]]}}function d(t,e){var r=t.fullSceneLayout;var a=t.dataScale;var u=e._len;var c={};function d(t,e){var n=r[e];var o=a[l[e]];return i.simpleMap(t,function(t){return n.d2l(t)*o})}c.vectors=s(d(e.u,"xaxis"),d(e.v,"yaxis"),d(e.w,"zaxis"),u);var v=f(e.x.slice(0,u));var g=f(e.y.slice(0,u));var m=f(e.z.slice(0,u));if(v.length*g.length*m.length>u){return{positions:[],cells:[]}}var y=d(v,"xaxis");var x=d(g,"yaxis");var b=d(m,"zaxis");c.meshgrid=[y,x,b];if(e.starts){var _=e._slen;c.startingPositions=s(d(e.starts.x.slice(0,_),"xaxis"),d(e.starts.y.slice(0,_),"yaxis"),d(e.starts.z.slice(0,_),"zaxis"))}else{var w=x[0];var k=h(y);var M=h(b);var A=new Array(k.length*M.length);var T=0;for(var S=0;S",maxDimensionCount:60,overdrag:45,releaseTransitionDuration:120,releaseTransitionEase:"cubic-out",scrollbarCaptureWidth:18,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,scrollbarOffset:5,scrollbarWidth:8,transitionDuration:100,transitionEase:"cubic-out",uplift:5,wrapSpacer:" ",wrapSplitCharacter:" ",cn:{table:"table",tableControlView:"table-control-view",scrollBackground:"scroll-background",yColumn:"y-column",columnBlock:"column-block",scrollAreaClip:"scroll-area-clip",scrollAreaClipRect:"scroll-area-clip-rect",columnBoundary:"column-boundary",columnBoundaryClippath:"column-boundary-clippath",columnBoundaryRect:"column-boundary-rect",columnCells:"column-cells",columnCell:"column-cell",cellRect:"cell-rect",cellText:"cell-text",cellTextHolder:"cell-text-holder",scrollbarKit:"scrollbar-kit",scrollbar:"scrollbar",scrollbarSlider:"scrollbar-slider",scrollbarGlyph:"scrollbar-glyph",scrollbarCaptureZone:"scrollbar-capture-zone"}}},{}],1109:[function(t,e,r){"use strict";var n=t("./constants");var a=t("../../lib/extend").extendFlat;var i=t("fast-isnumeric");e.exports=function t(e,r){var p=l(r.cells.values);var d=function(t){return t.slice(r.header.values.length,t.length)};var v=l(r.header.values);if(v.length&&!v[0].length){v[0]=[""];v=l(v)}var g=v.concat(d(p).map(function(){return u((v[0]||[""]).length)}));var m=r.domain;var y=Math.floor(e._fullLayout._size.w*(m.x[1]-m.x[0]));var x=Math.floor(e._fullLayout._size.h*(m.y[1]-m.y[0]));var b=r.header.values.length?g[0].map(function(){return r.header.height}):[n.emptyHeaderHeight];var _=p.length?p[0].map(function(){return r.cells.height}):[];var w=b.reduce(s,0);var k=x-w;var M=k+n.uplift;var A=h(_,M);var T=h(b,w);var S=f(T,[]);var E=f(A,S);var C={};var L=r._fullInput.columnorder.concat(d(p.map(function(t,e){return e})));var I=g.map(function(t,e){var n=Array.isArray(r.columnwidth)?r.columnwidth[Math.min(e,r.columnwidth.length-1)]:r.columnwidth;return i(n)?Number(n):1});var z=I.reduce(s,0);I=I.map(function(t){return t/z*y});var P=Math.max(o(r.header.line.width),o(r.cells.line.width));var O={key:r.index,translateX:m.x[0]*e._fullLayout._size.w,translateY:e._fullLayout._size.h*(1-m.y[1]),size:e._fullLayout._size,width:y,maxLineWidth:P,height:x,columnOrder:L,groupHeight:x,rowBlocks:E,headerRowBlocks:S,scrollY:0,cells:a({},r.cells,{values:p}),headerCells:a({},r.header,{values:g}),gdColumns:g.map(function(t){return t[0]}),gdColumnsOriginalOrder:g.map(function(t){return t[0]}),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:false},columns:g.map(function(t,e){var r=C[t];C[t]=(r||0)+1;var n=t+"__"+C[t];return{key:n,label:t,specIndex:e,xIndex:L[e],xScale:c,x:undefined,calcdata:undefined,columnWidth:I[e]}})};O.columns.forEach(function(t){t.calcdata=O;t.x=c(t)});return O};function o(t){if(Array.isArray(t)){var e=0;for(var r=0;r=e||u===t.length-1){r[a]=o;o.key=l++;o.firstRowIndex=s;o.lastRowIndex=u;o=p();a+=i;s=u+1;i=0}}return r}function p(){return{firstRowIndex:null,lastRowIndex:null,rows:[]}}},{"../../lib/extend":673,"./constants":1108,"fast-isnumeric":214}],1110:[function(t,e,r){"use strict";var n=t("../../lib/extend").extendFlat;r.splitToPanels=function(t){var e=[0,0];var r=n({},t,{key:"header",type:"header",page:0,prevPages:e,currentRepaint:[null,null],dragHandle:true,values:t.calcdata.headerCells.values[t.specIndex],rowBlocks:t.calcdata.headerRowBlocks,calcdata:n({},t.calcdata,{cells:t.calcdata.headerCells})});var a=n({},t,{key:"cells1",type:"cells",page:0,prevPages:e,currentRepaint:[null,null],dragHandle:false,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks});var i=n({},t,{key:"cells2",type:"cells",page:1,prevPages:e,currentRepaint:[null,null],dragHandle:false,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks});return[a,i,r]};r.splitToCells=function(t){var e=a(t);return(t.values||[]).slice(e[0],e[1]).map(function(r,n){var a=typeof r==="string"&&r.match(/[<$&> ]/)?"_keybuster_"+Math.random():"";return{keyWithinBlock:n+a,key:e[0]+n,column:t,calcdata:t.calcdata,page:t.page,rowBlocks:t.rowBlocks,value:r}})};function a(t){var e=t.rowBlocks[t.page];var r=e?e.rows[0].rowIndex:0;var n=e?r+e.rows.length:0;return[r,n]}},{"../../lib/extend":673}],1111:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("./attributes");var i=t("../../plots/domain").defaults;function o(t,e){var r=t.columnorder||[];var n=t.header.values.length;var a=r.slice(0,n);var i=a.slice().sort(function(t,e){return t-e});var o=a.map(function(t){return i.indexOf(t)});for(var s=o.length;s/i);var l=!o||s;t.mayHaveMarkup=o&&i.match(/[<&>]/);var u=E(i);t.latex=u;var c=u?"":I(t.calcdata.cells.prefix,e,r)||"";var f=u?"":I(t.calcdata.cells.suffix,e,r)||"";var h=u?null:I(t.calcdata.cells.format,e,r)||null;var p=c+(h?a.format(h)(t.value):t.value)+f;var d;t.wrappingNeeded=!t.wrapped&&!l&&!u&&(d=C(p));t.cellHeightMayIncrease=s||u||t.mayHaveMarkup||(d===void 0?C(p):d);t.needsConvertToTspans=t.mayHaveMarkup||t.wrappingNeeded||t.latex;var v;if(t.wrappingNeeded){var g=n.wrapSplitCharacter===" "?p.replace(/
a){n.push(i)}a+=l}return n}function B(t,e,r){var n=g(e)[0];if(n===undefined)return;var a=n.rowBlocks;var i=n.calcdata;var o=H(a,a.length);var s=n.calcdata.groupHeight-D(n);var l=i.scrollY=Math.max(0,Math.min(o-s,i.scrollY));var u=R(a,l,s);if(u.length===1){if(u[0]===a.length-1){u.unshift(u[0]-1)}else{u.push(u[0]+1)}}if(u[0]%2){u.reverse()}e.each(function(t,e){t.page=u[e];t.scrollY=l});e.attr("transform",function(t){var e=H(t.rowBlocks,t.page)-t.scrollY;return"translate(0 "+e+")"});if(t){N(t,r,e,u,n.prevPages,n,0);N(t,r,e,u,n.prevPages,n,1);m(r,t)}}function F(t,e,r,i){return function o(s){var l=s.calcdata?s.calcdata:s;var u=e.filter(function(t){return l.key===t.key});var c=r||l.scrollbarState.dragMultiplier;l.scrollY=i===void 0?l.scrollY+c*a.event.dy:i;var f=u.selectAll("."+n.cn.yColumn).selectAll("."+n.cn.columnBlock).filter(P);B(t,f,u)}}function N(t,e,r,n,a,i,o){var s=n[o]!==a[o];if(s){clearTimeout(i.currentRepaint[o]);i.currentRepaint[o]=setTimeout(function(){var i=r.filter(function(t,e){return e===o&&n[e]!==a[e]});y(t,e,i,r);a[o]=n[o]})}}function j(t,e,r){return function i(){var o=a.select(e.parentNode);o.each(function(t){var e=t.fragments;o.selectAll("tspan.line").each(function(t,r){e[r].width=this.getComputedTextLength()});var r=e[e.length-1].width;var a=e.slice(0,-1);var i=[];var s,l;var u=0;var c=t.column.columnWidth-2*n.cellPad;t.value="";while(a.length){s=a.shift();l=s.width+r;if(u+l>c){t.value+=i.join(n.wrapSpacer)+n.lineBreaker;i=[];u=0}i.push(s.text);u+=l}if(u){t.value+=i.join(n.wrapSpacer)}t.wrapped=true});o.selectAll("tspan.line").remove();S(o.select("."+n.cn.cellText),r,t);a.select(e.parentNode.parentNode).call(q)}}function V(t,e,r,i,o){return function s(){if(o.settledY)return;var l=a.select(e.parentNode);var u=Y(o);var c=o.key-u.firstRowIndex;var f=u.rows[c].rowHeight;var h=o.cellHeightMayIncrease?e.parentNode.getBoundingClientRect().height+2*n.cellPad:f;var p=Math.max(h,f);var d=p-u.rows[c].rowHeight;if(d){u.rows[c].rowHeight=p;t.selectAll("."+n.cn.columnCell).call(q);B(null,t.filter(P),0);m(r,i,true)}l.attr("transform",function(){var t=this;var e=t.parentNode;var r=e.getBoundingClientRect();var i=a.select(t.parentNode).select("."+n.cn.cellRect).node().getBoundingClientRect();var s=t.transform.baseVal.consolidate();var l=i.top-r.top+(s?s.matrix.f:n.cellPad);return"translate("+U(o,a.select(t.parentNode).select("."+n.cn.cellTextHolder).node().getBoundingClientRect().width)+" "+l+")"});o.settledY=true}}function U(t,e){switch(t.align){case"left":return n.cellPad;case"right":return t.column.columnWidth-(e||0)-n.cellPad;case"center":return(t.column.columnWidth-(e||0))/2;default:return n.cellPad}}function q(t){t.attr("transform",function(t){var e=t.rowBlocks[0].auxiliaryBlocks.reduce(function(t,e){return t+G(e,Infinity)},0);var r=Y(t);var n=G(r,t.key);var a=n+e;return"translate(0 "+a+")"}).selectAll("."+n.cn.cellRect).attr("height",function(t){return X(Y(t),t.key).rowHeight})}function H(t,e){var r=0;for(var n=e-1;n>=0;n--){r+=W(t[n])}return r}function G(t,e){var r=0;for(var n=0;n0){var x=e.xa;var b=e.ya;var _,w,k,M,A;if(f.orientation==="h"){A=r;_="y";k=b;w="x";M=x}else{A=s;_="x";k=x;w="y";M=b}var T=c[e.index];if(A>=T.span[0]&&A<=T.span[1]){var S=n.extendFlat({},e);var E=M.c2p(A,true);var C=o.getKdeValue(T,f,A);var L=o.getPositionOnKdePath(T,f,E);var I=k._offset;var z=k._length;S[_+"0"]=L[0];S[_+"1"]=L[1];S[w+"0"]=S[w+"1"]=E;S[w+"Label"]=w+": "+a.hoverLabelText(M,A)+", "+c[0].t.labels.kde+" "+C.toFixed(3);S.spikeDistance=y[0].spikeDistance;var P=_+"Spike";S[P]=y[0][P];y[0].spikeDistance=undefined;y[0][P]=undefined;v.push(S);m={stroke:e.color};m[_+"1"]=n.constrain(I+L[0],I,I+z);m[_+"2"]=n.constrain(I+L[1],I,I+z);m[w+"1"]=m[w+"2"]=M._offset+E}}}if(h.indexOf("points")!==-1){g=i.hoverOnPoints(e,r,s)}var O=u.selectAll(".violinline-"+f.uid).data(m?[0]:[]);O.enter().append("line").classed("violinline-"+f.uid,true).attr("stroke-width",1.5);O.exit().remove();O.attr(m);if(l==="closest"){if(g)return[g];return v}if(g){v.push(g);return v}return v}},{"../../lib":684,"../../plots/cartesian/axes":732,"../box/hover":843,"./helpers":1117}],1119:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),setPositions:t("./set_positions"),plot:t("./plot"),style:t("./style"),styleOnSelect:t("../scatter/style").styleOnSelect,hoverPoints:t("./hover"),selectPoints:t("../box/select"),moduleType:"trace",name:"violin",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","svg","symbols","oriented","box-violin","showLegend","violinLayout","zoomScale"],meta:{}}},{"../../plots/cartesian":743,"../box/select":848,"../scatter/style":1036,"./attributes":1114,"./calc":1115,"./defaults":1116,"./hover":1118,"./layout_attributes":1120,"./layout_defaults":1121,"./plot":1122,"./set_positions":1123,"./style":1124}],1120:[function(t,e,r){"use strict";var n=t("../box/layout_attributes");var a=t("../../lib").extendFlat;e.exports={violinmode:a({},n.boxmode,{}),violingap:a({},n.boxgap,{}),violingroupgap:a({},n.boxgroupgap,{})}},{"../../lib":684,"../box/layout_attributes":845}],1121:[function(t,e,r){"use strict";var n=t("../../lib");var a=t("./layout_attributes");var i=t("../box/layout_defaults");e.exports=function t(e,r,o){function s(t,i){return n.coerce(e,r,a,t,i)}i._supply(e,r,o,s,"violin")}},{"../../lib":684,"../box/layout_defaults":846,"./layout_attributes":1120}],1122:[function(t,e,r){"use strict";var n=t("d3");var a=t("../../lib");var i=t("../../components/drawing");var o=t("../box/plot");var s=t("../scatter/line_points");var l=t("./helpers");e.exports=function t(e,r,u,c){var f=e._fullLayout;var h=r.xaxis;var p=r.yaxis;function d(t){var e=s(t,{xaxis:h,yaxis:p,connectGaps:true,baseTolerance:.75,shape:"spline",simplify:true});return i.smoothopen(e[0],1)}var v=c.selectAll("g.trace.violins").data(u,function(t){return t[0].trace.uid});v.enter().append("g").attr("class","trace violins");v.exit().remove();v.order();v.each(function(t){var e=t[0];var i=e.t;var s=e.trace;var u=n.select(this);if(!r.isRangePlot)e.node3=u;var c=f._numViolins;var v=f.violinmode==="group"&&c>1;var g=1-f.violingap;var m=i.bdPos=i.dPos*g*(1-f.violingroupgap)/(v?c:1);var y=i.bPos=v?2*i.dPos*(-.5+(i.num+.5)/c)*g:0;i.wHover=i.dPos*(v?g/c:1);if(s.visible!==true||i.empty){n.select(this).remove();return}var x=r[i.valLetter+"axis"];var b=r[i.posLetter+"axis"];var _=s.side==="both";var w=_||s.side==="positive";var k=_||s.side==="negative";var M=f._violinScaleGroupStats[s.scalegroup];var A=u.selectAll("path.violin").data(a.identity);A.enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","violin");A.exit().remove();A.each(function(t){var e=n.select(this);var r=t.density;var a=r.length;var o=t.pos+y;var l=b.c2p(o);var u;switch(s.scalemode){case"width":u=M.maxWidth/m;break;case"count":u=M.maxWidth/m*(M.maxCount/t.pts.length);break}var c,f,h;var p,v,g,A;if(w){g=new Array(a);for(p=0;pi){i=c;o=u}}}return i?a(o):s};case"rms":return function(t,e){var r=0;var i=0;for(var o=0;o":return function(t){return f(t)>h};case">=":return function(t){return f(t)>=h};case"[]":return function(t){var e=f(t);return e>=h[0]&&e<=h[1]};case"()":return function(t){var e=f(t);return e>h[0]&&e=h[0]&&eh[0]&&e<=h[1]};case"][":return function(t){var e=f(t);return e<=h[0]||e>=h[1]};case")(":return function(t){var e=f(t);return eh[1]};case"](":return function(t){var e=f(t);return e<=h[0]||e>h[1]};case")[":return function(t){var e=f(t);return e=h[1]};case"{}":return function(t){return h.indexOf(f(t))!==-1};case"}{":return function(t){return h.indexOf(f(t))===-1}}}},{"../constants/filter_ops":657,"../lib":684,"../plots/cartesian/axes":732,"../registry":817,"./helpers":1128}],1127:[function(t,e,r){"use strict";var n=t("../lib");var a=t("../plot_api/plot_schema");var i=t("../plots/plots");var o=t("./helpers").pointsAccessorFunction;r.moduleType="transform";r.name="groupby";r.attributes={enabled:{valType:"boolean",dflt:true,editType:"calc"},groups:{valType:"data_array",dflt:[],editType:"calc"},nameformat:{valType:"string",editType:"calc"},styles:{_isLinkedToArray:"style",target:{valType:"string",editType:"calc"},value:{valType:"any",dflt:{},editType:"calc",_compareAsJSON:true},editType:"calc"},editType:"calc"};r.supplyDefaults=function(t,e,a){var i;var o={};function s(e,a){return n.coerce(t,o,r.attributes,e,a)}var l=s("enabled");if(!l)return o;s("groups");s("nameformat",a._dataLength>1?"%{group} (%{trace})":"%{group}");var u=t.styles;var c=o.styles=[];if(u){for(i=0;i